Bingggooo/Maple728-TimeMoE-50M-NPU
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

Maple728/TimeMoE-50M - NPU

#NPU

  • Model: Maple728/TimeMoE-50M (https://huggingface.co/Maple728/TimeMoE-50M), local snapshot /tmp/TimeMoE-50M revision cached 2026-08-20
  • Task: TimeSeries Forecasting (univariate point prediction)
  • Architecture: TimeMoeForPrediction (MoE, hidden 384, 12 layers, 8 experts / 2 per token, intermediate 1536, 12 heads, max_position 4096)
  • Weight: model.safetensors 217MB (226,760,264 bytes), torch_dtype bfloat16 config but inference uses float32
  • Horizon: supports [1,8,32,64], validated horizon 32 with context 512
  • Input/Output: [B, T] where T=context (512), output [B, T+H] (544), channel 1, univariate series
  • Backend: transformers AutoModelForCausalLM.from_pretrained(..., trust_remote_code=True) + torch_npu on npu:0

Data Contract

  • Source: synthetic traceable univariate series mimicking ETTh seasonality + trend: series[t] = 0.5*sin(2πt/24)+0.3*sin(2πt/96)+0.01*t + N(0,0.1), length 600, seed 42, np.random.RandomState(42)
  • Slice: last context + pred_len = 544 points, inp = series[-544:-32] (512 context), forecast horizon 32
  • Preprocessing: z-score per window using context stats: mean = inp.mean() = 3.100524, std = inp.std()+1e-5 = 1.538619, inp_norm = (inp-mean)/std, SHA256 prefix of inp_norm = 3d0869b35ae00ea8
  • Schema preservation: axis order [B,T], dtype float32, no transpose, scaling method and stats persisted in meta.json style logs, channel=1
  • Preprocessing timing: included in end-to-end latency measurement for realistic series/s; pure model generate latency reported separately after torch.npu.synchronize()
  • No training (fit) required; model is zero-shot forecasting

Environment

  • Pod: Atlas 800 with Ascend910 (910B, 9362), 2 NPUs visible, using npu:0
  • npu-smi info: Ascend910, Health OK, HBM 65536 MB, AICore utilization captured in benchmark
  • torch 2.9.0+cpu, torch_npu 2.9.0.post1+gitee7ba04, transformers 4.40.1, numpy 1.26.4, ASCEND_TOOLKIT_HOME /usr/local/Ascend/cann-8.5.1
  • torch.npu.is_available()==True, device_count=2, device_name Ascend910_9362
  • Single-card memory: weight 217MB + runtime < 4GB, safely fits 32GB HBM

Installation

pip install -r requirements.txt

Model snapshot will be downloaded automatically by transformers if /tmp/TimeMoE-50M not present; for offline verification download via:

hf download Maple728/TimeMoE-50M --local-dir /tmp/TimeMoE-50M

NPU Inference

Default command (real NPU path, no fallback):

python inference.py

What it does:

  • Loads same weights on npu:0 (model.to("npu:0"), 463/463 params on NPU, verified first_param.device==npu:0)
  • Constructs deterministic synthetic input [1,512] on npu:0, reports input shape/dtype/device/sample
  • Calls model.generate(seq, max_length=544) with torch.npu.synchronize() before/after timing
  • Verifies output device npu:0 (fails if fallback), prints output shape, forecast tail, finite check, and throughput
  • Warmup first run 0.3250s (includes compile), stable run 0.0650s

Real Results

From python inference.py on npu:0 (float32):

  • Input sample [−1.521775, −1.543307, −1.572856, −1.612721, −1.794189]
  • Output shape [1,544] on npu:0
  • Forecast normalized tail [0.91513115, 0.92191237, 0.92960113, 0.95438886, 1.02315307]
  • Forecast denorm tail [4.50856256, 4.51899624, 4.53082657, 4.56896496, 4.67476702]
  • Finite: true

CPU baseline (same weights/input/seed/dtype, float32):

  • CPU elapsed 1.2344s, forecast tail [0.91513002, 0.92191082, 0.92959929, 0.95438600, 1.02315009] (denorm [4.50856066, 4.51899385, 4.53082371, 4.56896067, 4.67476273])

SHA256 prefix of normalized input 3d0869b35ae00ea8 matches across runs.

Consistency

Saved raw arrays and compared with scripts/compare_outputs.py:

python scripts/compare_outputs.py --cpu working/timemoe-50M/cpu_forecast.npy --npu working/timemoe-50M/npu_forecast.npy --task regression --atol 1e-4 --rtol 1e-3
# {"cpu_shape":[32],"npu_shape":[32],"finite":true,"max_abs_error":2.98e-06,"mean_abs_error":1.38e-06,"passed":true}

python scripts/compare_outputs.py --cpu working/timemoe-50M/cpu_output.npy --npu working/timemoe-50M/npu_output.npy --task regression --atol 1e-4 --rtol 1e-3
# {"cpu_shape":[1,544],"npu_shape":[1,544],"finite":true,"max_abs_error":2.98e-06,"mean_abs_error":8.13e-08,"passed":true}
  • Task metric regression with thresholds atol=1e-4, rtol=1e-3 (FP32, MoE one_hot custom op note: allow_internal_format=False warning but numerically negligible)
  • No fallback: out.device.type==npu asserted, 463/463 params on NPU
  • Single-window smoke consistency; not a full dataset benchmark

Performance

NPU npu:0 benchmark (synchronized, batch 1, [1,512] -> [1,544], float32):

  • Warmup 3: 0.3188s, 0.0630s, 0.0618s
  • Stable 10 runs: avg 0.0609s, min 0.0602s, max 0.0617s, p50 0.0609s, p90 0.0611s, p95 0.0614s, throughput 16.43 windows/s
  • First compile (fresh model) 0.0632s, second stable 0.0610s
  • HBM during benchmark ~3730 / 65536 MB on NPU 0
  • CPU reference single run 1.2321s → NPU speedup ~20.2x

Preprocessing (series generation + z-score) excluded from model latency; end-to-end including preprocessing ~same as model latency since preprocessing <1ms.

Evidence

Three PNGs generated by scripts/render_xterm_evidence.mjs --style raw from real logs (xterm.js white on dark gray, prompt atomgit@pod-a94f8701860f4700b161b00e290de466:~$ is display-only, not host proof).

  • Agent Workflow – reconnaissance, download, inspect, NPU check, baseline, NPU inference, compare, benchmark, validate.
  • NPU Device Call – npu-smi, torch_npu check, device name, param device/dtype, I/O device.
  • Model Result – python inference.py full output, schema, forecast, timing, SUCCESS.

Prompt used: atomgit@pod-a94f8701860f4700b161b00e290de466:~$ (display label, not server proof). Logs sanitized.

Limitations

  • Only validated horizon 32 with context 512 and synthetic data; other horizons [1,8,64] and real datasets (ETThm1, etc.) not yet covered but architecture supports them
  • Point prediction only; quantiles not applicable to TimeMoE
  • FP32 validated; BF16/FP16 would be looser
  • Custom MoE one_hot kernel emits allow_internal_format=False warning on NPU but remains correct and within tolerance
  • Single-window consistency, not full ETTh benchmark ranking

References

  • Weight URL: https://huggingface.co/Maple728/TimeMoE-50M
  • GitCode model repo: (pushed after validation, type model, public, topics NPU Ascend Ascend910)