cv_vitb16_classification_vision-efficient-tuning-adapter on Ascend NPU
1. 简介
本文档记录 cv_vitb16_classification_vision-efficient-tuning-adapter 在昇腾 NPU 上的适配验证结果。
- 模型来源: iic/cv_vitb16_classification_vision-efficient-tuning-adapter
- 架构: ViT-Base (patch16, 224) + Adapter (PETL, adapter_length=10)
- 参数量: ~86M (backbone) + adapter parameters
- 任务: Image Classification (图像分类, 100类)
- 适配状态: SUCCESS
- 适配时间: 2026-05-17
2. 验证环境
| 组件 | 版本 |
|---|
torch | 2.9.0 |
torch-npu | 2.9.0.post1 |
timm | 1.0.27 |
CANN | 8.5.1 |
- NPU: Ascend 910B4
- 系统: Linux aarch64
3. 推理脚本
python inference.py --device npu:0 --dtype float32
4. 推理输出证据
模型: cv_vitb16_classification_vision-efficient-tuning-adapter
设备: npu:0
精度: float32
--- CPU 推理 ---
输出形状: [1, 100]
Logits 前5个: [-0.4165, -2.0099, 1.7495, -0.4107, -0.0241]
是否有 NaN: False
预测类别: 10
--- NPU 推理 (npu:0) ---
输出形状: [1, 100]
Logits 前5个: [-0.4113, -2.0077, 1.7452, -0.4151, -0.0259]
是否有 NaN: False
预测类别: 10
5. 性能参考
6. CPU vs NPU 精度对比
| 指标 | 数值 |
|---|
| Cosine Similarity | 0.999992 |
| Max Abs Error | 0.013165 |
| 精度误差 | 0.0008% |
| 是否满足要求 | 是(< 1%) |
7. 评测材料
| 材料 | 文件 | 说明 |
|---|
| 推理脚本 | inference.py | 独立可运行的 NPU 推理代码 |
8. 注意事项
- 使用 timm 的 ViT-Base 模型 + 手动加载 Adapter 层
- Adapter 为瓶颈结构: down-project (768→10) → GELU → up-project (10→768)
- 权重格式:
backbone_weight 和 head_weight 分开存储于 pytorch_model.pt
- 输入: 随机 224x224 RGB 图像
- 输出: 100 类分类 logits
贡献者: xujiashuai
参赛赛道: 模型适配赛道
提交时间: 2026-05-17