-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
安装基础环境
git clone https://github.com/Unispac/Visual-Adversarial-Examples-Jailbreak-Large-Language-Models.git
cd Visual-Adversarial-Examples-Jailbreak-Large-Language-Models
conda env create -f environment.yml
conda activate minigpt4
- 但是在安装过程中可能出现,pycocotools安装失败和peft安装时删除了已经安装好的PyTorch-1.12.1版本换成了另外版本的PyTorch。
对于这两个问题,我的解决方法是:
首先在environment.yml中注释掉36行(pycocotools)和56行(peft)。
单独安装pycocotools和peft:
pip install pycocotools==2.0.6
# 安装适配PyTorch-1.12.1版本的peft
git clone https://github.com/czczup/peft-torch112.git
cd peft-torch112
pip install -e .
下载运行项目所需的各种权重
一些众所周知的原因,中国大陆的用户无法访问huggingface,因此,不得不下载权重文件到本地。
Vicuna-13B:可以尝试使用modelscope进行下载。
pip install modelscope
modelscope download --model asdf1213812138/vicuna_13B_v0 --local_dir [本地目录]
bert-base-uncased:
modelscope download --model google-bert/bert-base-uncased --local_dir [本地目录]
- 修改minigpt4/models/blip2.py中的31和47行,修改为本地的bert-base-uncased目录
其他的模型权重:
modelscope download --model JyWang6/VAEJ_weights --local_dir [本地目录]
- 修改配置文件
minigpt4/configs/models/minigpt4.yaml,第16行,修改为本地的Vicuna-13B目录。
eval_configs/minigpt4_eval.yaml,第11行,修改为本地的pretrained_minigpt4.pth所在位置。 - 移动权重文件
mv eva_vit_g.pth /root/.cache/torch/hub/checkpoints
mv blip2_pretrained_flant5xxl.pth /root/.cache/torch/hub/checkpoints
运行时可能出现的问题
- No seaborn:
pip install seaborn
- ImportError: libGL.so.1:
pip install opencv-python-headless
- ValueError: Non-consecutive added token '' found. Should have index 32000 but has index 0 in saved vocabulary
# 进入本地Vicuna-13B目录
mv added_tokens.json added_tokens.json.bak
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels