hardware: NPU
Model: edbeeching/decision-transformer-gym-hopper-medium
Revision: 8224ec324200b150f10287b8c8c525224e62f319
Route: offline-rl
Backend: torch_npu on npu:0 (Ascend910_9362)
state / action / return-to-go / timestep 序列为条件,预测下一个连续动作。states [B, T, 11], actions [B, T, 3], returns_to_go [B, T, 1], timesteps [B, T] (Long), attention_mask [B, T]。本次验证使用 B=1, T=20,dtype=float32,seed=0 的确定性随机数构建观测;真实 Hopper 状态需按官方均值/方差归一化(见下)。action_preds [B, T, 3],取最后位置 [-0.5125, 0.7467, -0.6418] 作为 ActionPlan(当前步要执行的动作),horizon=1, action_dim=3,tanh=True 约束在 [-1,1]。mean=[1.31, -0.084, -0.538, -0.072, 0.049, 2.106, -0.150, 0.008, -0.284, -0.185, -0.284], std=[0.177, 0.054, 0.212, 0.145, 0.612, 0.851, 1.451, 0.675, 1.536, 1.616, 5.607]pytorch_model.bin 6.3 MB, 858767 参数,本地路径 /tmp/dt_hopper[-0.51254445, 0.74670905, -0.64183486][-0.51254445, 0.74670863, -0.64183503],device npu:0max_abs=4.17e-07, tolerance=8.47e-04 (atol=1e-4, rtol=1e-3), passed=True, 有限值校验通过,shape [1,20,3] 一致npu:0,浮点输入 states/returns_to_go 位于 npu:0,timesteps 位于 npu:0,输出 action_preds 位于 npu:0,全程 torch.npu.synchronize() 包围计时torch.npu.synchronize() 前后 time.perf_counter(),预热 3 次,正式测量 10 次avg 3.09ms, min 3.02ms, max 3.25ms, p50 3.04ms, p90 3.17ms, p95 3.25ms~323 decisions/s (decisions_per_s = 1000/avg_ms),batch=1, context=20, dtype=float32decisions/s 统计单次前向产生 1 个有效决策(最后位置动作)的速率npu-smi 可见 2 卡,本次使用 npu:0torch 2.9.0+cpu, torch_npu 2.9.0.post1+gitee7ba04, transformers 4.57.6, CANN 8.5.1seed=0、dtype=float32、context_length=20、attention_mask 全 1,model.eval() 关闭 dropoutpython inference.py
# 输出包含 model/revision/route/backend/device/dtype、输入摘要、ActionPlan、同步耗时、CPU-NPU 对比和 PASS/FAILpip install -r requirements.txt
python inference.py
