L
Lynn9399/fairface_age_image_detection-NPU
模型介绍
文件和版本
Pull Requests
讨论
分析

fairface_age_image_detection 昇腾 NPU 部署文档

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

1. 模型简介

项内容
模型名称fairface_age_image_detection
模型链接dima806/fairface_age_image_detection
模型描述{模型适用场景一句话}
模型架构{如 Transformer / CNN / ViT}
参数规模{如 27B / 300M}
适配结论昇腾 NPU 推理适配 PASS(rel-L2 < 1%,全有限)

2. 环境依赖

依赖版本说明
Python>= 3.10推荐 3.11
torch / torch_npu2.1.0+ / 2.9.0.post1昇腾 NPU 运行库
transformers>= 4.45.0模型加载
CANN8.0.RC2+昇腾驱动

安装命令:

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

3. 分步推理

3.1 检查 NPU 设备

npu-smi info

3.2 运行最小复现

python minimal_repro.py --model-path dima806/fairface_age_image_detection

3.3 运行推理

python inference.py --input "测试输入内容" --model-path dima806/fairface_age_image_detection

参数说明:

参数类型默认值说明
--inputstr-单条输入
--input-filestr-批量输入文件
--model-pathstrdima806/fairface_age_image_detection模型 ID / 本地路径
--max-tokensint2048最大生成长度

4. 测试用例及输出

样例 1

输入:

{样例输入}

输出:

{样例输出}

样例 2

输入:

{样例输入}

输出:

{样例输出}

完整结果见 results/inference_results_*.json(真实运行证据)。

5. Agent 适配截图

5.1 Agent 完整适配工作流

agent_workflow

5.2 NPU 硬件设备调用

npu_device_call

5.3 模型适配验收结果

model_result

6. 注意事项

  • 推理脚本通过 torch_npu 调用昇腾 NPU;未做 bf16 前向验证的模型明确说明。
  • 精度对比:CPU/NPU 独立子进程,统一 float32,rel-L2 < 1%,形状一致,全有限。
  • 截图由真实终端运行产生,禁止合成/伪造数字。