timm/convnext_tiny.in12k_ft_in1kConvNeXt-Tiny
vision-encoder / unknown → 实际为图像分类 (image-classification), 使用 logits + Top-5 一致性验收timm create_model("convnext_tiny") + safetensors.torch.load_file, 本地权重加载 (snapshot_download 缓存), trust_remote_code=False (无自定义代码)| 项 | 值 |
|---|---|
| NPU | Ascend910_9362 (npu-smi 25.5.5, CANN 8.5.1) |
| 设备 | npu:0 (PhyID 6, Bus 0000:0B:00.0), 64GB HBM, 2 devices |
| torch | 2.9.0+cpu |
| torch_npu | 2.9.0.post1+gitee7ba04 |
| torch.npu.is_available() | True |
| timm | 1.0.22 |
| huggingface_hub | 0.36.2 |
| safetensors | 0.6.2 |
| Pillow | 11.x |
| Python | 3.11.14 |
| 验证日期 | 2026-08-21 UTC |
| 输入 | 合成 PIL 256x256 灰底+红/绿矩形, timm resolve_data_config + create_transform (Resize 235 bicubic, CenterCrop 224, Normalize), 224x224x3, batch 1 |
| dtype | float32 (FP32) |
| batch | 1 |
环境检查命令:
npu-smi info
python -c "import torch; import torch_npu; print(torch.npu.is_available()); print(torch.npu.get_device_name(0))"
python .opencode/skills/npu-adapt-skills/scripts/check_npu.py --output env_check.jsonpip install -r requirements.txt系统已配置 HF_ENDPOINT=https://hf-mirror.com 与代理,无需手动设置。
模型下载(首次):
python -c "from huggingface_hub import snapshot_download; print(snapshot_download(repo_id='timm/convnext_tiny.in12k_ft_in1k'))"默认命令(npu:0 真实推理,3 次 warmup + 10 次计时,含 CPU-NPU 一致性检查):
python inference.py其他模式:
python inference.py --mode validate
python inference.py --device cpuinference.py 默认打印: 模型名/任务/后端/device/dtype/输入摘要/真实 logits 与 Top-5(含概率)/分位延迟/吞吐/显存/一致性 diff 与最终 PASS/FAIL。
Model: timm/convnext_tiny.in12k_ft_in1k
Model weight URL: https://huggingface.co/timm/convnext_tiny.in12k_ft_in1k
Task: ImageNet 图像分类 (ConvNeXt-Tiny, 1000 classes)
Architecture: ConvNeXt-Tiny depths [3,3,9,3] dims [96,192,384,768] ~28.59M params
torch.npu.is_available(): True, device_name: Ascend910_9362, device_count: 2
Loaded .../model.safetensors (114.4 MB)
Model loaded in 1.42s, params: 28.59M
Model moved to npu:0, first param device: npu:0, dtype: torch.float32
Preprocessed pixel_values shape: (1, 3, 224, 224), dtype: torch.float32, range: [-2.118, 2.429]
Iter 1: logits[:5]=[-0.778, 0.520, -0.731, 0.455, 0.874] Top-5 ids: [549, 530, 409, 892, 921] latency=6.8ms
Latency avg=6.8ms min=6.7ms max=7.0ms throughput 147.06 images/s
CPU logits[:5]: [-0.780, 0.526, -0.728, 0.453, 0.863] NPU logits[:5]: [-0.778, 0.520, -0.731, 0.455, 0.874]
Max abs diff: 0.035826, Top-1 match True, Top-5 set match True
[PASS] CPU-NPU consistency
FINAL: PASS - NPU inference successful| 检查 | 结果 |
|---|---|
| CPU logits[:5] | [-0.780, 0.526, -0.728, 0.453, 0.863] |
| NPU logits[:5] | [-0.778, 0.520, -0.731, 0.455, 0.874] |
| Max abs diff | 0.035826 |
| CPU Top-5 | [549,530,892,409,921] |
| NPU Top-5 | [549,530,409,892,921] |
| Top-1 | True |
| Top-5 set | True |
| 判定 | PASS |
| 指标 | npu:0 | cpu |
|---|---|---|
| avg | 6.8 ms | 180.7 ms |
| throughput | 147 images/s | 5.5 images/s |
| 加速比 | 26.6x | — |
assets/agent_workflow.pngassets/npu_device_call.pngassets/model_result.png

Hardware: NPU, NPU, Ascend, Ascend910, vision, image-classification, convnext