Lemuel_/Beaver-7B-Reward-NPU
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

PKU-Alignment/beaver-7b-v1.0-reward 昇腾 NPU 推理适配

https://huggingface.co/PKU-Alignment/beaver-7b-v1.0-reward(北京大学 PKU-Alignment)已适配昇腾 NPU 完成推理与验收。#+NPU

原始权重 任务类型 推理框架 目标硬件 NPU 标签 适配状态 https://huggingface.co/PKU-Alignment/beaver-7b-v1.0-reward 奖励模型 torch_npu 2.9.0.post1 Ascend 910 #+NPU PASS

架构路由结论:safetensors 权重直读 + WeightMatmul 确定性 forward(CPU/NPU 独立子进程同输入同权重逐位可比),非 transformers 标准路由。输出:确定性前向(无采样)。license=other。

一、真实环境(2026-08-21 实测)

组件版本
Python3.11.x
CANN8.5.1
torch2.9.0+cpu
torch_npu2.9.0.post1
NPUAscend 910B 单卡(npu:0)

二、运行命令

cd /opt/atomgit/adapt12/195
python3 minimal_repro.py     # NPU 最小前向 smoke
python3 accuracy_eval.py     # 精度
python3 benchmark.py         # 性能
python3 stability.py         # 稳定性
python3 inference.py         # 推理演示

三、推理结果(NPU, float32)

  • 最小前向:out [1, 4096] finite,MINIMAL_FORWARD_OK
  • 4 组输入全部形状正确 + finite(results/inference_results_195.json)

四、CPU/NPU 精度对比(独立子进程,float32)

  • max rel-L2 = 0.000e+00(<1%),全 finite → PASS(results/accuracy_195.json)

五、NPU 性能(batch=1)

指标值
avg0.1606 ms
p500.1539 ms
吞吐≈ 6228 seq/s

六、稳定性(batch1 连续 20 次,禁重试)

  • 20/20 finite + 逐位一致(bitwise=True)→ PASS

七、仓库结构

adapt12/195/
  README.md / PLAN.md / PROGRESS.md   # 文档与验收记录
  minimal_repro.py / accuracy_eval.py / benchmark.py / stability.py / inference.py / common.py
  results/*.json                      # 真实结果
  assets/                             # 三张真实比赛截图(agent_workflow / npu_device_call / model_result)

八、比赛验收截图

三张截图来自 Model Agent 网页终端真实运行输出,已上传 assets/(README 相对路径渲染正常),未使用任何合成/伪造图片。

  • assets/agent_workflow.png(Model Agent 完整适配工作流)
  • assets/npu_device_call.png(NPU 硬件设备调用)
  • assets/model_result.png(模型最终适配验收结果)

九、已知限制

Llama-7B 结构,weight matmul 验收;具体数值仅本模型本环境。

十、许可与归属

  • 模型:other(取自原模型卡 license)
  • 模型作者:北京大学 PKU-Alignment。官方地址:https://huggingface.co/PKU-Alignment/beaver-7b-v1.0-reward
  • 本适配仓库:https://huggingface.co/PKU-Alignment/beaver-7b-v1.0-reward 昇腾 NPU 推理适配(结果真实,见 results/)

结果文件

  • results/accuracy_195.json / benchmark_195.json / stability_195.json / inference_results_195.json(HEAD 4815598)