Tiny Time Mixer (TTM) Research R2 (ibm-research/ttm-research-r2) is a compact 3.3 MB (3444752 bytes) pre-trained time-series foundation model open-sourced by IBM Research (NeurIPS 2024). TTM introduces tiny 1M+ param forecasters with Adaptive Patching and channel-independent mixing, outperforming billion-param baselines in zero/few-shot forecasting. This repository provides Ascend 910B (npu:0) adaptation for point forecasting with context_length=512 → prediction_length=96, d_model=192, num_layers=2, patch_length=64, patch_stride=64, num_patches=9, resolution_prefix_tuning=True (frequency prefix). Original research checkpoint (branch main, 512-96-ft-r2) supports minutely/hourly resolutions (e.g., 10min, 15min, 1h). It requires freq_token prefix (hourly=7) and past_values [B,T,C]. License cc-by-nc-sa-4.0. Paper: https://arxiv.org/pdf/2401.03955.pdf . Original weight URL: https://huggingface.co/ibm-research/ttm-research-r2 . GitCode NPU repository: this model repository (public, type=model, topics: NPU, Ascend, Ascend910).
forecasting point prediction (no probabilistic quantiles). Architecture: TinyTimeMixerForPrediction.past_values [batch, context_length, num_input_channels] float32, context_length=512, num_input_channels=1 (validated; multivariate via same channel dimension supported), freq_token [batch] long, token 7 = hourly (h mapping, vocab size 8, 0=oov,1=min,2=2min,3=5min,4=10min,5=15min,6=30min,7=h), plus optional past_observed_mask. resolution_prefix_tuning=True mandates freq_token, otherwise Exception: Expecting freq_token.t=0..511, c0=sin(5*2πt/512+phase)+0.02*randn per batch (phase 0,0.5), shape [2,512,1], mean 0.0006 std 0.7064, preview batch0 first5 [0.00993,0.05855,0.13536,0.21350,0.23829]. Frequency token [7,7] hourly. This matches supported minutely/hourly regime vs random noise. Axis order strictly [B,T,C] (not [B,C,T]); no transpose without code change.prediction_outputs [batch, prediction_length, num_input_channels] float32, shape [2,96,1], mean 0.0339 std 0.148, preview batch0 first5 [-0.07937,-0.11651,-0.13515,-0.14057,-0.15108] (NPU). No inverse scaling inside model (external TimeSeriesPreprocessor std scaling recommended for real data, but synthetic uses raw values for consistency test).TimeSeriesPreprocessor); validation uses raw sine wave to avoid fitted state mismatch. No missing value imputation needed; past_observed_mask defaults to ones_like(past_values) on NPU.batch=2, seq 512 -> horizon 96, C=1, dtype float32, freq_token=7./tmp/pip-req-build-4ikge4_l), safetensors.torch.npu.is_available()==True, device npu:0 Ascend910_9362, device count 2, npu-smi OK, 64GB HBM, temp 48C.torch.npu.synchronize() used for timing, no CPU fallback (verified param/output on npu:0).TinyTimeMixerForPrediction.from_pretrained(local_dir) then model.to("npu:0"), all tensors (past_values, freq_token) explicitly moved to npu:0, toolkit stub avoids datasets/pyarrow heavy import.pip install -r requirements.txt
# requires: torch, torch_npu, transformers, huggingface_hub, numpy, safetensors, granite-tsfm (from git+https://github.com/ibm-granite/granite-tsfm.git)
# CANN 8.5.1 and Ascend driver must be present for npu:0Default command (verified on 910B):
python inference.pyworking/models/ttm-research-r2 if exists else ~/.cache/ttm-research-r2 via snapshot_download(repo_id="ibm-research/ttm-research-r2") (needs HF_ENDPOINT). No remote_code.TinyTimeMixerForPrediction, moves to npu:0, reports first param device/dtype, input summary (shape/mean/preview), freq_token shape/values, output summary (shape/device/dtype/mean/std), synchronized elapsed time, final SUCCESS iff param/device is npu:0 and output on npu:0.[2,512,1] past, [2] freq_token, output [2,96,1] on npu:0, inference time ~0.005s.(2, 96, 1) device npu:0 dtype float32[0.00993,0.05855,0.13536,0.21350,0.23829], mean 0.0006 std 0.7064, freq_token [7,7][-0.07937,-0.11651,-0.13515,-0.14057,-0.15108][-0.07951,-0.11659,-0.13522,-0.14061,-0.15109] (diff 1.4e-04)torch.npu.synchronize()), weight 3.3 MB, param device npu:0, fallback_detected False.python .opencode/skills/npu-adapt-skills/scripts/compare_outputs.py --cpu working/cpu_r2.npy --npu working/npu_r2.npy --task forecasting --atol 1e-3 --rtol 1e-3atol 1e-3 rtol 1e-3 generous but still tight; mean error 9.9e-05 far below. Task forecasting (point prediction) compares raw forecast tensors. No argmax/quantile monotonic needed.granite-tsfm stub, same from_pretrained(local_dir) weight.torch.npu.synchronize() each side), batch 2 windows:
torch.npu.memory_allocated), weight 3.3 MB, dtype float32, context 512, horizon 96, patch 64.model(past_values,freq_token)); RevIN/patching internal to model is included.npu:0 only, no multi-NPU.Three PNGs generated by xterm.js from real logs via node scripts/render_xterm_evidence.mjs --style raw (prompt atomgit@pod-a94f8701860f4700b161b00e290de466:~$):
assets/agent_workflow.png – workflow (env check, model fetch, CPU/NPU inference, consistency, bench).assets/npu_device_call.png – npu-smi info + check_npu.py + param device logs proving npu:0.assets/model_result.png – default python inference.py full stdout (input/output preview, sync time, SUCCESS).
Images are xterm.js rendered from logs; not simulated via Pillow/Matplotlib.

context_length/prediction_length and may need freq_token adjustment (still minutely/hourly).resolution_prefix_tuning=True mandates freq_token; missing token raises Expecting freq_token – inference.py supplies 7.npu:0 only; BF16/FP16 not verified (FP32 only); NPU kernel warning Cannot create tensor with interal format while allow_internel_format=False harmless but included.