部署DB-GPT

踩坑

参考文献

https://zhuanlan.zhihu.com/p/629467580
https://blog.csdn.net/qq_40231723/article/details/133956318

安装环境与模型运行

安装conda环境

首先我们需要安装conda环境,我们使用miniconda3

bash 复制代码
wget https://repo.anaconda.com/miniconda/Miniconda3-py310_23.3.1-0-Linux-x86_64.sh
sh Miniconda3-py310_23.3.1-0-Linux-x86_64.sh

安装完成之后,需要生效一下环境变量

bash 复制代码
source /root/.bashrc

conda create -n dbgpt_env python=3.10 
conda activate dbgpt_env

下载git-lfs

下载git-lfs,为了大模型的传输

bash 复制代码
apt-get install git-lfs

初始化

bash 复制代码
git lfs install

克隆源码

bash 复制代码
git clone https://github.com/eosphoros-ai/DB-GPT.git

下载大模型到models目录(huggingface无法访问,使用该镜像网站)

bash 复制代码
git clone https://www.modelscope.cn/thomas/text2vec-large-chinese.git

git clone https://www.modelscope.cn/ZhipuAI/chatglm2-6b.git

配置.env文件

bash 复制代码
cd /home/DB-GPT
cp .env.template .env

可以在.env中配置基本参数,例如将LLM_MODEL设置为要使用的模型,LLM_MODEL官方推荐使用vicuna-13b-v1.5。这里我使用的是chatglm2-6b

加载SQLite的数据

bash 复制代码
bash ./scripts/examples/load_examples.sh

运行DB-GPT

运行db-gpt服务端

bash 复制代码
python pilot/server/llmserver.py

服务端运行成功图

运行客户端

bash 复制代码
python pilot/server/dbgpt_server.py

客户端运行成功图,端口5000

浏览器访问

配置sqlite数据库

点击左侧Data Center,再点击sqlite,修改Path

数据库示例



问题1:用中文提问,模型翻译的单词与数据库列名不一致

可见模型把学分翻译为score,而不是credit,导致报错

解决思路:涉及到的表名和列名,用英文输入

问题2:查询总分最高的学生

pydantic版本问题

报错信息:pydantic.errors.PydanticUserError: If you use @root_validator with pre=False (the default) you MUST specify skip_on_failure=True. Note that @root_validator is deprecated and should be replaced with @model_validator.

解决:卸载该版本,下载旧版本

python 复制代码
pip uninstall pydantic

pip install pydantic==1.10.5

bash报错

原因:linux系统换行符出现问题

解决:sed -i 's/\r//g' xxx.sh

相关推荐
liuyunshengsir4 小时前
利用coze工作流制作一个自动生成PPT的智能体
大模型·大模型工作流
mengyoufengyu4 小时前
DeepSeek12-Open WebUI 知识库配置详细步骤
人工智能·大模型·deepseek
山顶夕景4 小时前
【LLM-Agent】智能体的记忆缓存设计
大模型·agent·记忆模块·记忆缓存
人肉推土机1 天前
AI Agent 架构设计:ReAct 与 Self-Ask 模式对比与分析
人工智能·大模型·llm·agent
中杯可乐多加冰1 天前
【解决方案-RAGFlow】RAGFlow显示Task is queued、 Microsoft Visual C++ 14.0 or greater is required.
人工智能·大模型·llm·rag·ragflow·deepseek
audyxiao0012 天前
计算机视觉顶刊《International Journal of Computer Vision》2025年5月前沿热点可视化分析
图像处理·人工智能·opencv·目标检测·计算机视觉·大模型·视觉检测
阿部多瑞 ABU2 天前
# 从底层架构到应用实践:为何部分大模型在越狱攻击下失守?
gpt·安全·ai·自然语言处理
阿部多瑞 ABU2 天前
大模型安全测试报告:千问、GPT 全系列、豆包、Claude 表现优异,DeepSeek、Grok-3 与 Kimi 存在安全隐患
gpt·安全·ai
CM莫问2 天前
<论文>(微软)WINA:用于加速大语言模型推理的权重感知神经元激活
人工智能·算法·语言模型·自然语言处理·大模型·推理加速
武子康3 天前
AI炼丹日志-28 - Audiblez 将你的电子书epub转换为音频mp3 做有声书
人工智能·爬虫·gpt·算法·机器学习·ai·音视频