ant-intl/Falcon-TST_Large 是蚂蚁集团开源的 Falcon-TST 大规模时间序列基础模型(MoE 架构 + 多分块 patch tokenizer)。
patch_size_list=[120,96,64,36], shared_patch_size=32)[batch, seq_len, channels]torch_npu), 全程不使用 GPU 专有设备调用, 模型与输入 Tensor 全部运行在 npu:0。init_npu() 在入口用 try-except 捕获异常:
torch_npu import 失败 → 打印清晰中文错误并优雅退出torch.npu.is_available() == False 或 device_count() < 1 → 同样优雅退出HF_ENDPOINT=https://hf-mirror.com) 自动下载, 本地缓存优先:
./model_weights/ant-intl__Falcon-TST_Large (模型全名 / 换成 __)snapshot_downloadtransformers.AutoModel.from_pretrained(<本地目录>, trust_remote_code=True, local_files_only=True)
(模型为 custom_code, 本地缓存目录含 configuration_FalconTST.py / modeling_FalconTST.py,
auto_map 将 AutoModel 映射到 FalconTSTForPrediction)model.predict(time_series, forecast_horizon=H, revin=True)
[batch, seq_len] 或 [batch, seq_len, channels][batch, H] 点预测序列mask_pad_value=255.0 或截断model-00001-of-00002.safetensors (3.5GB) + model-00002-of-00002.safetensors (1.2GB) + model.safetensors.index.json 等requirements.txt。pip install torch torch-npu
pip install transformers>=4.40 huggingface-hub safetensors einops numpy
pip install fastapi uvicornpython3 inference.py --text "[50.0,51.7,53.1,54.1,...]" --horizon 96--text: 历史时间序列 JSON 数值数组--horizon: 预测长度 (1-720), 默认 96输出为推理 JSON, 含 device(npu:0)、lookback、horizon、forecast(点预测序列)。
uvicorn inference:app --host 0.0.0.0 --port 8012curl -s -X POST http://127.0.0.1:8012/predict \
-H 'Content-Type: application/json' \
-d '{"text":[50.0,51.7,53.1,54.1,...],"horizon":96}'返回推理 JSON; GET / 可查看服务信息与 /docs。
[50.0, 51.7, 53.1, ...]; 长度不足 2880 时自动左补掩码, 超出自动截取最近 2880。forecast 为未来 horizon 步的点预测序列 (模型原生为单点概率预测)。model_weights/ant-intl__Falcon-TST_Large/
├── config.json
├── configuration_FalconTST.py
├── modeling_FalconTST.py
├── model-00001-of-00002.safetensors
├── model-00002-of-00002.safetensors
└── model.safetensors.index.jsonassets/agent_workflow.png — NPU 环境部署、依赖安装、任务启动日志assets/npu_device_call.png — 命令行 python 推理运行 (真实 stdout, 含 NPU 设备信息)assets/model_result.png — FastAPI curl 上传输入返回推理 JSON (真实 HTTP 响应)