本仓库为 sb3/dqn-LunarLander-v2 在华为昇腾 Ascend 910B (npu:0) 上的适配版本,路由 offline-rl。
sb3/dqn-LunarLander-v2 revision 3f631509a3a70816ba982661e79a1f25f2e617bbobservation shape (B,8) float32, 示例 batch 4 已固定: [0,1,0,-0.2,0,0,0,0] 等 (hash 0948616b183b9510)q_values shape (B,4) float32, action = argmax(q_values) 离散动作, horizon 1, sampler argmax, seed 0npu:0 Ascend910_9362 (2卡环境, 单卡推理), torch.npu.is_available()=Truepolicy.pth (557057 bytes, 12 tensors含 target дубликат), 不更换模型, 不使用随机初始化, 不使用 CPU fallbacknpu:0, 观测 tensor npu:0, 输出 q_values/actions npu:0, 已同步计时 torch.npu.synchronize()validate_policy_outputs.py --cpu /tmp/cpu_output.json --npu /tmp/npu_output.json → {"passed": true, "count":16, "max_abs":1.14e-05}atol=1e-4 rtol=1e-3, 实测 max_abs 1.14e-05, tolerance 0.0517, 通过torch.npu.synchronize() 计时)benchmark_policy.py --latencies-ms /tmp/latencies.json --items-per-call 4 --unit decisionspip install -r requirements.txt
python inference.py默认从本地 /opt/atomgit/adapt-npu-agent/working/models/dqn-LunarLander-v2/dqn-LunarLander-v2/policy.pth 加载, 若不存在会通过 HF_ENDPOINT=https://hf-mirror.com 自动下载。
输出包含: model/revision/route/backend/device/dtype/输入摘要/q_values与actions摘要/同步耗时/PASS-FAIL。
torch_npu, stable-baselines3 (仅用于权重格式解释, 推理不依赖 gym), gymnasiumassets/agent_workflow.png - 侦察、资源检查、加载、NPU推理、一致性、性能与校验assets/npu_device_call.png - npu-smi、NPU availability、设备名、模型/输入/输出 deviceassets/model_result.png - 默认 python inference.py 的模型、route、真实 ActionPlan、同步耗时和最终状态
