AutonLab/MOMENT-1-basehttps://huggingface.co/AutonLab/MOMENT-1-basegoogle/flan-t5-base (T5, d_model=768, d_ff=2048, 12 encoder layers + 12 decoder layers, 12 heads, vocab 32128), patch_len=8, patch_stride=8, seq_len=512python inference.py 默认在 npu:0 完成真实 NPU 推理本仓验证该权重的 exact checkpoint 在 Ascend 910 (npu:0) 上完成重构推理,CPU-NPU 误差在 FP32 阈值内。
x_enc: [batch, n_channels, seq_len] float32, input_mask: [batch, seq_len] float32 (全1表示无缺失), 轴顺序明确为 [B, C, T]reconstruction: [batch, n_channels, seq_len] float32, 与输入同形状, 逆变换已完成 (直接重构值)pip install -r requirements.txt
# 包含 torch, torch_npu, transformers, huggingface_hub, numpy, momentfm (git)python inference.py行为:
working/models/MOMENT-1-base 加载 (含 model.safetensors 432.9 MB),否则从 HF Hub AutonLab/MOMENT-1-base 下载到 ./.cache/MOMENT-1-baseMOMENTPipeline(task_name="reconstruction").to("npu:0"),输入/掩码显式 .to("npu:0")torch.npu.synchronize() 计时,首轮含编译,2 次 warmup + 10 次正式npu:0, dtype float32, 权重 432.9 MBx_enc [2,3,512] 均值 0.8528 std 1.5611, input_mask [2,512] 全1[0.5248357, 0.5542569, 0.6541928, 0.7578365, 0.7288649]npu:0, shape (2,3,512), dtype float32, finite True[-0.4207615, -0.07447138, 0.12163288, -0.12251939, 0.14481770][SUCCESS] MOMENT-1-base NPU reconstruction completed, exit 0, 无 CPU fallback真实日志见 logs/inference.log 及证据图 assets/model_result.png。
.opencode/skills/npu-adapt-skills/scripts/compare_outputs.py --task regression --atol 1e-4 --rtol 1e-3torch.manual_seed(42) 合成序列 (2,3,512)(2,3,512) finite True, preview [-0.4207619, -0.07447129, 0.12163303, -0.12251929, 0.14481776](2,3,512) npu:0, preview [-0.4207615, -0.07447138, 0.12163288, -0.12251939, 0.14481770]{"task":"regression","cpu_shape":[2,3,512],"npu_shape":[2,3,512],"finite":true,"atol":0.0001,"rtol":0.001,"max_abs_error":1.9073486328125e-06,"mean_abs_error":1.9285979154422725e-07,"passed":true}fallback_detected: False)三图由 xterm.js 根据本次真实日志渲染生成 (raw 风格, 深灰背景 #282828, 提示符 atomgit@pod-a94f8701860f4700b161b00e290de466:~$):
assets/agent_workflow.png — 侦察、下载、NPU 推理、一致性、提交校验assets/npu_device_call.png — npu-smi info + check_npu.py + 参数/张量 deviceassets/model_result.png — python inference.py 真实完整输出 (schema、预测、耗时、状态)

kernel [ArgSort] can not support dtype int32 or int64 on AiCore) 但不影响功能与精度,未来可 cast 到 float32 优化working/models/MOMENT-1-base