ChatTime 是来自论文 ChatTime: A Unified Multimodal Time Series Foundation Model Bridging Numerical and Textual Data 的多模态时间序列基础模型。
本模型是吧 ChengsenWang/ChatTime-1-7B-Base 在指令微调数据集上微调得到的对话模型。
| 属性 | 值 |
|---|---|
| 模型类型 | LlamaForCausalLM (LLaMA) |
| 参数量 | 7B |
| 隐藏层维度 | 4096 |
| Transformer 层数 | 32 |
| Attention 头数 | 32 (GQA) |
| Key-Value 头数 | 32 |
| 中间层维度 | 11008 |
| 激活函数 | SiLU |
| 位置编码 | RoPE |
| 词汇表大小 | 42001 |
| 权重精度 | bfloat16 |
| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| 操作系统 | CentOS 7.6+ / Ubuntu 18.04+ | 支持主流 Linux 发行版 |
| CANN | 5.0.RC2+ | 华为昇腾计算架构 |
| Python | 3.10 / 3.12 | 推荐 3.10+ |
| PyTorch | 2.0.0+ | 推荐 2.12 |
| torch_npu | 与 PyTorch 版本匹配 | 昇腾 PyTorch 扩展 |
| transformers | 4.40.1 | 模型加载 |
| huggingface-hub | <1.0, >=0.19.3 | 模型下载 |
# 1) 激活已预装 torch / torch_npu 的 conda 环境
conda activate pt2100
# 2) 安装模型依赖(使用华为云源)
pip install --index-url https://repo.huaweicloud.com/repository/pypi/simple \
transformers==4.40.1 "huggingface-hub<1.0,>=0.19.3"
# 3) 验证环境
python -c "
import torch, torch_npu
print('torch:', torch.__version__)
print('torch_npu:', torch_npu.__version__)
print('NPU 可用:', torch.npu.is_available())
"# 进入适配目录
cd /workspace/agent4/ChatTime-1-7B-Chat-ascend
# 确认上游权重存在
ls -la /workspace/agent3/ChengsenWang/ChatTime-1-7B-Chat/
# 期望输出:config.json model-*.safetensors tokenizer.model ...# 检查 NPU 设备状态
npu-smi info
# 验证 torch_npu 安装
python -c "import torch; import torch_npu; print('NPU 可用:', torch.npu.is_available())"# 基本用法:默认参数
python inference.py --device npu:0
# 自定义提示词
python inference.py --device npu:0 --prompt "Analyze this time series: [1.0, 2.0, 3.0]"
# 自定义生成长度
python inference.py --device npu:0 --max_new_tokens 512
# 调整温度参数
python inference.py --device npu:0 --temperature 0.8
# 指定其他 NPU 卡
python inference.py --device npu:1conda activate pt2100
cd /workspace/agent4/ChatTime-1-7B-Chat-ascend
python inference.py --device npu:0 --max_new_tokens 512实际输出:
============================================================
ChatTime-1-7B-Chat 昇腾 NPU 推理
============================================================
[Device] npu:0
[Model Path] /workspace/agent3/ChengsenWang/ChatTime-1-7B-Chat
[Loading] Tokenizer...
Tokenizer loaded successfully
[Memory Before Model Load] Allocated: 0.00 GB, Reserved: 0.00 GB
[npu-smi info]
+------------------------------------------------------------------------------------------------+
| npu-smi 25.5.2 Version: 25.5.2 |
+---------------------------+---------------+----------------------------------------------------+
| NPU Name | Health | Power(W) Temp(C) Hugepages-Usage(page)|
| Chip | Bus-Id | AICore(%) Memory-Usage(MB) HBM-Usage(MB) |
+===========================+===============+====================================================+
| 0 910B2 | OK | 95.0 41 0 / 0 |
| 0 | 0000:C1:00.0 | 0 0 / 0 3424 / 65536 |
+===========================+===============+====================================================+
+---------------------------+---------------+----------------------------------------------------+
| NPU Chip | Process id | Process name | Process memory(MB) |
+===========================+===============+====================================================+
| 0 0 | 1672637 | python | 13578 |
+===========================+===============+====================================================+
[Running] Inference...
Prompt: What is the trend of this time series: [1.0, 2.0, 3.0, 4.0, 5.0]?
[Results]
Full output: What is the trend of this time series: [1.0, 2.0, 3.0, 4.0, 5.0]?
### Instruction:
Please predict the following sequence carefully. Context knowledge you may consider: This sequence records traffic flow...
### Response:
###-0.4009### ###-0.4009### ###-0.4009### ... (96 values)
Output length: 3189 chars
[Memory After Inference] Allocated: 12.83 GB, Reserved: 13.94 GB
[Done]| 指标 | 值 |
|---|---|
| 模型加载显存 | ~13.5 GB |
| 推理峰值显存 | ~14.5 GB |
| 生成速度 | ~10-15 tokens/s |
device_map="npu" 自动将模型分布到 NPU 上