sb3/dqn-LunarLander-v2 (DQN MlpPolicy)3f631509a3a70816ba982661e79a1f25f2e617bb (main branch, commit 3f6315)offline-rl (adapted DQN discrete policy, observation -> Q-values -> action)dqn-LunarLander-v2/policy.pth (557057 bytes, ~69k params q_net + 69k target ~138k total, ReLU MLP 256x256 -> logits 4)npu:0 and cpu[x, y, vx, vy, angle, angular_velocity, left_leg_contact, right_leg_contact] where x in [-1.5,1.5], y in [0,1.5], vx/vy unbounded, angle in [-pi,pi], leg contacts binary 0/1, dtype float32q_net Sequential: Linear(8,256)+ReLU, Linear(256,256)+ReLU, Linear(256,4) -> Q-values -> argmax. Target network identical, not used for inference except weight verification. Deterministic inference uses argmax.normalize=False).torch.nn (ReLU activations matching SB3) to allow direct to(npu:0) placement and avoid gymnasium/stable-baselines3 NPU incompatibilities.policy.pth OrderedDict: q_net.q_net.0.*, q_net.q_net.2.*, q_net.q_net.4.* and q_net_target.* (verified identical).npu:0 when NPU requested; verified via next(model.parameters()).device, input.device, output.device.torch.npu.synchronize() before/after forward for accurate NPU latency.npu:0.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 (same weights, same 8 obs)
python inference.py --mode benchmark # warmup 3 + 10 measured, synchronizedDefault 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 [0,1,0,0,0,0,0,0] centered hover, batch 8 covering hover/drift/legs-contact/large-angle)npu:0 shape [1,4] Q-values and [8,4] batch, action shape [1] and [8][33.318, 33.658, 32.285, 32.924] -> probs [0.291, 0.409, 0.104, 0.196] -> action 1 (fire left)[1,0,3,3,2,2,3,3] with Q range 20.90-83.09, finite true, bounds [0,3] satisfiedShared weights, same 8 fixed observations, same ReLU MLP, deterministic argmax, dtype float32. Compared Q-values, probs, argmax action. Threshold FP32 atol=1e-4 rtol=1e-3. Discrete action bounds checked.
| metric | value |
|---|---|
| max_abs_q | 0.000015 |
| mean_abs_q | 0.000006 |
| max_abs_probs | 0.000003 |
| tolerance | 0.083193 |
| actions_match (argmax) | true |
torch_npu built for CANN 8.5.1, Ascend910B/910 recommended, single card sufficient (tested on Ascend910_9362).gymnasium/stable-baselines3 not required at runtime; pure torch inference avoids env dependencies.inference.py, no remote code execution.hf_hub_download fallback fetches from huggingface if local cache missing.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 Q-values, action, latency, PASSinference.py
readme.md
requirements.txt
assets/agent_workflow.png
assets/npu_device_call.png
assets/model_result.png
