赞
踩
至少在FP16精度下能跑起来,除了加载的时候会卡一下,对话还是很流畅的。
# DG-GPT的python版本大于3.10,但是ChatGLM3-6B是要用3.11版本的
conda create -n dbgpt python=3.11.3
conda activate dbgpt
git clone https://github.com/eosphoros-ai/DB-GPT.git
cd DB-GPT
# 这里需要访问github等外网,需要开通VPN,我这里有VPN搭建教程,评论有需要可以出一期
pip install -e ".[defalut]"
# 这个库需要额外安装
pip install openai
# 卸载dbgpt模块,直接备份库文件
mv /usr/local/anaconda3/envs/dbgpt11/lib/python3.11/site-packages/dbgpt /usr/local/anaconda3/envs/dbgpt11/lib/python3.11/site-packages/dbgpt.bak
# docker安装与mysql容器搭建就不详细说了
# 主要是数据迁移,有小坑
# 首先查看mysql服务地址
ifconfig
# 导入数据库
mysql -h 172.17.0.1 -u root -p < ./assets/schema/dbgpt.sql
# 由于代码更新需要修改数据库表结构,有一张表需要添加字段
mysql -u root -p -h 172.17.0.1
USE dbgpt;
ALTER TABLE dbgpt_serve_flow
ADD COLUMN `error_message` varchar(512) null comment 'Error message' after `state`;
请参照我的上一篇博客
ChatGLM3-6B 多GPU、Linux环境部署遇到的问题以及解决方法
cd DB-GPT
mkdir models
ln -s /opt/model/cache/ZhipuAI/chatglm3-6b /opt/suwy/DB-GPT/models/chatglm3-6b
# 注意这个bge-large-zh不要加后缀,这个是写死在.env环境文件中的
ln -s /opt/model/cache/AI-ModelScope/bge-large-zh-v1.5 /opt/suwy/DB-GPT/models/bge-large-zh
cp .env.template .env
# 主要修改大语言模型配置、embedding配置、数据库配置、GPU使用配置
## 以下是修改部分
# 大语言模型配置
#*******************************************************************#
#** LLM MODELS **#
#*******************************************************************#
# LLM_MODEL, see dbgpt/configs/model_config.LLM_MODEL_CONFIG
#LLM_MODEL=vicuna-13b-v1.5
LLM_MODEL=chatglm3-6b
## LLM model path, by default, DB-GPT will read the model path from LLM_MODEL_CONFIG based on the LLM_MODEL.
## Of course you can specify your model path according to LLM_MODEL_PATH
## embedding配置
#*******************************************************************#
#** EMBEDDING SETTINGS **#
#*******************************************************************#
#EMBEDDING_MODEL=text2vec
#EMBEDDING_MODEL=m3e-large
#EMBEDDING_MODEL=bge-large-en
EMBEDDING_MODEL=bge-large-zh
KNOWLEDGE_CHUNK_SIZE=500
KNOWLEDGE_SEARCH_TOP_SIZE=5
## Maximum number of chunks to load at once, if your single document is too large,
## you can set this value to a higher value for better performance.
## if out of memory when load large document, you can set this value to a lower value.
# KNOWLEDGE_MAX_CHUNKS_ONCE_LOAD=10
#KNOWLEDGE_CHUNK_OVERLAP=50
# Control whether to display the source document of knowledge on the front end.
KNOWLEDGE_CHAT_SHOW_RELATIONS=False
# Whether to enable Chat Knowledge Search Rewrite Mode
KNOWLEDGE_SEARCH_REWRITE=False
## EMBEDDING_TOKENIZER - Tokenizer to use for chunking large inputs
## EMBEDDING_TOKEN_LIMIT - Chunk size limit for large inputs
# EMBEDDING_MODEL=all-MiniLM-L6-v2
# EMBEDDING_TOKENIZER=all-MiniLM-L6-v2
# EMBEDDING_TOKEN_LIMIT=8191
# 数据库配置
#*******************************************************************#
#** DB-GPT METADATA DATABASE SETTINGS **#
#*******************************************************************#
### SQLite database (Current default database)
#LOCAL_DB_TYPE=sqlite
### MYSQL database
LOCAL_DB_TYPE=mysql
LOCAL_DB_USER=root
LOCAL_DB_PASSWORD=123456
LOCAL_DB_HOST=172.17.0.1
LOCAL_DB_PORT=3306
LOCAL_DB_NAME=dbgpt
### This option determines the storage location of conversation records. The default is not configured to the old version of duckdb. It can be optionally db or file (if the value is db, the database configured by LOCAL_DB will be used)
#CHAT_HISTORY_STORE_TYPE=db
## GPU使用配置(我是多GPU,注释说得很详细了)
#*******************************************************************#
#** MUlti-GPU **#
#*******************************************************************#
## See https://developer.nvidia.com/blog/cuda-pro-tip-control-gpu-visibility-cuda_visible_devices/
## If CUDA_VISIBLE_DEVICES is not configured, all available gpus will be used
# CUDA_VISIBLE_DEVICES=0
## You can configure the maximum memory used by each GPU.
# MAX_GPU_MEMORY=16Gib
CUDA_VISIBLE_DEVICES=0,1
MAX_GPU_MEMORY=8Gib
conda activate dbgpt;
python dbgpt/app/dbgpt_server.py
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。