ibm-research/test-ttm-v1tinytimemixer / TinyTimeMixerForPredictionnum_input_channels=1, context_length=512, prediction_length=96model.safetensors 3,240,592 bytes, dtype float32, safetensors格式| 项 | 值 |
|---|---|
| 输入 | past_values Tensor shape [batch, time, channels] = [B, 512, 1] |
| 频率 | frequency_token_vocab_size=5 (可选 freq_token) |
| 缩放 | scaling=std (StdScaler, per-channel) |
| Patch | patch_length=64, patch_stride=64, num_patches=8, adaptive_patching_levels=3 |
| 输出 | prediction_outputs shape [B, 96, 1] (point forecast, mse loss) |
| dtype | float32 (模型) |
| 轴顺序 | 明确 [B,T,C] 输入, 不做转置 |
| 任务指标 | forecasting: MAE/RMSE on forecast, 本次验证为 CPU-NPU 数值一致性 (forecast tensor) |
输入验证: 使用可复现合成数据 torch.randn(2,512,1) seed=42, 也支持 CSV/Parquet 通过 --data 参数加载后转换为相同 past_values 形状。表格图片/OCR/视觉模型不在本仓库范围内。
model_snapshot 加载, 否则 via huggingface_hub snapshot_download (依赖 HF_ENDPOINT=https://hf-mirror.com)torch.npu.is_available()==True, torch.npu.device_count()>=1, torch.npu.get_device_name(0)==Ascend910_9362# 1. 克隆 granite-tsfm 以获取 TTM 实现 (无需安装完整 datasets 依赖, inference.py 已内置 dummy)
git clone --depth 1 https://github.com/ibm-granite/granite-tsfm /tmp/granite-tsfm
pip install --no-deps -e /tmp/granite-tsfm
# 2. 安装其他依赖
pip install -r requirements.txt
# 3. 获取权重 (已通过环境变量走镜像)
python -c "from huggingface_hub import snapshot_download; snapshot_download('ibm-research/test-ttm-v1', local_dir='model_snapshot', local_dir_use_symlinks=False)"
# 或直接让 inference.py 自动从 HF 拉取默认命令 (合成数据, batch=2):
python inference.py
# 自定义批大小或外部数据
python inference.py --batch 4 --data /path/to/data.csv关键实现:
model.to('npu:0'), past_values.to('npu:0'), 显式 torch.npu.synchronize() 计时trust_remote_code, 无隐式联网下载 (优先本地权重)[2,512,1] seed=42prediction_outputs [2,96,1], finite=True[0.1182, 0.0127, -0.0227, -0.0379, -0.062]npu:0, 参数 device npu:0, 输入/输出 device npu:0, 无 CPU fallback.npy, 运行 scripts/compare_outputs.pypython .opencode/skills/npu-adapt-skills/scripts/compare_outputs.py --cpu working/cpu.npy --npu working/npu.npy --task forecasting --atol 1e-3 --rtol 1e-3cpu_shape [2,96,1] npu_shape [2,96,1] finite true max_abs_error 0.000416 mean_abs_error 0.000179 passed true (FP32, atol 1e-3 rtol 1e-3)python /tmp/run_validation.py 已记录 working/perf.json三张 PNG 由 xterm.js 根据本次真实日志生成 (深灰背景, 白色等宽字体, 提示符 atomgit@pod-a94f8701860f4700b161b00e290de466:~$), 仅展示日志, 不证明服务器身份:

生成命令:
npm --prefix .opencode/skills/npu-adapt-skills/scripts install
node .opencode/skills/npu-adapt-skills/scripts/render_xterm_evidence.mjs --manifest working/evidence.json --output-dir submission/assets --style rawpython .opencode/skills/npu-adapt-skills/scripts/inspect_model.py model_snapshot --model-name ibm-research/test-ttm-v1
python .opencode/skills/npu-adapt-skills/scripts/check_npu.py
python inference.py
python .opencode/skills/npu-adapt-skills/scripts/validate_submission.py submission