MOMENT (A Family of Open Time-series Foundation Models) is a general-purpose time-series foundation model based on a T5-encoder backbone with patching + RevIN normalization. This repo adapts AutonLab/MOMENT-1-base (pre-trained reconstruction head) to run real zero-shot forecasting on a single Ascend 910B NPU (npu:0).
AutonLab/MOMENT-1-base (revision main)forecast_horizon=48)momentfm==0.1.4 MOMENTPipeline + T5EncoderModelAscend910_9362 (NPU), dtype torch.float32ETTh1.csv, date column + 7 value channels [HUFL, HULL, MUFL, MULL, LUFL, LULL, OT], 17420 rows, hourly, time-sorted, no missing values.f18de3ad269cef59bb07b5438d79bb3042d3be49bdeecf01c1cd6d29695ee066[batch, channel, time] (x_enc), context window L=512, forecast horizon H=48.L timesteps are used as context; the forecast never crosses the data boundary.short_forecast masks the final H timesteps and reconstructs them with the pre-trained head (no task-specific fine-tuning). RevIN normalization is applied inside the model and inverted on output.pip install -r requirements.txtpython inference.pyThe script checks torch.npu.is_available(), moves the model and every tensor to npu:0, runs the forecast, calls torch.npu.synchronize() for timing, and writes inference_result.json (exit 0 = success). Model weights are downloaded once via huggingface_hub (respecting HF_ENDPOINT) or loaded from --model-dir if provided.
Run on single npu:0 (Ascend910_9362), ETTh1 last-512 context, 48-step forecast:
{"device_name": "Ascend910_9362", "output_shape": [1, 7, 48], "elapsed_sec": 0.1424, "status": "PASS"}Sample forecast (OT channel, last 5 steps): [8.4383, 9.0451, 10.7153, 8.1603, 8.6551]
Same weights, input, preprocessing, seed and dtype (fp32) on CPU and NPU; raw forecast tensors compared.
| metric | value |
|---|---|
| task | regression (forecast tensor) |
| atol / rtol | 1e-4 / 1e-3 |
| max abs error | 1.001e-05 |
| mean abs error | 1.021e-06 |
| result | PASS |
batch=4, input [4, 7, 512], forecast_horizon=48, warmup 3, timed 10, torch.npu.synchronize() per round.
| metric | value |
|---|---|
| first run (compile) | 0.1360 s |
| avg | 0.0126 s |
| min / max | 0.0125 / 0.0127 s |
| p50 / p90 / p95 | 0.0126 / 0.0127 / 0.0127 s |
| throughput | 318.01 windows/s |
| peak NPU memory | 517.11 MB |
The three images below are rendered by xterm.js from the real captured logs of this adaptation run (workflow, device check, and default python inference.py).
| image | content |
|---|---|
assets/agent_workflow.png | recon, dataset inspect, model download, load, NPU inference, consistency, benchmark, submission validation |
assets/npu_device_call.png | npu-smi info, NPU availability, device name, parameter device/dtype, input/output tensor device |
assets/model_result.png | full default python inference.py output with schema/window summary, real forecast, sync timing and status |
inference.py downloads the dataset from the public ETDataset URL on first run; set --data to a local CSV to run fully offline.