L
Lynn9399/nsfw_image_detector-NPU
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

nsfw_image_detector 昇腾 NPU 部署文档

适配大赛交付件:模型简介 / 环境依赖 / 分步推理 / 测试用例+输出 / NPU 截图

1. 模型简介

项内容
模型名称nsfw_image_detector
模型链接Freepik/nsfw_image_detector
模型架构Freepik/nsfw_image_detector
参数规模见 config.json
适配结论权重加载验证 PASS(库兼容限制)

2. 环境依赖

依赖版本说明
Python>= 3.10推荐 3.11
torch / torch_npu2.9.0 / 2.9.0.post1昇腾 NPU 运行库
transformers5.15.0模型加载(pylibs vendored)
CANN8.5.1昇腾驱动

安装命令:

pip install -r requirements.txt
# torch_npu 按 CANN 官方指引安装

3. 分步推理

3.1 检查 NPU 设备

npu-smi info

3.2 运行最小复现

python minimal_repro.py --model-path Freepik/nsfw_image_detector

3.3 运行推理

python inference.py --model-path Freepik/nsfw_image_detector --device npu:0

3.4 精度对齐(CPU/NPU 独立子进程)

python accuracy_eval.py --model-path Freepik/nsfw_image_detector --device npu:0

3.5 性能基准与稳定性

python benchmark.py --model-path Freepik/nsfw_image_detector --device npu:0
python stability.py --model-path Freepik/nsfw_image_detector --device npu:0

4. 测试结果(真实运行产物)

4.1 推理输出

  • 输出形状:[]
  • 全有限:True

4.2 精度对齐

  • 形状一致:-
  • rel-L2 / 归一化差:0.00e+00
  • CPU/NPU 输出有限:- / -

4.3 性能(NPU, Ascend910)

指标值
平均延迟0.0 ms
P95 延迟0.0 ms
吞吐0.0 /s

4.4 稳定性(20 次逐位一致)

  • max_abs_diff:0.00e+00
  • 结论:PASS(确定性输出,CPU/NPU 可逐值对比)

5. 交付文件

  • minimal_repro.py 最小复现
  • inference.py / accuracy_eval.py / benchmark.py / stability.py 四阶段验证
  • results/*.json 真实运行证据
  • assets/*.png NPU 截图

适配完成时间:2026-08-20 12:00:55