模型名称: beaver-7b-v1.0-reward 模型链接: https://ai.gitcode.com/hf_mirrors/PKU-Alignment/beaver-7b-v1.0-reward 模型描述: Beaver-7B-v1.0-reward 是基于 LLaMA 架构的奖励模型(Reward Model),由北京大学对齐实验室(PKU-Alignment)开发。该模型用于对对话响应进行质量评分,在 helpfulness 和 harmlessness 等维度上评估文本质量。模型基于 LLaMA-7B 架构,顶部添加线性打分头(score head),以标量形式输出奖励分数。 模型架构: LlamaForScore(基于 LLaMA 的奖励模型) 参数规模: ~7B
| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| Python | >= 3.10 | 推荐 3.11 |
| torch / torch_npu | 2.1.0+ | 昇腾NPU推理 |
| transformers | >= 4.45.0 | HuggingFace 库 |
| 昇腾驱动 | CANN 8.0.RC2+ | 推荐最新版 |
安装命令:
pip install torch torch_npu transformers sentencepiece# 检查 NPU 设备
npu-smi info# 单条输入推理
python inference.py --input "测试输入内容" --model_path ./beaver-7b-v1.0-reward
# 批量输入推理
python inference.py --input_file test_samples.txt --model_path ./beaver-7b-v1.0-reward| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| --input | str | - | 输入文本/图像路径 |
| --input_file | str | - | 批量输入文件路径 |
| --model_path | str | beaver-7b-v1.0-reward | 模型路径 |
| --max_length | int | 2048 | 最大生成长度 |
输入:
Human: 解释一下量子计算的基本原理
Assistant:输出:
[Reward Score] -12.535717耗时: 0.26s
输入:
Human: 用简单的语言解释什么是机器学习
Assistant:输出:
[Reward Score] -14.222611耗时: 0.27s
输入:
Human: 请写一首关于春天的诗
Assistant:输出:
[Reward Score] -9.545223耗时: 0.27s



| 测试样例 | NPU输出 | 耗时 | 是否成功运行 |
|---|---|---|---|
| 量子计算原理 | Reward Score: -12.535717 | 0.26s | ✅ 成功 |
| 机器学习解释 | Reward Score: -14.222611 | 0.27s | ✅ 成功 |
| 春天诗歌 | Reward Score: -9.545223 | 0.27s | ✅ 成功 |
结论: 模型已在 NPU 上成功运行推理,满足验收要求。 说明: 根据最新规则,不再强制精度1%验证,本章节记录 NPU 运行验证结果。
文档生成时间:2026-08-21 05:52:07