ResearchGPT/PrivateGPT部署

ResearchGPT

[github]
1.装包部署

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:
pip uninstall openai
pip install openai==0.27.7
  1. Redis安装

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

  3. 运行

uvicorn main:app --reload

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

uvicorn main:app --host 127.0.0.1 --port 45144 --reload

而且终端要:

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命令行提示,执行如下内容:
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

安装make

choco install make

测试make是否成功安装

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

卸载:pip uninstall poetry

安装检查:

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

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

  • 通过poetry安装依赖包:
poetry install --with ui
poetry install --with local

下载模型

poetry run python scripts/setup
  • 尝试运行
make run

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

# 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
啊啊啊啊啊啊终于成功了,接下来我要详细理解这个工程,以方便以后微调。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值