cd MoonViT-SO-400M-ascend && python inference.py --precision_test 2>&1 | tee test.log
推理测试
cd MoonViT-SO-400M-ascend && python inference.py 2>&1 | tee test.log
参数说明
参数
说明
默认值
--model_path
模型路径
MoonViT-SO-400M
--device
运行设备
npu:0
--precision_test
运行精度测试
False
精度测试结果
============================================================
Precision Comparison: CPU vs NPU
============================================================
Max errors: sum=9.77e-04, mean=2.38e-07, std=2.38e-07
PASS: NPU precision within thresholds
============================================================
PRECISION TEST PASSED
============================================================
指标
阈值
实测值
状态
max_error_sum
< 1e-3
9.77e-04
✅ PASS
max_error_mean
< 1e-5
2.38e-07
✅ PASS
max_error_std
< 1e-5
2.38e-07
✅ PASS
输出示例
2026-05-17 14:28:00,106 - INFO - MoonViT-SO-400M Ascend NPU Inference
2026-05-17 14:28:06,631 - INFO - Model loaded and moved to npu:0!
2026-05-17 14:28:06,790 - INFO - Using random input tensor (1, 3, 896, 896)...
2026-05-17 14:28:06,859 - INFO - Input shape: torch.Size([1, 3, 896, 896])
2026-05-17 14:28:06,859 - INFO - Running inference...
2026-05-17 14:28:13,185 - INFO - Features shape: torch.Size([1, 4096, 1152])
2026-05-17 14:28:13,185 - INFO - Inference time: 6325.49 ms
2026-05-17 14:28:13,642 - INFO - Features (first 10): [-0.5310895 -0.23822491 ...]
2026-05-17 14:28:13,642 - INFO - Inference completed successfully!