gcw_6a3w2yXz/gmmeyer-gpt-bird-NPU
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

gmmeyer/gpt-bird on Ascend NPU

1. 模型简介

Dreaming Bird 是一个基于 decoder-only transformer 的 Flappy Bird 世界模型。给定最近的游戏帧和玩家动作(扇动/不扇动),模型自回归生成下一帧的量化状态。以约 30-60 fps 循环运行时,模型取代了物理引擎——运行时不存在游戏逻辑,网络本身就是物理系统。

  • 模型架构:nanoGPT-style decoder (DreamGPT)
  • 参数量:11,202,432 (~11M)
  • 配置:n_layer=6, n_head=6, d_model=384, block_size=1280
  • 词表大小:232(bird_y 128 bins, pipe_dx 64 bins, gap_y 32 bins, status/action tokens)
  • 检查点:small_pipes.pt(完整管道游戏模型)

2. 验证环境

项目值
NPUAscend 910B (Ascend910_9362)
CANN8.5.1
PyTorch2.9.0+cpu
torch_npu2.9.0.post1
Python3.11.14

3. 安装依赖

pip install torch torch_npu numpy

4. NPU 推理

# 下载检查点
python3 -c "from huggingface_hub import snapshot_download; snapshot_download('gmmeyer/gpt-bird', local_dir='.')"

# 运行推理
python inference.py --checkpoint small_pipes.pt --frames 100

5. 真实推理结果

在 Ascend 910B NPU 上运行 100 帧自回归生成:

Frames generated: 99
Total time: 1.508s
FPS: 65.6
Final state: bird_y=354.00, pipe_dx=11.25, gap_y=104.00, alive=False (died at frame 99)

采样帧:

Frame   1: bird_y= 258.00, pipe_dx= 222.75, gap_y= 296.00, alive=True
Frame  10: bird_y= 322.00, pipe_dx= 186.75, gap_y= 296.00, alive=True
Frame  28: bird_y= 346.00, pipe_dx= 114.75, gap_y= 296.00, alive=True
Frame  55: bird_y= 318.00, pipe_dx=   6.75, gap_y= 296.00, alive=True, action=FLAP
Frame  73: bird_y= 270.00, pipe_dx= 114.75, gap_y= 104.00, alive=True
Frame  91: bird_y= 322.00, pipe_dx=  42.75, gap_y= 104.00, alive=True

6. CPU-NPU 一致性验证

CPU 和 NPU 的前向传播输出完全一致(相同 logits),验证了模型在 NPU 上的数值正确性。

7. 性能测试

指标值
推理帧数99
总耗时1.508s
FPS65.6
每帧耗时~15.2ms
实时能力60+ FPS (超过 30fps 实时阈值)

8. 已知限制

  • 该模型为 Flappy Bird 世界模型,非通用视觉/语言模型
  • 推理依赖种子初始化的脚本策略,非端到端游戏游玩
  • gap_y 槽位使用随机采样(模拟管道生成的随机性)

证据图

工作流日志 NPU设备证明 推理结果