To Do it

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
  9 随笔 :: 0 文章 :: 0 评论 :: 1040 阅读

环境要求

启动模式 CPU * MEM GPU 备注
代理模型 4C*8G 代理模型不依赖GPU
本地模型 8C*32G 24G 本地启动最好有24G以上GPU

conda环境安装

默认数据库使用SQLite,因此默认启动模式下,无需安装数据库。 如果需要使用其他数据库,可以看后面的高级教程。 我们推荐通过conda的虚拟环境来进行Python虚拟环境的安装。关于Miniconda环境的安装,可以参见Miniconda安装教程

创建Python虚拟环境

conda create -n db-gpt python=3.10

conda activate db-gpt

cd DB-GPT

    pip install -e ".[default]" --default-timeout=100 -i https://pypi.tuna.tsinghua.edu.cn/simple

cp .env.template  .env 

打包conda虚拟环境:
conda create -n dbgpt_env_offline --clone dbgpt_env 

conda install -c conda-forge conda-pack 

conda pack -n dbgpt_env_offline -o dbgpt_env_offline.tar.gz --ignore-editable-packages
高版本transformers会报错(transformers-4.42.4)DB-GPT版本v0.5.0
pip install transformers==4.40.0 --default-timeout=100 -i https://pypi.tuna.tsinghua.edu.cn/simple

代理模型

OpenAI

安装依赖

pip install  -e ".[openai]"

下载Embedding 嵌入模型

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

配置代理,在.env文件中修改LLM_MODEL, PROXY_API_URL and API_KEY

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

通义大模型

安装依赖

pip install dashscope

下载Embedding模型

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

配置代理,在.env文件中修改LLM_MODEL, PROXY_API_URL and API_KEY

#Aliyun tongyi
LLM_MODEL=tongyi_proxyllm
TONGYI_PROXY_API_KEY={your-tongyi-sk}
PROXY_SERVER_URL={your_service_url}

运行服务DB-GPT启动

python dbgpt/app/dbgpt_server.py

访问 DB-GPT WebUI

http://192.168.1.55:5670

本地部署

ChatGLM/ChatGLM2

硬件需求说明

模型下载

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/chatglm2-6b

环境变量配置, 配置LLM_MODEL参数在 .env 文件中

LLM_MODEL=chatglm2-6b

启动DB-GPT

python dbgpt/app/dbgpt_server.py

打开页面

192.168.1.55:5670

命令行一键启动

LLM_MODEL=vicuna-13b-v1.5 
dbgpt start webserver --port 6006

查看并验证模型服务

查看并展示所有的模型服务

其中WorkerManager是Model Workers的管理进程

检查并验证模型服务

dbgpt model chat --model_name vicuna-13b-v1.5

上述命令将启动一个交互式页面,可以通过终端与模型对话。

Chatbot started with model vicuna-13b-v1.5. Type 'exit' to leave the chat.


You: Hello
Bot: Hello! How can I assist you today?

You: 
(db-gpt) omnisky@omnisky:~/Downloads/DB-GPT/models$ dbgpt model chat --model_name chatglm2-6b
Chatbot started with model chatglm2-6b. Type 'exit' to leave the chat.


You: hi
Bot: Hello! How can I help you today? Is there something specific you would like to know or talk about? I'm here to answer any questions you might have.

You: byebye
Bot: Goodbye! Is there anything else you would like to say before you go? I'm here to help with any questions you might have.

You:


参考文档:https://www.yuque.com/eosphoros/dbgpt-docs/urh3fcx8tu0s9xmb

https://www.cnblogs.com/G1983280245/p/18285844

posted on   ~东来~  阅读(494)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
点击右上角即可分享
微信分享提示