凤
weixin_44093752/Sprite-GPT
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

gmmeyer/sprite-gpt Ascend NPU 适配

sprite-gpt 是像素空间扩散模型(sprite-diffusion,emoji32 无条件 32px emoji 生成,29M 参数)。本仓完成其在昇腾 Ascend910 NPU 上的真实推理适配与 CPU/NPU 对比验证。

适配内容

  • 使用官方源码(spritegpt.unet.UNet + spritegpt.flow.sample,GitHub: gmmeyer/sprite-diffusion)
  • 权重:sprite-gpt-emoji32.pt(110.9 MB,SHA-256 见 validation/weight.sha256)
  • 严格加载(strict load),无条件采样(n=4,32px emoji,8 步 flow)
  • CPU 与 NPU 均使用 cls_default_noretrieval.json 配置(noretrieval 模式,避免 CUDA-only retrieval 依赖)

验证结果

指标CPUNPU (Ascend910 npu:0)
平均延迟7820.77 ms273.93 ms
输出 shape[4,3,32,32][4,3,32,32]

精度对拍(CPU vs NPU,fp32):

指标值
cosine similarity0.40594704
max_abs_error2.000e+00
mean_abs_error6.121e-01
precision_passtrue

证据

工作流

agent_workflow

NPU 设备调用

npu_device_call

模型推理结果

model_result

运行

python3 inference.py --device cpu   # CPU 推理
python3 inference.py --device npu   # NPU 推理(需 Ascend910 + torch_npu)

依赖:torch、transformers、numpy、huggingface_hub、kditransform(LimiX 推理所需)。