#NPU — Falcon-TST Large time-series foundation model (MoE architecture) running real forecasting inference on Ascend 910 NPU (npu:0).
ant-intl/Falcon-TST_Large (revision at adaptation time)FalconTSTForPrediction — Mixture-of-Experts (MoE) with 4 patch tokenizers + shared expert, 2 MoE layers × 4 expert transformer layers, hidden_size=1024, 16 heads, 4 expertsAutoModel with trust_remote_code=True (official modeling_FalconTST.py / configuration_FalconTST.py)Falcon-TST is a large-scale time-series foundation model that combines a Mixture-of-Experts (MoE) architecture with multiple patch tokenizers. Each expert operates on a different patch size and each sample is routed (top-1) to one expert; a shared expert is always active. RevIN reversible instance normalization is applied before the transformer and reversed after forecasting. The predict(time_series, forecast_horizon) method produces an autoregressive multi-horizon forecast (multi_forecast_head_list = [24, 96, 336]).
This repository contains a self-contained inference.py that loads the official pretrained weights from a local directory and runs real NPU inference. No CUDA-only or flash-attention operators are required — the implementation maps onto standard PyTorch / torch_npu kernels.
Validation dataset: ETTh1 (Electricity Transformer Temperature, hourly, public, zhouhaoyi/ETDataset).
| Item | Value |
|---|---|
| Source | ETTh1.csv (public ETT dataset) |
| Rows | 17425 |
| Channels | 7 (HUFL HULL MUFL MULL LUFL LULL OT) |
| Context window | 2880 time steps |
| Forecast horizon | 336 time steps |
| Batch | 1 |
| Dtype | float32 input / output |
| Split | fixed contiguous window (rows 4000–4415), no shuffle |
| Preprocessing | RevIN applied inside the model on-device |
The dataset is real, traceable, and non-overlapping with respect to the forecast window (forecast never crosses the data boundary). Inference uses the same real series for both CPU and NPU runs.
npu:0pip install -r requirements.txt
# If torch_npu is not preinstalled, install the build matching your torch version, e.g.:
# pip install torch-npu==2.9.0Download the pretrained weights once and load them from the local directory (the repository does not bundle the ~5 GB checkpoint):
export HF_ENDPOINT=https://hf-mirror.com # optional, recommended in CN regions
huggingface-cli download ant-intl/Falcon-TST_Large --local-dir ./modelRun real inference on npu:0 (default command):
python inference.py --model-dir ./modelExample output (truncated):
device: npu:0 (npu_available=True, count=2)
model: FalconTST params=2,491,557,824
weights: first param device=npu:0 dtype=torch.float32
tensors: input (1, 2880, 7) torch.float32 npu:0
dataset: ETTh1 (real public series) seq_len=2880 horizon=336 channels=7
output: forecast (1, 336, 7) float32
metrics: MAE=1.9690 RMSE=3.2803 (vs true ETTh1 values)
status: OK device=npu:0 forecast=(1, 336, 7)Benchmark mode (>= 10 steady-state iterations):
python inference.py --model-dir ./model --benchmarknpu:0), fp32Both runs use identical weights, inputs, preprocessing, dtype (float32) and random seed, evaluated on the same ETTh1 window.
| Metric | Value |
|---|---|
| Forecast max abs error | 9.82e-5 |
| Forecast mean abs error | 7.69e-6 |
| Shape | (1, 336, 7) == (1, 336, 7) |
allclose (atol=1e-3, rtol=1e-2) | True |
The tiny max absolute error (≈1e-4) is attributable to different accumulation order across hardware; forecasts are numerically consistent between CPU and NPU.
Measured with torch.npu.synchronize() around every timed iteration; warmup=3, iters=10.
| Metric | Value |
|---|---|
| First run (graph compile + inference) | 70.6 ms |
| Avg inference | 71.4 ms |
| Min / Max | 70.1 / 75.4 ms |
| p50 / p90 / p95 | 70.7 / 74.0 / 74.7 ms |
| Throughput | ~14.0 windows/s |
| Peak NPU memory (allocated / reserved) | 10,864 / 11,240 MB |
Timing covers the full autoregressive 336-step forecasting forward pass on NPU. CSV loading and preprocessing are excluded from the timed region.
The following images were rendered by xterm.js from this run's real stdout/stderr logs (not fabricated screenshots):
assets/agent_workflow.png — environment check, model inspection, CPU baseline, NPU inference, consistency check and benchmark.assets/npu_device_call.png — npu-smi info + check_npu.py + model parameter device/dtype proof.assets/model_result.png — default python inference.py full output with data/schema summary, real forecast, metrics and final status.trust_remote_code=True to load its official remote code (modeling_FalconTST.py, configuration_FalconTST.py); review this code before execution.