赞
踩
首先,我们要下载一个软件,叫MobaXterm,在这个软件上可以连接到服务器,通过指令操作服务器。
软件:MobaXterm https://mobaxterm.mobatek.net/download.html
输入Remote host即可,输入形式为username@serverIP,然后输入密码,就可以访问了
(username@serverIP:abc@xxx.xxx.x.xxx)
上面的MobaXterm是用来操纵服务器跑代码的,但是在文件上传和下载这方面还不是很方便,咱们再下载一个专门用来处理文件的软件
wget https://repo.anaconda.com/archive/Anaconda3-2023.09-0-Linux-x86_64.sh
bash Anaconda3-2023.09-0-Linux-x86_64.sh
一直敲Enter直到出现以下询问,点击yes
安装目录确认:
确认安装成功
anaconda --version
## or
conda -V
【已解决】bash: conda: command not found_-bash: conda: 未找到命令_一白梦人的博客-CSDN博客
conda create -n baichuan2 #创建名为“baichuan2”的环境
conda activate baichuan2 #激活环境
conda info --envs #查看当前活跃的环境
conda list #查看当前环境安装的包和版本
conda install numpy scikit-learn #安装指定的包
conda env remove -n 'env_name' #删除指定的环境
conda env list #查看所有的环境
问题?
conda: error: argument COMMAND: invalid choice: 'activate'
(choose from 'clean', 'compare', 'config', 'create', 'info', 'init', ...
source activate chatglm-6b
pip install -r requirements.txt
参考官方可以先将模型下载到本地,然后从本地加载。
python -c "import torch; print(torch.cuda.is_available())" # 检查cuda是否正常 正常情况下,这里输出false需要重新安装torch pip uninstall torch -y conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.3 -c pytorch -y python -c "import torch; print(torch.cuda.is_available())" pip uninstall gradio -y pip install gradio==3.44.4 pip uninstall charset-normalizer -y pip install charset-normalizer==3.2.0 pip uninstall typing-extensions -y pip install --upgrade typing-extensions pip install chardet python -c "from PIL import Image" # 可能会报错 ImportError: DLL load failed while importing _imaging: 找不到指定的模块 需要重新安装Pillow pip uninstall Pillow -y pip install --upgrade pillow python -c "from PIL import Image"
修改web_demo.py中的模型所在的位置,改为绝对地址;
tokenizer = AutoTokenizer.from_pretrained("E:\\xxx\\xxx\\chatglm\\chatglm-6b", trust_remote_code=True, revision="")
model = AutoModel.from_pretrained("E:\\xxx\\xxx\\chatglm\\chatglm-6b", trust_remote_code=True, revision="").half().cuda()
执行web代码;
python web_demo.py
问题?
START /usr/bin/firefox "http://127.0.0.1:7861/"
Failed to open connection to "session" message bus: Using X11 for dbus-daemon autolaunch was disabled at compile time, set your DBUS_SESSION_BUS_ADDRESS instead
Running without a11y support!
这个错误信息提示系统连接到 D-Bus 会话总线时出现问题。
要解决此问题,您可以尝试将 DBUS_SESSION_BUS_ADDRESS
环境变量设置为正确的值。以下是设置步骤:
echo $DBUS_SESSION_BUS_ADDRESS
export DBUS_SESSION_BUS_ADDRESS=export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket
问题?Running without a11y support!
python cli_demo.py
问题?
RuntimeError: CUDA out of memory. Tried to allocate 128.00 MiB (GPU 0; 31.75 GiB total capacity; 9.50 GiB already allocated; 78.12 MiB free; 9.50 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
看一看GPU卡使用情况
nvidia-smi
指定GPU卡
CUDA_VISIBLE_DEVICES=1 python cli_demo.py
本文由mdnice多平台发布
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。