ppo-Huggy is a trained PPO reinforcement-learning agent playing the
Huggy dog-fetch environment, trained with the
Unity ML-Agents Library.
This repository is a real Ascend NPU inference candidate for the pinned
upstream model. It does not launch Unity or any simulator; it reconstructs
the exact trained policy (actor) and value network (critic) from the immutable
PyTorch checkpoint, runs a deterministic forward wholly on physical npu:6
using torch_npu, and records full placement/identity/version evidence.
中文摘要:本项目将
PaulVialard/ppo-Huggy(Unity ML-Agents PPO 策略)在华为昇腾 NPUnpu:6上做真实推理。不启动 Unity 仿真,直接从固定版本 checkpoint 重建 actor/critic 网络,使用torch_npu在 NPU 上完成确定性前向,输出动作均值/标准差/动作/价值/熵/对数概率, 并记录设备、版本、PID 与npu-smi进程占用证据。
| Field | Value |
|---|---|
| Model ID | PaulVialard/ppo-Huggy |
| Pinned source revision | 1fd517574882e4b765aa24a2b078d91fa1ab9072 |
| Pinned code revision (ml-agents) | 200fe54e14b649d6eac66a7f0779c1086c506919 (2024-10-05) |
| Selected artifact | Huggy/Huggy-2000049.pt |
| Artifact size / SHA256 | 13,509,473 bytes / 97b6c7cebbad4fdd5c28d92a12518cb84f18112b723e8e56ee7f878781382ef2 |
| Library | ml-agents |
| Pipeline tag | reinforcement-learning |
| Route | Unity ML-Agents PPO PyTorch policy checkpoint |
This delivery repository (inference.py, the vendored architecture
mlagents_net.py, run_npu.sh, README.md) is distributed under the
Apache License 2.0; the full Apache-2.0 text is shipped as LICENSE.
The upstream model weights (PaulVialard/ppo-Huggy) do not declare a
model license (no license field in the upstream model card and no LICENSE
file in the pinned model repo). No license is asserted for the model weights
themselves; the apache-2.0 value in this card's front matter applies to this
delivery repository's own code, not to the upstream weights.
The contract is read directly from the checkpoint metadata and state dict (no guessing):
| Contract | Value | Evidence |
|---|---|---|
| Observation | single vector, shape (59,), float32 | running_mean buffer shape (59,); first Linear (512, 59) |
| Action | continuous, size 21, discrete [] | continuous_act_size_vector = [21], discrete_act_size_vector = [] |
| Normalization | true (running-mean/var + clamp [-5, 5]) | network_settings.normalize: true, Normalizer buffers |
| Hidden units / layers | 512 / 3 | network_settings.hidden_units, num_layers; seq_layers.{0,2,4} |
| Critic | ValueNetwork with one extrinsic head | Optimizer:critic state dict |
| Export version | 3 (MLAgents2_0) | version_number = [3.] |
ppo-huggy-npu/
├── inference.py # NPU inference entry point (fail-nonzero, no CPU fallback)
├── mlagents_net.py # minimal vendored ml-agents architecture (Apache-2.0)
├── requirements.txt # runtime requirements (non-torch, Aliyun mirror)
├── run_npu.sh # runner: launches inference, captures npu-smi PID evidence
├── LICENSE # Apache-2.0 (vendored ml-agents code + delivery code)
├── README.md # this file (byte-identical to readme.md)
├── readme.md # byte-identical copy for case-sensitive platforms
├── SHA256SUMS # SHA-256 manifest of the published file set
├── assets/
│ ├── agent_workflow.png # real reviewer-session workflow
│ ├── npu_device_call.png # real NPU device/PID evidence
│ ├── model_result.png # real model result output
│ └── modelagent_live_session.png # real ModelAgent live-session transcript
└── logs/
├── npu_inference.log # sanitized raw inference log
└── npu_result.json # structured result (engine/exit/devices/versions/...)| Component | Version | Note |
|---|---|---|
| OS | Linux (aarch64/x86_64) | container image |
| CANN | 8.5.1 | ASCEND_HOME_PATH=/usr/local/Ascend/cann-8.5.1 |
| Driver / npu-smi | 25.5.1 | npu-smi info |
| Python | 3.11.14 | /usr/local/python3.11.14/bin/python3 |
| torch | 2.9.0+cpu | CANN-matched, provided by the image |
| torch_npu | 2.9.0 | CANN-matched, provided by the image |
| numpy | >=1.24,<2 | installed from the Aliyun mirror |
| NPU | Ascend 910B4-1 (npu:6) | physical device used for the forward |
Important:
torchandtorch_npuare provided by the container and are CANN-matched. They must never be replaced with ordinary PyPI wheels.
Only the non-torch dependency numpy is installed from PyPI, always through the
Aliyun mirror. Do not install or upgrade torch / torch_npu / ml-agents.
# 1) Load the CANN runtime (idempotent)
source /usr/local/Ascend/ascend-toolkit/set_env.sh
# 2) Pin the Aliyun PyPI mirror
export PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/
# 3) Install the runtime requirements (numpy only; torch/torch_npu stay as-is)
cd /root/ascend-model-pipeline/jobs/rl26/ppo-huggy/ppo-huggy-npu
pip install -r requirements.txtEquivalent one-liner: pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
Load the CANN environment (torch_npu requires it):
source /usr/local/Ascend/ascend-toolkit/set_env.shCheck the physical NPU:
npu-smi infoRun the inference on npu:6 — either the runner (recommended, it also
captures the live npu-smi process line for the exact Python PID):
cd /root/ascend-model-pipeline/jobs/rl26/ppo-huggy/ppo-huggy-npu
bash run_npu.sh npu:6 30or the direct command:
cd /root/ascend-model-pipeline/jobs/rl26/ppo-huggy/ppo-huggy-npu
python3 inference.py --device npu:6 --hold-seconds 30Inspect the outputs:
cat logs/npu_inference.log # sanitized raw log
cat logs/npu_result.json # structured result JSONThe script fails non-zero on any NPU initialization/placement/execution error; there is no CPU fallback.
Command (run on 2026-08-22, physical npu:6):
cd /root/ascend-model-pipeline/jobs/rl26/ppo-huggy/ppo-huggy-npu
bash run_npu.sh npu:6 30Runner output (real):
script-reported python PID=16504
=== npu-smi captured at poll 1 ===
| NPU Chip | Process id | Process name | Process memory(MB) |
| 6 0 | 16504 | python3 | 146 |
=== runner: exit_code=0 FOUND=1 ===
--- tail of logs/npu_inference.log ---
[result] log_prob (mean action, sum over dims) = -18.935270
[time] npu forward elapsed (synchronized) = 0.096127 s
[npu-smi] pid_placement_evidence={"captured": true, "line": "| 6 0 | 16504 | python3 | 146 |"}
[done] exit_code=0 total_wall=34.087slogs/npu_inference.log (real, sanitized):
==============================================================================
[ppo-huggy-npu] Ascend NPU inference candidate for PaulVialard/ppo-Huggy
[ppo-huggy-npu] model revision : 1fd517574882e4b765aa24a2b078d91fa1ab9072
[ppo-huggy-npu] code revision : 200fe54e14b649d6eac66a7f0779c1086c506919
[ppo-huggy-npu] PID : 16504
[ppo-huggy-npu] device : npu:6
[ppo-huggy-npu] torch : 2.9.0+cpu
[ppo-huggy-npu] torch_npu : 2.9.0
==============================================================================
[hash] sha256=97b6c7cebbad4fdd5c28d92a12518cb84f18112b723e8e56ee7f878781382ef2 bytes=13509473 (0.012s)
[model] actor loaded tensors=21 params=566826
[model] critic loaded tensors=14 params=556545
[model] actor param device sample: npu:6
[model] critic param device sample: npu:6
[input] obs device=npu:6 shape=(1, 59) dtype=torch.float32
[output] mu device=npu:6 shape=(1, 21) dtype=torch.float32
[output] std device=npu:6 shape=(1, 21) dtype=torch.float32
[output] action device=npu:6 shape=(1, 21) dtype=torch.float32
[output] value device=npu:6 shape=(1,) dtype=torch.float32
[output] entropy device=npu:6 shape=(1, 1) dtype=torch.float32
[output] log_prob device=npu:6 shape=(1, 1) dtype=torch.float32
[result] action mean (mu): min=-1.271459 max=3.853186 mean=0.173955 std=1.109177
[result] mu[:6] = -0.808653 -0.160908 0.299810 1.349677 -0.424557 0.859595
[result] std[:6] = 0.971764 0.978513 1.002848 0.997494 0.996390 0.871906
[result] deterministic action[:6] (clip(mu,-3,3)/3) = -0.269551 -0.053636 0.099937 0.449892 -0.141519 0.286532
[result] value (extrinsic) mean = 3.029799
[result] entropy mean = 1.401680
[result] log_prob (mean action, sum over dims) = -18.935270
[time] npu forward elapsed (synchronized) = 0.096127 s
[log] wrote /work/pipeline/jobs/rl26/ppo-huggy/ppo-huggy-npu/logs/npu_result.json
[npu-smi] pid_placement_evidence={"captured": true, "line": "| 6 0 | 16504 | python3 | 146 |"}
[hold] holding 30.0s after real forward for npu-smi correlation (pid=16504); run: npu-smi info | grep 16504
[done] exit_code=0 total_wall=34.087sThe inferred entropy (1.401680) reproduces the training-time
Huggy.Policy.Entropy.mean recorded in the upstream run_logs/timers.json
(1.401683) to ~5 decimal places, confirming the reconstructed network is the
real trained policy.
logs/npu_result.json exposes the following top-level fields (hard acceptance
contract), plus full nested detail:
{
"model_id": "PaulVialard/ppo-Huggy",
"engine": "torch_npu",
"exit_code": 0,
"npu_available": true,
"npu_device_name": "Ascend910B4-1",
"source_revision": "1fd517574882e4b765aa24a2b078d91fa1ab9072",
"input_device": "npu:6",
"model_device": "npu:6",
"output_device": "npu:6"
}It also preserves meaningful task-specific output (mu, std,
deterministic_action, value, entropy, log_prob), shapes, synchronized
forward timing, PID, and package versions (torch, torch_npu, cann,
python, npu_smi), plus the live pid_placement_evidence captured by
npu-smi while the inference PID held the NPU.
Screenshots are rendered only from the real final transcript/log/result of this delivery — no values are fabricated or edited in.
| Image | What it shows |
|---|---|
assets/agent_workflow.png | The real reviewer-session workflow (ModelAgent turn transcript: read → audit → fix → validate). |
assets/npu_device_call.png | Real NPU device call evidence: npu:6, torch/torch_npu versions, and the live npu-smi process line for the inference PID. |
assets/model_result.png | Real model result output: mu/std/action/value/entropy/log-prob from logs/npu_inference.log and logs/npu_result.json. |
assets/modelagent_live_session.png | Real ModelAgent live-session transcript excerpt of this bounded review session. |
npu:6; the script is not a
distributed/multi-NPU runner.zero observations, eval() mode and
no sampling. Sampled (stochastic) actions are intentionally not drawn.Huggy/Huggy-2000049.pt artifact is
supported; other .pt/.onnx snapshots in the upstream repo are not part of
this candidate.Unity-Technologies/ml-agents revision 200fe54e14b649d6eac66a7f0779c1086c506919