Nablaaa/ppo-Pyramids is a trained Unity ML-Agents PPO agent that plays the
Pyramids environment. The upstream model is published on Hugging Face at
https://huggingface.co/Nablaaa/ppo-Pyramids with library_name: ml-agents.
The behaviour is a pure discrete-action policy: 172 vector observations,
one discrete action branch of 5 actions, and two critic value streams
(extrinsic and rnd). This repository reconstructs the exact policy network
from the pinned ML-Agents checkpoint and executes a complete real forward on an
Ascend NPU (npu:7) using torch_npu.
The reconstructed architecture is the minimal licensed subset of the official
Unity ML-Agents PyTorch code pinned at
200fe54e14b649d6eac66a7f0779c1086c506919 (release_22) and vendored in
./mlagents_arch.
The container already provides the CANN-matched pair:
| Package | Version | Note |
|---|---|---|
torch | 2.9.0+cpu | preinstalled, must not be replaced |
torch_npu | 2.9.0 | preinstalled, must not be replaced |
| CANN | 8.5.1 | /usr/local/Ascend |
numpy | >=1.24,<2.0 | from Aliyun mirror only |
| Python | 3.11 | standard library + torch/torch_npu |
Install application dependencies only from the Aliyun pip mirror, and never
install or replace torch / torch_npu from ordinary PyPI:
pip install -i https://mirrors.aliyun.com/pypi/simple/ -r requirements.txtThe candidate uses the Python standard library, the preinstalled
torch/torch_npu, numpy (result serialization), and the bundled
mlagents_arch package. No mlagents training package is required.
The checkpoint is immutable:
| Artifact | Bytes | SHA256 |
|---|---|---|
Pyramids/Pyramids-3778906.pt | 8656252 | cb012aae9673dfb05ddc1e4fc3a565b629a8aeb01ef5f08e7b4fa897fac41805 |
Local model layout (read-only source):
/work/pipeline/models/rl26/ppo-pyramids/
├── Pyramids/Pyramids-3778906.pt # complete selected checkpoint
├── config.json # trainer/hyperparameter config
└── configuration.yaml # trainer config (YAML)Run the inference from the delivery directory on physical npu:7:
cd ppo-pyramids-npu
python3 inference.py --checkpoint /work/pipeline/models/rl26/ppo-pyramids/Pyramids/Pyramids-3778906.pt \
--batch-size 4 --hold-seconds 12Arguments:
| Argument | Default | Description |
|---|---|---|
--checkpoint | local model path | immutable .pt checkpoint |
--batch-size | 4 | number of parallel observations |
--hold-seconds | 12 | hold window for npu-smi PID correlation |
--no-npu-smi | off | skip npu-smi capture |
--result | logs/npu_result.json | output JSON path |
The forward is fail-closed: if NPU is unavailable, placement differs from
npu:7, or the strict checkpoint load fails, the process exits non-zero. There is
no CPU model forward or fallback.
Deterministic test input: a redistributable all-zero synthetic tensor of shape
[4, 172] (torch.float32) with a full-one action mask. Test-input source:
deterministic synthetic all-zero tensor (redistributable, no external data);
license: public domain / CC0-1.0.
Verified environment and contract (from the real run):
device : npu:7
hardware : Ascend910B4-1
torch : 2.9.0+cpu
torch_npu : 2.9.0
cann : 8.5.1
npu-smi : npu-smi version: 25.5.1
contract : obs_size=172 hidden_units=512 num_layers=2
discrete_branches=[5] continuous_size=0 memory_size=0
value_streams : ['extrinsic', 'rnd']
strict_load_tensors : 32 (actor=12 critic=8 rnd_pred=6 rnd_target=6)
input_device : npu:7
model_device : npu:7
output_device : npu:7Actual forward outputs (batch 4, all on npu:7):
logits_raw_branch0 : shape=[4, 5] values=[-0.502707, 0.297161, 0.623955, 0.051701, -0.777674, ...]
logits_masked_branch0 : shape=[4, 5] values=[-0.502707, 0.297161, 0.623955, 0.051701, -0.777674, ...]
action_sample : shape=[4, 1] values=[1, 3, 2, 0]
action_argmax : shape=[4, 1] values=[2, 2, 2, 2]
action_log_prob : shape=[4] values=[-1.049349, -1.376144, -1.049349, -1.049349]
entropy : shape=[4] values=[1.49365, 1.49365, 1.49365, 1.49365]
value_extrinsic : shape=[4] values=[0.448825, 0.448825, 0.448825, 0.448825]
value_rnd : shape=[4] values=[0.009599, 0.009599, 0.009599, 0.009599]
rnd_pred_encoding : shape=[4, 64]
rnd_target_encoding : shape=[4, 64]Timing and acceptance (final real run):
forward_elapsed_s : 0.096063
elapsed_total_s : 17.659
pid : 23521
npu-smi (NPU 7) : Process id:23521 python3 156 MB -> PID correlated during hold
exit_code : 0Full sanitized raw log: logs/npu_inference.log; machine-readable evidence:
logs/npu_result.json.
The inference input is an in-memory all-zero synthetic vector of shape [4, 172].
It does not use any external dataset, protected content, or user data.
Pyramids simulator, Gym, a server, or robot hardware.float64; tensors are float32.assets/agent_workflow.png — sanitized ModelAgent workflow (inspection → implementation → test → acceptance)assets/modelagent_live_session.png — detailed sanitized ModelAgent interaction and final independent acceptanceassets/npu_device_call.png — real hardware/toolchain and NPU placement/process evidenceassets/model_result.png — actual final model output, elapsed time, and success statuslogs/npu_inference.log — sanitized raw inference log (includes npu-smi PID row)logs/npu_result.json — structured result with engine, npu_available,
npu_device_name, source_revision, input/model/output devices, output
summary, timing and PIDSHA256SUMS — SHA-256 manifest of the delivery payload