平替版Chatgpt安装教程

751 阅读1分钟

平替版Chatgpt安装教程

这货叫text-generation-webui,在gitgub开源,你可以加载各种大语言模型然后去使用它。下面是安装教程:

欢迎大家关注本公众号(猫说AI),公众号接入了chatgpt最新3.5模型,会持续分享更多免费教程! 你的关注就是我的动力!

0.安装conda

curl -sL "https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh" > "Miniconda3.sh"
bash Miniconda3.sh

安装完conda后先重新连接sh终端,否则不生效:

输入

conda --version

显示如下,代表安装成功

conda 23.1.0

设置不默认进入conda环境:

conda config --set auto_activate_base false

0.1 (Ubuntu/WSL) Install build tools

sudo apt install build-essential

1.Create a new conda environment(创建虚拟环境并激活)

conda create -n textgen python=3.10.9
conda activate textgen

2. Install Pytorch

SystemGPUCommand
Linux/WSLNVIDIApip3 install torch torchvision torchaudio
LinuxAMDpip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm5.4.2
MacOS + MPS (untested)Anypip3 install torch torchvision torchaudio

ps:这时候默认下载的话会很慢,建议pip更换清华源,执行如下命令:

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

3. Install the web UI

git clone https://ghproxy.com/https://github.com/oobabooga/text-generation-webui
cd text-generation-webui
pip install -r requirements.txt

ps:注意在执行install之前,先修改requirements文件,替换其中的源为代理源

git+https://ghproxy.com/https://github.com/huggingface/transformers
bitsandbytes==0.37.2; platform_system != "Windows"
llama-cpp-python==0.1.30; platform_system != "Windows"
https://ghproxy.com/https://github.com/abetlen/llama-cpp-python/releases/download/v0.1.30/llama_cpp_python-0.1.30-cp310-cp310-win_amd64.whl; platform_system == "Windows"

下载简单小模型尝试启动:

a.首先下载

python download-model.py facebook/opt-125m

b.启动webui

python server.py --share

启动后界面如下:

image-20230411165855235

最后打开浏览器访问蓝字url地址就可以使用了。如图所示:点击generate可以生成对话。 欢迎大家关注本公众号(猫说AI),公众号接入了chatgpt最新3.5模型,会持续分享更多免费教程! 你的关注就是我的动力!