Skip to content

mini-DeepInfer v0.1.0

Choose a tag to compare

@AkiYangDev AkiYangDev released this 24 Oct 07:57

mini-DeepInfer v0.1 可以在 Ascend 910C 上运行 Qwen3.5-2B 文本生成。项目参考 DeepInfer 的设计,把输入准备、模型计算、采样和结果提交拆成可运行的小实验,便于跟着请求读代码。

没有 NPU 也可以开始:基础例子只用 Python,随后换成随机初始化的 PyTorch 小模型,最后再运行真实权重。十四课依次讲到批次调度、两种缓存、设备 token 接续,以及请求取消后怎样等设备用完再回收。

发布前补了不同输入长度、预算、到达和取消时刻的调度对照。140 项测试在 Transformers 5.12.1 下全部通过;wheel 安装后也在仓库目录之外运行过基础例子和随机模型检查。

Qwen3.5-2B 的 Ascend 910C FP32 实测包含十四组完整 logits 对照,最大绝对差约 2.67e-5,在原容差内。四个中间 prompt 块不采样,结束后归还 24/24 槽位。报告中的十五份相关源码 SHA 与本版本一致。

主例使用单设备、eager、greedy 和 FP32,适合短上下文教学。跨轮调度仍通过独立实验运行,尚未接入 generate;BF16 在不同扫描和调度下的生成差异也已记录。现有少量短请求计时没有证明稳定提速。

附件提供 wheel、带教程和报告的源码包,以及 SHA256 校验值。可从本页下载,尚未上传 PyPI。

English

mini-DeepInfer v0.1 runs text-only Qwen3.5-2B on Ascend 910C and uses small experiments to explain DeepInfer's execution flow. Start with Python-only examples, move to tiny PyTorch models, then inspect the same ideas with real weights.

The release includes batching, prompt chunks, split launch/commit execution, and a separate cross-round experiment for arrivals, stops, and cache reuse. All 140 tests pass with Transformers 5.12.1. The saved FP32 device run passes fourteen full-logit comparisons, with a maximum absolute difference of about 2.67e-5 and all 24 slots reclaimed. Its source hashes match this version.

This is a single-device teaching project. Cross-round scheduling is separate from generate, BF16 differences remain documented, and timing so far has not shown a consistent speedup.

Independent community project, with no official affiliation with DeepSeek, SGLang, or Huawei. Original code and documentation use Apache-2.0; model and third-party licenses remain applicable.