gcw_6a3w2yXz/ppo-Pyramids-NPU
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

Nablaaa/ppo-Pyramids — Ascend NPU Adaptation

Model: Nablaaa/ppo-Pyramids (Pyramids PPO, Unity ML-Agents) Revision: main — checkpoint Pyramids/Pyramids-3000009.pt (3000009 steps, discrete action 5) Route: offline-rl (ppo-discrete) — obs→action discrete policy, adapted from robotics offline-rl contract Device: npu:0 (Ascend910_9362) with CPU fallback validation

Task

Pyramids (ML-Agents) is a strategy board environment. The policy maps a 172-dim vector observation to 5 discrete actions (single branch). Network: Linear 172→512 → Swish (x*sigmoid) → Linear 512→512 → Swish → Linear 512→5 → logits → argmax.

Observations & Action Contract

  • Input: obs shape [batch, 172], dtype float32, vector observation (no vision tower), range approx [-1,1] stochastic synthetic for validation (seed 0). No normalization (normalize: false in configuration.yaml).
  • Output: logits shape [batch, 5], dtype float32, probs=softmax(logits), action=argmax(logits) integer in [0,4].
  • Sampling: deterministic argmax; no temperature, no diffusion steps. CPU and NPU share same weights, obs, seed=0.
  • Device proof: model params, input obs, output logits all on npu:0 (see npu_device_call.png).

Real Results (single step, batch=1)

CPU (float32):

  • obs mean/std -0.0293/1.007
  • logits [-3.7225, 22.7480, -21.6307, 0.8752, -10.6373]
  • probs [3.19e-12, 1.0, 5.32e-20, 3.16e-10, 3.16e-15]
  • action [1]

NPU (npu:0, float32):

  • logits [-3.7225, 22.7479, -21.6306, 0.8752, -10.6373]
  • probs [3.19e-12, 1.0, 5.32e-20, 3.16e-10, 3.16e-15]
  • action [1] — matches CPU

Consistency: max_abs 9.5e-06, mae 4e-06, tolerance 0.0228 (atol=1e-4, rtol=1e-3), finite True, shape [1,5] → PASS via validate_policy_outputs.py

Performance (npu:0, synchronized, dtype float32)

  • Warmup 3, measured 10
  • First latency (compile) ~130ms, steady avg 0.15–0.16ms per decision
  • Example run: avg_ms 0.153, min 0.147, max 0.170, p50 0.150, p90 0.160, p95 0.170
  • Throughput: ~6508 decisions/s (1 action per call, 5 logits)
  • Notes: batch=1, obs_dim=172, hidden=512x2, Swish, discrete head 5

Environment Limitations

  • Requires Ascend 910B/910_9362 with torch_npu 2.9+, CANN 8.5.1, torch 2.9.0+cpu
  • Single card npu:0 only; memory ~3105 MB estimated weight 8.3 MB + activations negligible
  • Does not include Unity simulator; closed-loop rollout not performed — inference validated as single-step logits/action
  • Checkpoint is ML-Agents .pt (not HF safetensors); local path /tmp/models/... with HF hub fallback Pyramids/Pyramids-3000009.pt
  • Remote code not required (no trust_remote_code)

Usage

pip install -r requirements.txt
python inference.py

Expected to print model/revision/route, NPU availability, CPU vs NPU logits, consistency PASS/FAIL.

Evidence

  • agent workflow
  • npu device call
  • model result

All three PNGs are rendered from real stdout/stderr via xterm.js with SHA-256.

License

Apache-2.0 (ML-Agents)