HumanCompatibleAI/ppo-Pendulum-v1 (PPO MlpPolicy)6a0fe838119427278252dde3bf723ed7a3266df5offline-rl (adapted PPO continuous policy, observation -> action)ppo-Pendulum-v1/policy.pth (40382 bytes, ~36k params, Tanh MLP 64x64)npu:0 and cpu[cos(theta), sin(theta), theta_dot] where theta in [-pi, pi], theta_dot in [-8,8], dtype float32mlp_extractor.policy_net=[Linear(3,64)+Tanh, Linear(64,64)+Tanh] -> action_net Linear(64,1) -> mean_actions -> clamp[-2,2] and value network same shape. use_sde=True during training but deterministic inference uses mean only; log_std (64,1) is training-only and ignored for deterministic action.normalize=False in training), raw observation directly fed to MLP.torch.nn (Tanh activations matching SB3) to allow direct to(npu:0) placement and avoid gymnasium/stable-baselines3 NPU incompatibilities.policy.pth OrderedDict: mlp_extractor.policy_net.*, mlp_extractor.value_net.*, action_net.*, value_net.*.npu:0 when NPU requested; verified via next(model.parameters()).device, input.device, output.device.torch.npu.synchronize() before/after forward.pip install -r requirements.txt
python inference.py # auto NPU if available
python inference.py --device npu # force npu:0
python inference.py --device cpu # force cpu
python inference.py --mode validate # CPU vs NPU consistency
python inference.py --mode benchmark # warmup 3 + 10 measuredDefault python inference.py loads local policy.pth (or hf_hub_download fallback), prints model/revision/route/backend/device/dtype/input summary/action summary/synced latency/PASS/FAIL.
Ascend910_9362, torch.npu.is_available()=True, npu:0 exists, count=2npu:0 (single obs [1.0,0.0,0.0] upright, batch 8 covering upright/down/side states)npu:0 shape [1,1] and [8,1]-0.267 clipped -0.267 value -0.0663.90 -> 2.0, -4.96 -> -2.0Shared weights, same 8 fixed observations, same Tanh MLP, deterministic mode, dtype float32. Compared raw mean and clipped action and value. Threshold FP32 atol=1e-4 rtol=1e-3. Continuous action bounds checked.
| metric | value |
|---|---|
| max_abs_mean | 0.000000 |
| max_abs_action | 0.000000 |
| max_abs_value | 0.000008 |
| tolerance | 0.005063 |
| actions_match (after clip) | true |
torch_npu built for CANN 8.5.1, Ascend910B/910 recommended, single card sufficient.python -m gymnasium not required at runtime; pure torch inference avoids env dependencies.inference.py.assets/agent_workflow.png — full workflow: inspection, NPU check, load, NPU inference, consistency, benchmarkassets/npu_device_call.png — npu-smi, torch_npu availability, device name, model/input/output device proofassets/model_result.png — default python inference.py showing action, latency, PASSinference.py
readme.md
requirements.txt
assets/agent_workflow.png
assets/npu_device_call.png
assets/model_result.png