This is an NPU adaptation of HumanCompatibleAI/ppo-CartPole-v1 validated on Ascend 910B (npu:0) with torch_npu.
08b61dd5dca1ee9f1a0f2d7a0fcf7740b0af5dac (fixed download via huggingface_hub / stable_baselines3 loader)MlpPolicy (ActorCriticPolicy, 4 -> 64 -> Tanh -> 64 -> Tanh -> 2 action logits), value head 64->1CartPole-v1 (observation Box shape (4,) discrete Discrete(2))ppo-CartPole-v1.zip 139331 bytes, policy.pth 40641 bytes, 8898 parameters (~35.5 KiB fp32)| Item | Value |
|---|---|
| Route | offline-rl (discrete decision policy) — CartPole state → deterministic discrete action. Closest to offline-rl family; not VLA/driving. |
| Observation | 4-dim float32: cart position, velocity, pole angle, pole angular vel. Input range per Gymnasium: [-4.8, 4.8], [-0.418,0.418] for angle. |
| Output | deterministic action 0 (left) / 1 (right) via argmax of logits [2]. Horizon 1. Logits shape (batch,2). |
| Sampler | deterministic (deterministic=True), no stochastic sampling in validation. |
| Backend | stable-baselines3==2.9.0 PPO.load(..., device="npu:0") |
| Dtype / Device | float32 on both CPU and npu:0. All float tensors, policy params, logits verified on npu:0 with torch.npu.synchronize() timing. |
Evidence rendered from this pod's true logs (see assets/*.png).
npu:0 Ascend910_9362 (torch.npu.is_available()=True, 2 NPUs visible via npu-smi info)npu:0 (next(policy.parameters()).device == npu:0)npu:0 on all participating tensorsobs[0] [0.0,0.0,0.0,0.0] -> logits [-12.70907, -2.86e-06] -> action 1
obs[1] [0.5,0.1,-0.2,0.3] -> logits [-19.9782, 0.0] -> action 1
obs[2] [-0.5,-1.0,0.1,-0.5] -> logits [0.0, -36.00457] -> action 0atol=1e-4 rtol=1e-3): max_abs 1.9e-06, tolerance 0.036, passed true, finite true; deterministic actions identical 1,1,0,1,0 on both.torch.npu.synchronize() bounded, 20 samples batch 1): avg 0.627 ms, min 0.607 ms, max 0.676 ms, p50 0.625 ms, p90 0.644 ms, p95 0.647 ms, decisions/s 1593.7. Via inference.py batch 3: avg 0.424 ms → 7069.5 decisions/s.CartPole-v1 with seed 0..4 on npu:0 → 500.0 reward each, mean 500.0 (matches model card 500.00 +/-0.00).Same ppo-CartPole-v1.zip, same normalized 4-dim observations, same deterministic=True, same float32, same eval mode. Compared logits (continuous) rather than only discrete label, using scripts/validate_policy_outputs.py. All 10 matching.
Reported with torch.npu.synchronize() around every predict/get_distribution. Warm-up 3–5 calls excluded. Units decisions/s = batch / avg_ms *1000, decisions horizon 1, action_dim 2.
gymnasium step) stays on CPU (host-bound simulation, not an NPU operator).trust_remote_code not required (pure SB3 zip).pip install -r requirements.txt
python inference.py
# loads HumanCompatibleAI/ppo-CartPole-v1 from /tmp/ppo_cartpole or HF hub, runs on npu:0 if availableEvidence:
