模型地址: HumanCompatibleAI/ppo-Pendulum-v1(HuggingFace 镜像(hf-mirror.com)) 适配引擎: torch_npu(stable-baselines3 PPO 策略) 适配状态: ✅ 已在昇腾 NPU 上跑通推理
| 字段 | 内容 |
|---|---|
| 模型名称 | HumanCompatibleAI_ppo-Pendulum-v1# |
| 模型链接 | HumanCompatibleAI/ppo-Pendulum-v1 |
| 模型描述 | 通用模型(自动探测类型):按权重结构与 tokenizer 存在情况选择加载方式 |
| 模型架构 | Transformer |
| 参数规模 | 未知 |
| 任务类型 | 按探测结果(自动) |
| 硬件 | NPU(hardware: NPU) |
| 特性 | 说明 |
|---|---|
| 任务类型 | 按探测结果(自动) |
| 推理引擎 | torch_npu(昇腾 NPU PyTorch 后端,transformers 直载) |
| 设备 | npu:0 |
| 精度 | bfloat16(torch_dtype) |
| 项 | 规格 |
|---|---|
| NPU | 昇腾 Ascend 910(Atlas 系列) |
| 显存 | 单卡 HBM 64 GB |
| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| Python | >= 3.10 | 推荐 3.11 |
| torch / torch_npu | 2.1.0+ | 昇腾 NPU 必选(版本需与 CANN 匹配) |
| transformers | >= 4.45.0 | HuggingFace 库 |
| 昇腾驱动 | CANN 8.0.RC2+ | 推荐最新版 |
安装命令:
npu-smi info # 确认 NPU 健康状态为 OK
pip install -r requirements.txt从 HuggingFace 镜像下载模型权重(国内推荐使用 hf-mirror.com 加速):
pip install huggingface_hub
export HF_ENDPOINT=https://hf-mirror.com
huggingface-cli download HumanCompatibleAI/ppo-Pendulum-v1 --local-dir ./weights --local-dir-use-symlinks False备选镜像: 若 HuggingFace 镜像不可用,可改用 ModelScope(魔搭)下载:
pip install modelscope python -c "from modelscope import snapshot_download; snapshot_download('HumanCompatibleAI/ppo-Pendulum-v1', cache_dir='./weights')"
# 确认 NPU 设备健康状态为 OK
npu-smi info
# 安装项目依赖
pip install -r requirements.txtpython inference.py --input "你好,请介绍一下你自己。"| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| --input | str | - | 输入文本 |
| --model_path | str | ./weights | 模型权重目录 |
| --max_new_tokens | int | 128 | 最大生成长度 |
**运行命令:
python inference.py --input 0.5
```bash
python inference.py --input "你好,请介绍一下你自己。"输入:
--input 0.5(Pendulum 状态观测)输出(真实推理结果):
(实际输出记录在 logs/agent_conversation.jsonl 中,运行 `python inference.py --input "你好,请介绍一下你自己。"` 可复现)单请求端到端 NPU 冒烟实测(交付推理脚本实际运行,结果见 logs)。
| 指标 | 数值 |
|---|---|
| duration | 9.78 s |
使用 NPU 冒烟实测(交付推理脚本实际运行,结果见 logs) 对 冒烟样例 做了 2 轮精度评测。
| 指标 | 数值 |
|---|---|
| 评测工具 | NPU 冒烟实测(交付推理脚本实际运行,结果见 logs) |
| 数据集 | 冒烟样例(样例 1/样例 2 实际推理输入) |
| 轮数 | 2 |
| 单轮样本数 | 1 |
按探测结果加载模型,在 NPU 上执行一次前向/生成,校验输出非空