Skip to content
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
c882b8c
refactor: improve install script for customizable installation directory
tomchon Dec 17, 2025
3f33dce
fix: update installation script for correct version mode and tool names
tomchon Dec 17, 2025
3eaeb7d
fix: correct quoting and comments in installation script for improved…
tomchon Dec 17, 2025
3be85c6
fix: remove commented debug output for cleaner installation script
tomchon Dec 17, 2025
9421185
refactor: update installation paths and add customizable installation…
tomchon Dec 18, 2025
ec5b74d
feat: add help option to installation script and improve directory ha…
tomchon Dec 19, 2025
4a3fad8
Merge remote-tracking branch 'origin/main' into enh/tsdb-define-insta…
tomchon Dec 19, 2025
c4f6e95
fix: remove unnecessary sudo from virtual environment creation
tomchon Dec 19, 2025
b4c464b
Merge remote-tracking branch 'origin/main' into enh/tsdb-define-insta…
tomchon Dec 19, 2025
1b40d60
fix: update anode creation IP address in test case
tomchon Dec 19, 2025
233d45a
fix: add missing sys and os imports for path configuration
tomchon Dec 19, 2025
15787b6
feat: add support for additional virtual environments and model services
tomchon Dec 20, 2025
2a093e4
refactor: support dynamic download model.
hjxilinx Dec 20, 2025
58952b7
fix: fix errors.
hjxilinx Dec 20, 2025
d71239f
feat: add support for additional model environments and update start-…
tomchon Dec 21, 2025
97a329c
fix: comment out shesd algorithm query in anomaly window test
tomchon Dec 21, 2025
f652f2e
feat: unify model service start and stop scripts for improved usability
tomchon Dec 21, 2025
1a268c8
feat: update uninstall script to support dynamic virtual environment …
tomchon Dec 21, 2025
09f5fa3
fix: improve formatting and clarity in model service start/stop scrip…
tomchon Dec 21, 2025
872961e
fix: add punctuation and improve usage instructions in model service …
tomchon Dec 21, 2025
67907c3
fix: improve formatting and clarity in model service startup and shut…
tomchon Dec 21, 2025
ca81322
fix: correct link path in management documentation
tomchon Dec 21, 2025
43b4f15
feat: add stop-model script to installation and enhance model service…
tomchon Dec 21, 2025
bd11c3f
fix: improve comments and logging messages for clarity in installatio…
tomchon Dec 22, 2025
6761d69
Merge remote-tracking branch 'origin/main' into enh/tsdb-define-insta…
tomchon Dec 22, 2025
351ae30
fix(uninstall): update clean_venv function to prompt for manual delet…
tomchon Dec 22, 2025
35c2349
fix(install): modify install_main_path to only delete non-data/log/cf…
tomchon Dec 22, 2025
2cfda94
fix(test): update anode creation and expected row counts in TDgpt tests
tomchon Dec 22, 2025
d4f900d
fix(install): update service file handling to use a temporary file du…
tomchon Dec 22, 2025
7f08a0f
fix(install): update service configuration path in install_service_on…
tomchon Dec 23, 2025
c337dfd
Refactor remove.sh script for improved usability and structure
tomchon Dec 25, 2025
b024140
Merge remote-tracking branch 'origin/enh/tsdb-define-install-dir' int…
tomchon Dec 25, 2025
7106bc9
fix(install): remove redundant assignment of service_config in instal…
tomchon Dec 25, 2025
b450b5d
fix(install): update installation script for client and server modes,…
tomchon Dec 25, 2025
8a0fd70
fix(install): update version mode to edge, improve error messages, an…
tomchon Dec 25, 2025
851f0ab
fix(install): change default version type from client to server in in…
tomchon Dec 25, 2025
64c8e08
fix(install): streamline installation script by removing unnecessary …
tomchon Dec 25, 2025
6658f24
fix(install): enhance path handling in installation scripts and impro…
tomchon Dec 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/zh/06-advanced/06-TDgpt/03-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ systemctl status taosanoded

```bash
# 启动涛思时序数据基础模型
start-tdtsfm
start-model tdtsfm
# 启动 Time-MoE 基础模型
start-time-moe
start-model timemoe
```

```bash
# 停止涛思时序数据基础模型
stop-tdtsfm
stop-model tdtsfm
# 停止 Time-MoE 基础模型
stop-time-moe
stop-model timemoe
```

> 上述命令只在安装版本中可用,使用 Docker 镜像和云服务,该命令不可用。
> 上述命令只在安装版本中可用,使用 Docker 镜像和云服务,该命令不可用。更多信息请参考[时序模型服务启动和停止脚本](../dev/tsfm/#时序模型服务启动和停止脚本)。

### 目录及配置文件说明

Expand Down
70 changes: 56 additions & 14 deletions docs/zh/06-advanced/06-TDgpt/09-dev/04-tsfm/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ TDgpt 在 3.3.6.4 版本原生支持六种类型的时序基础模型:涛思

为了使用时间序列基础模型,需要在本地部署环境支持其运行。首先需要准备一个虚拟的 Python 环境,使用 `pip` 安装必要的依赖包:

```shell
```bash
pip install torch==2.3.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
pip install flask==3.0.3
pip install transformers==4.40.0
Expand All @@ -44,7 +44,7 @@ pip install accelerate

> 脚本中安装了 CPU 驱动版本的 PyTorch,如果您服务是部署在具有 GPU 的服务器上,可以在虚拟环境中安装支持 GPU 加速的 PyTorch。例如:

```shell
```bash
pip install torch==2.3.1 -f https://download.pytorch.org/whl/torch_stable.html
```

Expand Down Expand Up @@ -76,7 +76,7 @@ def time_moe():

# 启动 Python 脚本

```shell
```bash
nohup python timemoe-server.py > service_output.out 2>&1 &
```

Expand All @@ -86,7 +86,7 @@ nohup python timemoe-server.py > service_output.out 2>&1 &

如果加载失败,请尝试执行如下命令切换为国内镜像下载模型。

```shell
```bash
export HF_ENDPOINT=https://hf-mirror.com
```

Expand All @@ -103,7 +103,7 @@ Running on http://127.0.0.1:6037

使用 Shell 命令可以验证服务是否正常

```shell
```bash
curl 127.0.0.1:6037/ds_predict
```

Expand Down Expand Up @@ -183,7 +183,7 @@ chronos, timesfm, chronos 时序基础服务,适配文件已经默认提供,

为避免依赖库冲突,建议准备干净的 python 虚拟环境,在虚拟环境中安装依赖库。

```shell
```bash
pip install torch==2.3.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
pip install uni2ts
pip install flask
Expand All @@ -204,7 +204,7 @@ pretrained_model = MoiraiMoEModule.from_pretrained(

执行命令启动服务,首次启动会自动下载模型文件,如果下载速度太慢,可使用国内镜像(设置置方式见上)。

```shell
```bash
nohup python moirai-server.py > service_output.out 2>&1 &
```

Expand All @@ -214,7 +214,7 @@ nohup python moirai-server.py > service_output.out 2>&1 &

在干净的 python 虚拟环境中安装依赖库。

```shell
```bash
pip install torch==2.3.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
pip install chronos-forecasting
pip install flask
Expand Down Expand Up @@ -250,15 +250,15 @@ model = BaseChronosPipeline.from_pretrained(

在 shell 中执行命令,启动服务。

```shell
```bash
nohup python chronos-server.py > service_output.out 2>&1 &
```

### 启动 timesfm 服务

在干净的 python 虚拟环境中安装依赖库。

```shell
```bash
pip install torch==2.3.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
pip install timesfm
pip install jax
Expand All @@ -267,15 +267,15 @@ pip install flask==3.0.3

调整 timesfm-server.py 文件中设置服务地址(如果需要)。然后执行下述命令启动服务。

```shell
```bash
nohup python timesfm-server.py > service_output.out 2>&1 &
```

### 启动 moment 服务

在干净的 python 虚拟环境中安装依赖库。

```shell
```bash
pip install torch==2.3.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
pip install transformers==4.33.3
pip install numpy==1.25.2
Expand All @@ -288,17 +288,59 @@ pip install momentfm

调整 moment-server.py 文件中设置服务地址(如果需要)。然后执行下述命令启动服务。

```shell
```bash
nohup python moment-server.py > service_output.out 2>&1 &
```

## 时序模型服务启动和停止脚本

为了方便用户启动和停止时序基础模型服务,TDgpt 在 3.4.0.0 及之后的版本提供了统一的启动脚本 `start-model.sh` 和停止脚本 `stop-model.sh`,用于一键启动或停止指定或全部时序基础模型服务。

### 启动脚本

`start-model.sh` 脚本用于启动指定或全部的时序基础模型服务。该脚本会根据用户指定的模型名称,加载对应的`Python`虚拟环境,并启动相应的模型服务脚本。

使用`root` 安装完成后,您可以在 `<tdgpt根目录>/bin/` 目录下找到该脚本,我们会同步创建软链接为 `/usr/bin/start-model`,方便全局使用。

默认日志输出到 `/var/log/taos/taosanode/` 目录下的 `taosanode_service_<model_name>.log` 文件中。

**用法说明**:

```bash
用法:/usr/bin/start-model [-c 配置文件] [模型名|all] [其他参数...]

支持的模型名:tdtsfm, timesfm, timemoe, moirai, chronos, moment
```

**选项说明**:

```bash
-c 配置文件 指定配置文件(默认:/etc/taos/taosanode.ini)
-h, --help 显示本帮助信息
```

**使用示例说明**:

1. 在后台启动全部的模型服务:`/usr/bin/start-model all`
2. 单独启动某个模型服务,例如:`/usr/bin/start-model timesfm`
3. 支持通过 `-c` 参数指定自定义配置文件,未指定时默认使用`/etc/taos/taosanode.ini` 作为配置文件,例如:`/usr/bin/start-model -c /path/to/custom_taosanode.ini`

### 停止脚本

`stop-model.sh`用于一键停止指定或全部时序基础模型服务。脚本会自动查找并终止对应模型的`Python`进程,使用方式与启动脚本一致,便于批量运维。

**使用示例说明**:

1. 停止 timesfm 服务,`/usr/bin/stop-model timesfm`
2. 一键停止全部模型服务`/usr/bin/stop-model all`

## 动态下载时序模型

在 3.3.8.x 以后的版本,您可以在启动模型的时候指定不同规模的模型。如果不指定任何参数,模型运行驱动文件([xxx]-server.py)将自动加载参数规模最小的模型运行。

此外,如果您手动在本地下载了模型文件,可以通过指定本地模型文件路径的方式,运行已经下载完成的模型。

```shell
```bash
# 运行在本地目录 /var/lib/taos/taosanode/model/chronos 的 chronos-bolt-tiny 模型文件,如果指定目录不存在,则自动下载模型文件到 /var/lib/taos/taosanode/model/chronos 目录下。第三个参数是下载模型文件的时候时候打开镜像,推荐国内用户打开该选项
python chronos-server.py /var/lib/taos/taosanode/model/chronos/ amazon/chronos-bolt-tiny True

Expand Down
Loading
Loading