docs/en/06-advanced/06-tdgpt/02-tutorial.md
import PkgList from "/src/components/PkgList";
Before installing TDgpt, review the system requirements and ensure that your container or machine meets the minimum specifications.
This section describes how to use TDgpt in Docker.
| Image | Models |
|---|---|
tdengine/tdgpt | TDtsfm v1.0 |
tdengine/tdgpt-full | TDtsfm v1.0 and Time-MoE |
Install Docker on your local machine. Then pull the image and startthe container as described in the following section.
Pull the latest TDgpt image:
docker pull tdengine/tdgpt:latest
You can specify a version if desired:
docker pull tdengine/tdgpt:{{VERSION}}
Start the container:
docker run -d \
-p 6035:6035 \
-p 6036:6036 \
tdengine/tdgpt:latest
:::note
From 3.3.7.5, the port number for TDgpt has changed from 6090 to 6035.
:::
Pull the latest TDgpt image:
docker pull tdengine/tdgpt-full:latest
You can specify a version if desired:
docker pull tdengine/tdgpt-full:{{VERSION}}
Start the container:
docker run -d -p 6035:6035 -p 6036:6036 -p 6037:6037 tdengine/tdgpt-full:latest
Note: TDgpt runs on TCP port 6035. The standard image also uses port 6036, and the full image uses port 6037.
TDgpt is a stateless analytics agent and does not persist data. It only saves log files to local disk.
Confirm that your Docker container is running:
docker ps
Enter the container and run the bash shell:
docker exec -it <container-name> bash
You can now run Linux commands and access TDengine.
You can try TDgpt with a free TDengine Cloud account. In TDengine Cloud, open DB Mart and enable access to the Time Series Prediction Analysis Dataset database. You can run TDgpt queries on the data contained in that database, for example: select forecast(val, 'algo=tdtsfm_1') from forecast.electricity_demand;
To use the analytics capabilities offered by TDgpt, you deploy an AI node (anode) in your TDengine TSDB cluster. You must deploy the anode on a Linux machine. The environment must meet the following requirements:
You can run the following commands to install Python 3.10 in Ubuntu.. If you already have a supported version of Python installed, skip this section.
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.10
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2
sudo update-alternatives --config python3
sudo apt install python3.10-venv
sudo apt install python3.10-dev
curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10
Add ~/.local/bin to the PATH environment variable in ~/.bashrc or ~/.bash_profile..
export PATH=$PATH:~/.local/bin
The Python environment has been installed. You can now install TDgpt.
sudo apt update
sudo apt install build-essential
Download the tar.gz package from the list:
<PkgList productName="TDengine TDgpt-OSS" platform="Linux-Generic" />This package contains the TDtsfm and Time-MoE foundation models for time series. Ensure that you have 16 GB of disk space available to store the models.
Open the directory containing the downloaded package and decompress it.
tar -zxvf tdengine-tdgpt-oss-{{VERSION}}-linux-x64.tar.gz
Decompress the file, open the directory created, and run the install.sh script:
cd tdengine-tdgpt-oss-{{VERSION}}-linux-x64
./install.sh
To prevent TDgpt from affecting Python environments that may exist on your machine, anodes are installed in a virtual environment. When you install an anode, a virtual Python environment is deployed in the /var/lib/taos/taosanode/venv/ directory. All libraries required by the anode are installed in this directory.
Note that this virtual environment is not uninstalled automatically by the rmtaosanode command. If you are sure that you do not want to use TDgpt on a machine, you can remove the directory manually.
The virtual Python environment for TDgpt is located in the /var/lib/taos/taosanode/venv/ directory. Once the environment is created, PiPy is used to install the Python dependencies for TDgpt.
This environment is not removed y the rmtaosanode command. You can remove it manually if desired.
Any algorithms or models that you create for TDgpt must be installed into this virtual environment using Pip.
You can run the rmtaosanode command to uninstall TDgpt.