J
gcw_9PElOpHK/SmolVLM-256M-Instruct-NPU
模型介绍
文件和版本
Pull Requests
讨论
分析

SmolVLM-256M-Instruct(昇腾 NPU 适配版)

HuggingFaceTB/SmolVLM-256M-Instruct 已在 昇腾 Ascend910B NPU 上跑通图文推理。 部署文档见 readme.md;推理脚本 inference.py; 验证报告 VALIDATION.md。

快速开始

pip install -r requirements.txt
python3 inference.py                       # NPU 图文生成(内置合成测试图)
python3 inference.py --image demo.png --prompt "Describe this image."
python3 inference.py --compare             # CPU(fp32) vs NPU(fp32) 一致性

验收摘要

  • ✅ NPU 推理通过:Idefics3ForConditionalGeneration 在 npu:0(Ascend910_9362)上完整运行
  • ✅ 3/3 图文测试用例语义正确(形状 / 颜色 / 描述)
  • ✅ CPU(fp32) vs NPU(fp32) logits 余弦 cos=0.99999976,top-1 完全一致
  • ✅ 关键补丁:torch.bucketize bf16→fp32(规避 aclnnSearchSorted 161002)

交付截图

截图内容
assets/npu_device_call.pngNPU 硬件设备调用日志
assets/model_result.png模型最终适配验收结果
assets/agent_workflow.pngAgent 完整适配工作流
assets/agent_usage_1..3.pngAgent 使用过程截图