Real Ascend NPU inference adaptation for the pinned local model
graceesthi/ug-cppo-finai-2025.
8be042ec04ee8811d3bc4e6a69372e61f34a72d5
(git commit 8be042e "Upload paper (PAT-corrected v3)").ug_cppo_seed47.zip — 270607 bytes,
SHA256
13be9637a0424f6dbea8b258691f1e771f938c923fd1ac806f83c5a26d90d823.mit (as declared in the upstream model card — not guessed).stable-baselines3 · pipeline_tag:
reinforcement-learning · task: reinforcement-learning-policy.The policy is a standard Stable-Baselines3 ActorCriticPolicy (obs dim 81,
action dim 10, hidden [64, 64], diagonal-Gaussian log_std, no SDE). The
deterministic test feeds a zero observation through the real loaded policy on
physical npu:7 and emits action, value, log_prob.
ascend, npu, torch_npu, hardware: NPU. Engine: torch_npu on
physical npu:7 (Ascend910B4-1).
Captured from the final logs/npu_result.json:
| Package / tool | Version |
|---|---|
| OS | Linux 5.10.0-325.0.0.226.oe2203sp4.aarch64 |
| Python | 3.11.14 (CPython) |
| torch | 2.9.0+cpu (image-provided, never replaced) |
| torch_npu | 2.9.0 (image-provided, never replaced) |
| numpy | 2.3.4 |
| cloudpickle | 3.1.2 |
| gymnasium | 1.2.0 |
| stable-baselines3 | 2.8.0 |
| CANN | 8.5.1 |
| npu-smi (driver) | 25.5.1 |
| NPU device | Ascend910B4-1 |
torch and torch_npu are the container's CANN-matched pair. They MUST NOT be
replaced by ordinary PyPI wheels. All other non-torch dependencies are installed
exclusively through the Aliyun PyPI mirror.
cd /root/ascend-model-pipeline/jobs/rl26/ug-cppo-finai-2025/ug-cppo-finai-2025-npu
# 1. Create a runtime outside the publishable delivery tree. It reuses the
# image's system torch/torch_npu pair.
export UG_CPPO_RUNTIME_VENV=/work/pipeline/runtime/venvs-rl26/ug-cppo-finai-2025
python3 -m venv --system-site-packages "$UG_CPPO_RUNTIME_VENV"
# 2. Install only the necessary non-torch dependencies via the Aliyun mirror.
export PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/
"$UG_CPPO_RUNTIME_VENV/bin/pip" install --no-cache-dir -i https://mirrors.aliyun.com/pypi/simple/ 'numpy==2.3.4'
"$UG_CPPO_RUNTIME_VENV/bin/pip" install --no-cache-dir --no-deps -i https://mirrors.aliyun.com/pypi/simple/ 'stable-baselines3==2.8.0'
# (requirements.txt is the equivalent record; see below.)
"$UG_CPPO_RUNTIME_VENV/bin/pip" install --no-cache-dir -i https://mirrors.aliyun.com/pypi/simple/ -r requirements.txtrequirements.txt:
numpy==2.3.4
stable-baselines3==2.8.0numpy==2.3.4 reproduces the checkpoint's own numpy 2.x environment, and
stable-baselines3==2.8.0 matches the checkpoint serialization
(_stable_baselines3_version = 2.8.0, JSON data format).
# 1. Activate the CANN environment (best-effort; already configured on the image).
source /usr/local/Ascend/ascend-toolkit/set_env.sh
# 2. Confirm the physical device is visible.
npu-smi info
# 3. Point to the selected immutable source checkpoint outside this delivery.
export UG_CPPO_CKPT=/work/pipeline/models/rl26/ug-cppo-finai-2025/ug_cppo_seed47.zip
ls -l "$UG_CPPO_CKPT"
sha256sum "$UG_CPPO_CKPT"
# expected: 13be9637a0424f6dbea8b258691f1e771f938c923fd1ac806f83c5a26d90d823
# 4. Run the real deterministic NPU inference (this is the one test command).
bash run_npu.sh
# 5. Inspect the produced evidence.
cat logs/npu_inference.log
cat logs/npu_result.json
cat logs/npu_smi_snapshot.txtrun_npu.sh uses the external runtime and pinned source checkpoint, launches
inference.py on physical npu:7, waits for the
[NPU_READY] marker, captures an npu-smi snapshot for the live PID, then waits
for completion. Set NPU_HOLD_SECONDS to change the hold window (default 8 s).
Command:
cd /root/ascend-model-pipeline/jobs/rl26/ug-cppo-finai-2025/ug-cppo-finai-2025-npu
bash run_npu.shRunner transcript:
[RUNNER] launching: /work/pipeline/runtime/venvs-rl26/ug-cppo-finai-2025/bin/python inference.py --ckpt /work/pipeline/models/rl26/ug-cppo-finai-2025/ug_cppo_seed47.zip
[RUNNER] python pid=3312749
[RUNNER] ready marker detected; capturing npu-smi snapshot
[RUNNER] exit_code=0logs/npu_inference.log:
[INFO] device=npu:7 current=7 name=Ascend910B4-1
[INFO] checkpoint ug_cppo_seed47.zip verified bytes=270607 sha256=13be9637a0424f6d...
[INFO] policy on npu:7 ok, params=19541 buffers_checked=0
[INFO] obs_space=Box(-inf, inf, (81,), float32) act_space=Box(-1.0, 1.0, (10,), float32) obs_dim=81 act_dim=10
[NPU_READY] pid=3312749 device=npu:7 ready_at=1787387255.408577 marker=/work/pipeline/jobs/rl26/ug-cppo-finai-2025/ug-cppo-finai-2025-npu/logs/npu_ready.marker
[NPU_HOLD] holding 8.0s for external npu-smi correlation
[RESULT] action=[[-0.3171851336956024, -0.6704590320587158, -0.21038641035556793, 0.5674934983253479, 0.6816909909248352, 0.6051729321479797, 0.012787358835339546, -0.35191959142684937, -0.818838357925415, -0.7145680785179138]]
[RESULT] value=[[0.001923096482641995]]
[RESULT] log_prob=[-15.180788040161133]
[RESULT] mean_abs_action=0.495050 std=[1.7112782001495361, 2.2721967697143555, 1.6971241235733032, 1.9133570194244385, 1.305491328239441, 2.009915351867676, 2.6645281314849854, 1.5622222423553467, 1.821391224861145, 1.5923500061035156]
[RESULT] forward_elapsed_s=0.084724 pid=3312749 exit_code=0
[DONE] result_json=/work/pipeline/jobs/rl26/ug-cppo-finai-2025/ug-cppo-finai-2025-npu/logs/npu_result.jsonlogs/npu_result.json (top-level contract):
{
"status": "ok",
"engine": "torch_npu",
"exit_code": 0,
"npu_available": true,
"npu_device_name": "Ascend910B4-1",
"source_revision": "8be042ec04ee8811d3bc4e6a69372e61f34a72d5",
"input_device": "npu:7",
"model_device": "npu:7",
"output_device": "npu:7",
"pid": 3312749
}Physical npu-smi process correlation (logs/npu_smi_snapshot.txt):
| 7 0 | 3312749 | python | 116 |
Process id:3312749 Process name:python Process memory(MB):116The exact live Python PID 3312749 appears on physical NPU 7 (116 MB HBM).
action — [1, 10] deterministic policy mean (clipped to the action Box).value — [1, 1] value-function estimate.log_prob — [1] log-probability of the deterministic action.policy_std — [10] per-dimension diagonal-Gaussian std (exp(log_std)).q — null (PPO has no Q-function; not applicable).Evidence images rendered from the real final logs/result:
assets/agent_workflow.png — ModelAgent pipeline
steps with the real commands used.assets/npu_device_call.png — device call and
placement evidence on npu:7 (log + npu-smi process line).assets/model_result.png — meaningful model output
(action/value/log_prob) from the real log and result JSON.assets/modelagent_live_session.png —
live runner session, ready marker, and physical NPU process correlation.q: null.npu:7. There is no CPU forward and no CPU offload/fallback.deterministic=True; output is reproducible from the pinned
immutable checkpoint.logs/npu_result.json and verified at every run).