ResearchGPT/PrivateGPT部署

ResearchGPT

[github]

1.装包部署

python 复制代码
git clone https://github.com/mukulpatnaik/researchgpt.git
cd researchgpt
pip install -r requirements.txt
  • 安装openai有很多坑,从python版本选择开始就要注意。
    python版本选择:3.8。
  • 装包要在终端开vpn
  • No module named 'openai.embeddings_utils' : openai.embeddings_utils does not exist in latest openai 1.2.0, but exists in 0.27.7
    先卸载原版本再安装0.27.7:
python 复制代码
pip uninstall openai
python 复制代码
pip install openai==0.27.7
  1. Redis安装

  2. 设置环境变量:在环境变量里设置OPENAI_API_KEY,可以通过在命令提示符(CMD)或者PowerShell中输入echo %OPENAI_API_KEY%来验证环境变量是否设置成功。

    需要拿到一个openaikey

  3. 运行

python 复制代码
uvicorn main:app --reload

原版,无法运行,要改端口:

python 复制代码
uvicorn main:app --host 127.0.0.1 --port 45144 --reload

而且终端要:

python 复制代码
set http_proxy=http://127.0.0.1:7890
set https_proxy=http://127.0.0.1:7890
  • 报错:redis.exceptions.ConnectionError: Error 10061 connecting to localhost:45183. 由 于目标计算机积极拒绝,无法连接。

    解决方法:是由于没有启动redis服务,启动服务(找到安装路径,打开redis-servce.exe文件即可)。

  • 报错:INFO: 127.0.0.1:52751 - "POST /process_pdf HTTP/1.1" 500 Internal Server Error

    ERROR: Exception in ASGI application.

    解析:the 127.0.0.1:64603 part is not the address and port the server is running on. Instead, it's the address and port of the client that sent the HTTP request to the server.这个错误是由于下面那个错误导致的。

  • 报错:Done creating dataframe

    openai.error.RateLimitError: Rate limit reached for text-embedding-ada-002 in organization org-s7q4Pdq4wxWqju2UCefWy6uZ on requests per min (RPM): Limit 3, Used 3, Requested 1. Please try again in 20s
    限制规则见openai文档。

curl http://localhost:19327/v1/completions \ -H "Content-Type: application/json" \ -d '{ "prompt": "告诉我中国的首都在哪里" }'

python scripts/openai_server_demo/openai_api_server.py --base_model /path/to/base_model --lora_model /path/to/lora_model --gpus 0,1

PrivateGPT

不行,换方法 ,本地基于llama2部署

按照官方步骤一步步来即可。

一些要点:

  • Makefile安装
    当用户编译文件过多的时候,使用makefile可以帮助模块化编译文件,makefile是一个脚本文件,根据规则,来执行相应的脚本文件,实现自动化编译。
    首先安装chocolatey,以管理员权限打开cmd命令行提示,执行如下内容:
python 复制代码
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

安装make

python 复制代码
choco install make

测试make是否成功安装

python 复制代码
make --version
  • Poetry安装
    这里注意,官方下载指定都不好使,会把安装地址重定向,导致安装依赖包时出错。
    下载方法:
powershell 复制代码
安装:pip install --user poetry

卸载:pip uninstall poetry

安装检查:

1、安装完成后要在环境变量新增一条poetry的环境变量

2、控制台执行poetry --version,出现Poetry version 表示安装成功

  • 通过poetry安装依赖包:
powershell 复制代码
poetry install --with ui
powershell 复制代码
poetry install --with local

下载模型

powershell 复制代码
poetry run python scripts/setup
  • 尝试运行
powershell 复制代码
make run

端口号不是localhost
解决:在工程中ctrl+shift+f寻找uvicorn.run找到

powershell 复制代码
# uvicorn.run(app, host="0.0.0.0", port=settings().server.port, log_config=None)

uvicorn.run(app, host="127.0.0.1", port=settings().server.port, log_config=None)

修改即可

然后再make run

啊啊啊啊啊啊终于成功了,接下来我要详细理解这个工程,以方便以后微调。

相关推荐
好运的阿财7 分钟前
process 工具与子agent管理机制详解
网络·人工智能·python·程序人生·ai编程
龙文浩_10 分钟前
AI中NLP的文本张量表示方法在自然语言处理中的演进与应用
人工智能·pytorch·深度学习·神经网络·自然语言处理
砍材农夫11 分钟前
spring-ai 第六模型介绍-聊天模型
java·人工智能·spring
deardao11 分钟前
【LLM+时序控制】闭环控制:基于控制理论的可证明稳定时间序列预测框架与大型语言模型
人工智能·语言模型·自然语言处理
only-qi11 分钟前
Agent Skills:让 AI 成为后端开发的得力助手
人工智能·skills
花燃柳卧15 分钟前
AI 团队工作流工程化架构方案
人工智能·ai编程·ai工作流
G***技15 分钟前
让AI为企业所用:AI PC N602构筑安全智能防线
人工智能·ai pc·mini pc
Henry-SAP18 分钟前
SAP中的预留影响MRP需求计算业务解析
人工智能·sap·erp
xiaoduo AI22 分钟前
客服机器人支持表情包互动吗?智能体图文自动回复,更贴合年轻客户偏好?
人工智能·机器人
爱分享的阿Q35 分钟前
STM32现代化AI开发环境搭建:从Keil到VSCode+AI的范式转移
人工智能·vscode·stm32