###value### 时间序列 token,与自然语言统一在同一框架内处理。本模型为 Chat 版本,支持零样本时间序列预测、上下文引导预测与时间序列问答(bimodal 输入/输出)。
模型架构: LlamaForCausalLM(Llama-2 底座微调),32 层、hidden_size=4096;词表在原 Llama 词表基础上扩展 10001 个时间序列 token(###-10~10###,步长 0.0002),vocab_size=42001。
参数规模: 约 6.9B(model.safetensors 约 13GB)| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| Python | >= 3.10 | 推荐 3.11 |
| torch / torch_npu | 2.1.0+ | NPU 上需安装 torch_npu |
| transformers | >= 4.41 | LlamaForCausalLM 加载(随 libs 目录分发) |
| numpy | 最新版 | 序列离散化/反离散化 |
| sentencepiece | 最新版 | Llama tokenizer 分词器 |
| safetensors / huggingface_hub | 最新版 | 权重加载 |
| 昇腾驱动 | CANN 8.0.RC2+ | 推荐最新版 |
安装命令:
pip install --target /mnt/workspace/ChatTime-1-7B-Chat/libs -i https://pypi.tuna.tsinghua.edu.cn/simple "transformers>=4.41,<5" numpy sentencepiece# 检查 NPU 设备
npu-smi info
# 权重已就位
ls /home/developer/models/ChatTime-1-7B-Chat/ # config.json model-*.safetensors tokenizer.model 等
# 专属依赖已就位
ls /mnt/workspace/ChatTime-1-7B-Chat/libs # transformers 等依赖包PYTHONPATH=/mnt/workspace/ChatTime-1-7B-Chat/libs python3 inference.py --model_path /home/developer/models/ChatTime-1-7B-Chat| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| --model_path | str | /home/developer/models/ChatTime-1-7B-Chat | 本地权重目录 |
| --device | str | 自动(npu > cuda > cpu) | 推理设备 |
| --hist_len | int | 120 | 输入历史序列长度 |
| --pred_len | int | 16 | 预测长度(<=16 时单轮生成完成) |
| --num_samples | int | 4 | 采样条数,多条取中位数 |
| --output | str | assets/prediction.npy | 预测结果保存路径 |
输入:
PYTHONPATH=/mnt/workspace/ChatTime-1-7B-Chat/libs python3 inference.py --model_path /home/developer/models/ChatTime-1-7B-Chat输出:
[INFO] device = npu
[INFO] 模型加载完成 load_time=xx.xxs (params=69xxM)
[INFO] 推理完成 耗时/elapsed: x.xxx s (pred_shape=(16,), num_samples=4, device=npu)
[INFO] 预测统计 mean=x.xxxx std=x.xxxx min=x.xxxx max=x.xxxx
[RESULT] status=ok device=npu 耗时/elapsed: x.xxx s输入:
python3 inference.py --model_path /home/developer/models/ChatTime-1-7B-Chat --pred_len 8 --num_samples 8输出:
[INFO] 预测值前5步: [...],预测结果保存至 assets/prediction.npy


--model_path 加载(local_files_only=True),不访问网络;###value### 序列化 + Alpaca 指令模板)与官方 ForestsKing/ChatTime 仓库实现一致,已内置到 inference.py,无需额外下载官方代码;