TimeMoE-200M is a 200M-parameter Mixture-of-Experts (MoE) time-series foundation model from the paper Time-MoE: Billion-Scale Time Series Foundation Models with Mixture of Experts. Architecture: TimeMoeForPrediction, hidden_size 768, 12 layers, 12 attention heads, 8 experts (top-k 2) + shared expert, intermediate 3072, RoPE theta 10000, max positions 4096, input_size 1 univariate, horizon_lengths [1, 8, 32, 64], activation silu, RMSNorm eps 1e-6. Weight model.safetensors 906,450,104 bytes (864.5 MB), dtype bfloat16 in checkpoint, executed in float32 for high CPU-NPU consistency. Licence apache-2.0. Pipeline tag time-series-forecasting. Paper: https://arxiv.org/abs/2409.16040, code: https://github.com/time-moe/time-moe .
Original weight URL: https://huggingface.co/Maple728/TimeMoE-200M
GitCode NPU repository: this model repository (public, type=model, topics: NPU, Ascend, Ascend910).
forecasting (point prediction, univariate).working/input.csv (provided, 2500 rows, sha256 aa5efe0121b7cc098db1a169ed38f9878681ef14a93c85d54a618fd073048899), columns timestamps, open, high, low, close, volume, amount. Time column timestamps (ISO, sorted, no invalid/duplicate).close (float64, no missing). Other OHLCV columns available but model is univariate; validation uses close only.context_length 512 (first 512 rows, 2024-06-18 11:15 -> 2024-07-03 09:50), prediction_length 8 (corresponding to horizon 8 head). Axis order strictly [batch, seq_len] (input_size 1, no channel permute); for API shape [1, 512] or [1, 512, 1] equivalent, validated both.(x - mean)/std on context window; mean 10.936504, std 0.166452, min 10.67 max 11.35 for the validated window. Forecast denormalized pred * std + mean. Scaling parameters saved with output (mean/std in logs).[8] float32 denormalized (close price), also full logits [1, 512, 8] normalized (last token's 8 values are used as forecast).torch.npu.is_available()==True, device npu:0 Ascend910_9362, device count 2AutoModelForCausalLM.from_pretrained(local_dir, trust_remote_code=True, dtype=torch.float32) then model.to("npu:0"), all compute tensors explicitly to("npu:0"), torch.npu.synchronize() before/after timing, use_cache=False to avoid DynamicCache API mismatch in transformers 4.57 (original code expects 4.40; use_cache=False gives identical accuracy with float32 error <2e-6)./tmp/TimeMoE-200M (snapshot_download to that dir), fallback via huggingface_hub.snapshot_download if not present.pip install -r requirements.txt
# requires: torch, torch_npu, transformers, huggingface_hub, numpy, pandas, safetensorsDefault command (verified on 910B):
python inference.py/tmp/TimeMoE-200M (864 MB) else downloads via HF mirror.npu:0, reports model param device, input NPU device, output device.model(input_ids=x, max_horizon_length=8, use_cache=False); picks lm_head index for horizon 8; output [1,512,8], forecast logits[0,-1,:].(1, 512, 8) device npu:0 dtype float32[11.27, 11.27, 11.27, 11.27, 11.26][2.00355, 2.00355, 2.00355, 2.00355, 1.94348][-0.06576433, -0.07700579, -0.08654091, -0.10044055, -0.1159027, -0.12847261, -0.13859349, -0.14296186][10.925558, 10.923687, 10.922099, 10.919786, 10.917212, 10.91512, 10.913435, 10.912708]Cannot create tensor with interal format ... is harmless and appears on NPU MoE one_hot path; does not indicate fallback.use_cache=False:
python .opencode/skills/npu-adapt-skills/scripts/compare_outputs.py --cpu /tmp/timemoe_cpu_forecast.npy --npu /tmp/timemoe_npu_forecast.npy --task forecasting --atol 1e-4 --rtol 1e-3 (forecast [8])[1,512,8] also: max_abs 1.459e-04, mean 2.77e-06, passed true with same atol/rtolmodel(input_ids, max_horizon_length=8, use_cache=False) with synchronize.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, NPU inference, consistency, benchmark).assets/npu_device_call.png – npu-smi info + check_npu.py + param device logs, proving calls on npu:0.assets/model_result.png – default python inference.py full stdout (input/output preview, sync timing, SUCCESS).
Images are xterm.js rendered from logs; not simulated via Pillow/Matplotlib.

npu:0 only; multi-NPU not tested.use_cache=False used to avoid transformers 4.57 Cache API incompatibility (get_usable_length/get_max_length/seen_tokens removed); accuracy unaffected (float32 error <2e-6), but caching speed-up disabled (≈60ms vs cached would be faster with proper 4.40 transformers). With transformers 4.40, use_cache=True would be valid.