gmmeyer/gpt-bird (DreamGPT world model ~11M, n_layer=6, d_model=384, block_size=1280, vocab=232)dccc1abd22f5dc0f5c4ab1dc2dfb38a62fd89702small_pipes.pt (44 MB) + model.onnx (44 MB),HF 镜像 https://hf-mirror.com/gmmeyer/gpt-birdS_t 与玩家动作 A_t(4 tokens/frame: bird_y/pipe_dx/gap_y/status + action),自回归预测下一帧的4个状态token,slot-constrained 解码保证合法帧,循环即可替代物理引擎。unknown/custom world-model(decoder-only transformer,非标准 CV 双塔/检测/分割,采用任务专属验证)npu:0 (Ascend910_9362){
"python": "3.11.14",
"torch": "2.9.0+cpu",
"torch_npu": "2.9.0.post1+gitee7ba04",
"huggingface_hub": "0.36.2",
"numpy": "2.3.5",
"device_name": "Ascend910_9362",
"npu_smi": "25.5.5"
}安装:pip install -r requirements.txt
默认执行:python inference.py
可选:
python inference.py --mode validate — 仅验证一致性python inference.py --mode benchmark — 仅压测脚本自动完成:snapshot_download 本地加载 → CPU 基线 → npu:0 推理 → CPU/NPU 对比 → slot-constrained 生成 → 同步计时 → PASS/FAIL。
确定性上下文(复现官方token语法,3帧 + 动作):
{
"route": "world-model",
"vocab_size": 232,
"offsets": {"by": 4, "dx": 132, "gap": 196, "status": 228, "action": 230},
"block_size": 1280,
"context_tokens": [1, 68, 187, 212, 228, 230, 68, 186, 212, 228, 231, 69, 185, 212, 228, 230],
"context_len": 16,
"frames": [
{"bird_y": 256.0, "pipe_dx": 250.0, "gap_y": 256.0, "alive": true},
{"bird_y": 258.5, "pipe_dx": 246.0, "gap_y": 256.0, "alive": true},
{"bird_y": 260.0, "pipe_dx": 242.0, "gap_y": 260.0, "alive": true}
],
"actions": [0, 1],
"next_action": 0,
"dtype": "float32",
"device": "npu:0"
}Input input_ids shape: [1, 16],类型 torch.long,block_size 内有效。
NPU 上实测(与 CPU 同输入对比):
{
"cpu_logits_shape": [1, 16, 232],
"npu_logits_shape": [1, 16, 232],
"last_logits_cpu_5": [-5.1197, -3.6249, -2.1345, -5.1415, -2.4799],
"last_logits_npu_5": [-5.1068, -3.6345, -2.1394, -5.1287, -2.4619],
"max_abs_diff_logits": 0.0519,
"argmax_last_cpu": 70,
"argmax_last_npu": 70,
"argmax_agree": true
}Slot-constrained 生成(temperature=1.0,slot2采样,其余贪心):
{
"generated_cpu": [70, 164, 212, 228],
"generated_npu": [70, 164, 212, 228],
"greedy_slots_agree": true,
"decoded_cpu": {"bird_y_bin": 66, "pipe_dx_bin": 32, "gap_y_bin": 16, "alive": true, "bird_y": 266.0, "pipe_dx": 146.2, "gap_y": 264.0},
"decoded_npu": {"bird_y_bin": 66, "pipe_dx_bin": 32, "gap_y_bin": 16, "alive": true, "bird_y": 266.0, "pipe_dx": 146.2, "gap_y": 264.0},
"note": "slot 2 (gap_y) 为采样,结果在固定 seed=0 下可复现;贪心 slots (0,1,3) CPU/NPU 完全一致"
}一致性判定:max_abs_diff < 0.08 且 argmax 一致且贪心 slots 一致 → PASS。
NPU 同步计时(torch.npu.synchronize() 前后,warmup 3 + repeat 10,tokens=16,block_size=1280,FP32):
{
"device": "npu:0",
"dtype": "float32",
"warmup": 3,
"repeat": 10,
"avg_ms": 3.16,
"min_ms": 3.07,
"max_ms": 3.26,
"p50_ms": 3.19
}峰值 HBM 约 3105 MB(npu-smi),模型参数约 11.2M(~43 MB FP32),单卡 Ascend910B 充足。
dreaming_bird 架构,权重 pickle 需 dreaming_bird.config.ModelConfig,已在 inference.py 内通过 shim 兼容,无需额外 src。model.onnx opset 17, 44 MB) 为 WebGPU 演示用,本次 NPU 适配直接加载 PyTorch small_pipes.pt,避免 ONNXRuntime 依赖。max diff ~0.05 为 Ascend 算子精度正常范围,argmax 与生成结果一致为准。sample_slots=(2,) 对应 gap_y 随机性;固定 torch.manual_seed(0) 可复现。assets/agent_workflow.png — 完整工作流日志(含环境检查、下载、侦察、NPU 推理、验证、性能)assets/npu_device_call.png — npu-smi info、torch.npu.is_available()、npu:0 设备名、模型参数 device/dtypeassets/model_result.png — 默认 python inference.py 完整输出(真实任务输出 + 计时 + PASS)python .opencode/skills/npu-adapt-skills/scripts/validate_submission.py submission/gpt-birdGitCode 模型仓库(type: model, public):https://gitcode.com/liucu/gpt-bird-NPU
权重来源:https://huggingface.co/gmmeyer/gpt-bird(HF 镜像 https://hf-mirror.com)