NeoQuasar/WindFMhttps://huggingface.co/NeoQuasar/WindFMhttps://huggingface.co/NeoQuasar/WindFM-Tokenizer (BSQuantizer, codebook 20 bits = 10+10)WindFMTokenizer (d_in 6 → d_model 256, 4 encoder + 4 decoder TransformerBlocks, BSQuantizer) + WindFM (4层 decoder Transformer, d_model 256, 8 heads, ff_dim 512, HierarchicalEmbedding s1/s2, FourierTemporalEmbedding, DualHead)NeoQuasar/WindFM & NeoQuasar/WindFM-Tokenizer,论文 https://arxiv.org/abs/2509.06311python inference.py 默认在 npu:0 完成真实 NPU 推理(贪心确定性解码,无 CPU fallback,首轮编译与稳定推理分开计时)data [T, 6] float32,列顺序固定 ['wind_speed','wind_direction','power','density','temperature','pressure'],列名、dtype、顺序需校验;缺失值不允许 (输入含 NaN 将报错)
time 列为 UTC 时间戳 (ISO8601 with +00:00),经 calc_time_stamps 提取 minute/hour/weekday/day/month 5维,经 FourierTemporalEmbedding 编码 (10 Fourier features per component)/tmp/WindFM/examples/data/121522.csv 420 行,7列 (time + 6 features),SHA256 前缀 21ba6289e0e94a76,均值 power 6.7965 std 4.9525lookback 240 (2007-01-05 04:00 -> 2007-01-15 03:00 UTC), 预测 pred_len 80 (2007-01-15 04:00 -> 2007-01-18 11:00 UTC),max_context 512z-score (x-mean)/std (mean/std 来自 240 长度上下文), clip [-5,5],dtype float32,轴顺序 [B, T, 6],时间戳同步生成 x_stamp [B,240,5] + y_stamp [B,80,5]
x_mean/x_std 用于 CPU 与 NPU 且用于逆归一化 x*(std+1e-6)+meanforecast_full [80, 6] float32 (已逆归一化到原始尺度 MW 等),本仓取 power 列 (index 2) 作为主指标 power_pred [80] float32
[0.23357 0.22040 0.19648 0.16145 0.13116], last5 [0.514748 0.520683 0.525651 0.52998 0.535022], mean 0.0996 std 0.2525, finite True[0.04344 0.03933 0.02319 0.00358 0.00835], last5 [10.418448 10.750813 10.377075 10.631541 10.864673]greedy_inference (含 tokenizer encode/decode + transformer 自回归),不含 CSV 读取、DataFrame 预处理与逆缩放准备isnull().values.any() 校验,非空方可推理;列顺序错误或缺列将抛 ValueErrornpu:0pip install -r requirements.txt
# 包含 torch, torch_npu, numpy, pandas, safetensors, huggingface_hub, einops, tqdm, matplotlib依赖已在 AArch64 上验证,无需手动设置 http_proxy/https_proxy/HF_ENDPOINT。
python inference.py行为:
/tmp/WindFM-Tokenizer 与 /tmp/windfm_test 加载 model.safetensors (各 16MB),否则 via snapshot_download(repo_id="NeoQuasar/WindFM-Tokenizer", "NeoQuasar/WindFM") 下载到 /tmp(依赖环境变量直连,不隐式再联网二次下载权重)WindFMTokenizer (config s1_bits 10 s2_bits 10) 与 WindFM (n_layers 4 d_model 256 n_heads 8),eval(),显式 .to("npu:0"),所有参数与输入 Tensor 均在 npu:0argmax over s1/s2 logits (不使用 torch.multinomial 随机采样),保证 CPU-NPU 一致性torch.npu.synchronize() 计时,首轮含编译约 0.99s,稳定约 0.60s,10 次正式测试NPU 关键调用已在代码中显式标注,详见 assets/npu_device_call.png。
npu:0, dtype float32, 权重 32MB, 参数 ~8.1Mx [1,240,6] + x_stamp [1,240,5] + y_stamp [1,80,5],归一化后 x_norm 均值 ~0,clip [-5,5]npu:0, param devices {'npu:0'}, fallback Falsez [1,320,6] (320 = 240+80 ≤512),取最后 80 行逆归一化npu:0, shape (80,) power, dtype float32, finite True[0.23357487 0.22040749 0.19648838 0.16145372 0.13116646] (CPU 同输入对照见下)[0.5147481 0.5206833 0.525651 0.5299802 0.53502274], mean 0.0996[0.04344 0.03933 0.02319 0.00358 0.00835], last5 [10.418448 10.750813 10.377075 10.631541 10.864673], MAE 4.9967 RMSE 7.0057 (单样本 greedy)[SUCCESS] WindFM NPU inference completed on npu:0, exit 0, 无 CPU fallback真实日志见 logs/inference.log 及证据图 assets/model_result.png。输入为官方样例 CSV 240上下文,非随机占位;最终证据使用贪心解码。
.opencode/skills/npu-adapt-skills/scripts/compare_outputs.py --task regression --atol 1e-4 --rtol 1e-3 + np.allclosex_norm [1,240,6] + x_stamp [1,240,5] + y_stamp [1,80,5],同一权重 /tmp/WindFM-Tokenizer & /tmp/windfm_test,同预处理 (mean/std, clip), 同 horizon 80、eval mode、同 dtype float32、贪心 argmax(80,) finite True, preview [0.23357534 0.22040987 0.196486 0.16145658 0.13116789], last5 [0.51474905 0.5206857 0.5256505 0.52997875 0.5350213](80,) npu:0, preview [0.23357487 0.22040749 0.19648838 0.16145372 0.13116646], last5 [0.5147481 0.5206833 0.525651 0.5299802 0.53502274]{"task":"regression","cpu_shape":[80],"npu_shape":[80],"finite":true,"atol":0.0001,"rtol":0.001,"max_abs_error":7.62939453125e-06,"mean_abs_error":2.09808349609375e-06,"passed":true}atol 1e-4 rtol 1e-3,实测 max 7.6e-06 有 13× 余量,mean 2.0e-06 有 50× 余量,证明无 fallback 且数值一致;shape 一致,finite Truefallback_detected: False)greedy_inference (含 tokenizer encode/decode + 80 步自回归,预处理在计时外)三图均由 scripts/render_xterm_evidence.mjs --style raw 基于本次真实日志生成,深灰背景白色等宽字体,提示符 atomgit@pod-a94f8701860f4700b161b00e290de466:~$,非手工模拟:
assets/agent_workflow.png — 侦察、数据检查、下载、加载、NPU 推理、一致性、benchmark、提交校验assets/npu_device_call.png — npu-smi info、NPU 可用性、设备名、模型参数 device/dtype、输入与输出 Tensor deviceassets/model_result.png — 默认 python inference.py 的真实完整输出,包括 schema/窗口摘要、真实预测、同步耗时和状态README 仅引用图片,未披露渲染工具细节。图片由 xterm.js 根据本次真实日志生成,非原始桌面截图。

argmax 确定性解码以保证 CPU-NPU 一致性,与论文/官方默认的概率采样 (T=1.0 top_p 0.9 sample_count 100) 不同;概率采样在 CPU 与 NPU 间因 torch.multinomial RNG 实现差异会产生显著分歧,不适用于严格数值对齐121522.csv 的 240→80 窗口,未覆盖多站点、多季节、缺失值及极端天气;完整零样本评估需加载更多站点数据并计算 CRPS/Quantile Lossshiyu-coder/WindFM 的 Python 源码 (MIT),若上游接口变更需同步适配;本仓已内联关键模块以保证自包含生成时间: 2026-08-21 UTC, 模型 revision: main, 权重: https://huggingface.co/NeoQuasar/WindFM + https://huggingface.co/NeoQuasar/WindFM-Tokenizer