Source Code Deployment
Environmental requirements
Startup Mode | CPU * MEM | GPU | Remark |
---|---|---|---|
Proxy model | 4C * 8G | None | Proxy model does not rely on GPU |
Local model | 8C * 32G | 24G | It is best to start locally with a GPU of 24G or above |
Download source code
Download DB-GPT
git clone https://github.com/eosphoros-ai/DB-GPT.git
Miniconda environment installation
- The default database uses SQLite, so there is no need to install a database in the default startup mode. If you need to use other databases, you can read the advanced tutorials below. We recommend installing the Python virtual environment through the conda virtual environment. For the installation of Miniconda environment, please refer to the Miniconda installation tutorial.
Create a Python virtual environment
python >= 3.10
conda create -n dbgpt_env python=3.10
conda activate dbgpt_env
# it will take some minutes
pip install -e ".[default]"
Copy environment variables
cp .env.template .env
Model deployment
DB-GPT can be deployed on servers with lower hardware through proxy model, or as a private local model under the GPU environment. If your hardware configuration is low, you can use third-party large language model API services, such as OpenAI, Azure, Qwen, ERNIE Bot, etc.
⚠️ You need to ensure that git-lfs is installed
● CentOS installation: yum install git-lfs
● Ubuntu installation: apt-get install git-lfs
● MacOS installation: brew install git-lfs
Proxy model
- Open AI
- Qwen
- ChatGLM
- WenXin
- Yi
Install dependencies
pip install -e ".[openai]"
Download embedding model
cd DB-GPT
mkdir models and cd models
git clone https://huggingface.co/GanymedeNil/text2vec-large-chinese
Configure the proxy and modify LLM_MODEL, PROXY_API_URL and API_KEY in the .env
file
# .env
LLM_MODEL=chatgpt_proxyllm
PROXY_API_KEY={your-openai-sk}
PROXY_SERVER_URL=https://api.openai.com/v1/chat/completions
# If you use gpt-4
# PROXYLLM_BACKEND=gpt-4
Install dependencies
pip install dashscope
Download embedding model
cd DB-GPT
mkdir models and cd models
# embedding model
git clone https://huggingface.co/GanymedeNil/text2vec-large-chinese
or
git clone https://huggingface.co/moka-ai/m3e-large
Configure the proxy and modify LLM_MODEL, PROXY_API_URL and API_KEY in the .env
file
# .env
# Aliyun tongyiqianwen
LLM_MODEL=tongyi_proxyllm
TONGYI_PROXY_API_KEY={your-tongyi-sk}
PROXY_SERVER_URL={your_service_url}
Install dependencies
pip install zhipuai
Download embedding model
cd DB-GPT
mkdir models and cd models
# embedding model
git clone https://huggingface.co/GanymedeNil/text2vec-large-chinese
or
git clone https://huggingface.co/moka-ai/m3e-large
Configure the proxy and modify LLM_MODEL, PROXY_API_URL and API_KEY in the .env
file
# .env
LLM_MODEL=zhipu_proxyllm
PROXY_SERVER_URL={your_service_url}
ZHIPU_MODEL_VERSION={version}
ZHIPU_PROXY_API_KEY={your-zhipu-sk}
Download embedding model
cd DB-GPT
mkdir models and cd models
# embedding model
git clone https://huggingface.co/GanymedeNil/text2vec-large-chinese
or
git clone https://huggingface.co/moka-ai/m3e-large
Configure the proxy and modify LLM_MODEL, MODEL_VERSION, API_KEY and API_SECRET in the .env
file
# .env
LLM_MODEL=wenxin_proxyllm
WEN_XIN_MODEL_VERSION={version} # ERNIE-Bot or ERNIE-Bot-turbo
WEN_XIN_API_KEY={your-wenxin-sk}
WEN_XIN_API_SECRET={your-wenxin-sct}
Install dependencies
Yi's API is compatible with OpenAI's API, so you can use the same dependencies as OpenAI's API.
pip install -e ".[openai]"
Download embedding model
cd DB-GPT
mkdir models and cd models
git clone https://huggingface.co/GanymedeNil/text2vec-large-chinese
Configure the proxy and modify LLM_MODEL, YI_API_BASE and YI_API_KEY in the .env
file
# .env
LLM_MODEL=yi_proxyllm
YI_MODEL_VERSION=yi-34b-chat-0205
YI_API_BASE=https://api.lingyiwanwu.com/v1
YI_API_KEY={your-yi-api-key}
⚠️ Be careful not to overwrite the contents of the .env
configuration file
Local model
- ChatGLM
- Vicuna
- Baichuan
Hardware requirements description
Model | Quantize | VRAM Size |
---|---|---|
Vicuna-7b-1.5 | 4-bit | 8GB |
Vicuna-7b-1.5 | 8-bit | 12GB |
Vicuna-13b-v1.5 | 4-bit | 12GB |
Vicuna-13b-v1.5 | 8-bit | 24GB |
Download LLM
cd DB-GPT
mkdir models and cd models
# embedding model
git clone https://huggingface.co/GanymedeNil/text2vec-large-chinese
or
git clone https://huggingface.co/moka-ai/m3e-large
# llm model, if you use openai or Azure or tongyi llm api service, you don't need to download llm model
git clone https://huggingface.co/lmsys/vicuna-13b-v1.5
Environment variable configuration, configure the LLM_MODEL parameter in the .env
file
# .env
LLM_MODEL=vicuna-13b-v1.5
Hardware requirements description
Model | Quantize | VRAM Size |
---|---|---|
Baichuan-7b | 4-bit | 8GB |
Baichuan-7b | 8-bit | 12GB |
Baichuan-13b | 4-bit | 12GB |
Baichuan-13b | 8-bit | 20GB |
Download LLM
cd DB-GPT
mkdir models and cd models
# embedding model
git clone https://huggingface.co/GanymedeNil/text2vec-large-chinese
or
git clone https://huggingface.co/moka-ai/m3e-large
# llm model
git clone https://huggingface.co/baichuan-inc/Baichuan2-7B-Chat
or
git clone https://huggingface.co/baichuan-inc/Baichuan2-13B-Chat
Environment variable configuration, configure the LLM_MODEL parameter in the .env
file
# .env
LLM_MODEL=baichuan2-13b
Hardware requirements description
Model | Quantize | VRAM Size |
---|---|---|
glm-4-9b-chat | Not support | 16GB |
ChatGLM-6b | 4-bit | 7GB |
ChatGLM-6b | 8-bit | 9GB |
ChatGLM-6b | FP16 | 14GB |
Download LLM
cd DB-GPT
mkdir models and cd models
# embedding model
git clone https://huggingface.co/GanymedeNil/text2vec-large-chinese
or
git clone https://huggingface.co/moka-ai/m3e-large
# llm model
git clone https://huggingface.co/THUDM/glm-4-9b-chat