安装MiniGPT-4

克隆项目

# 安装 git-lfs
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.rpm.sh | sudo bash
yum install git-lfs



git clone https://github.com/Vision-CAIR/MiniGPT-4.git
git clone https://huggingface.co/lmsys/vicuna-13b-delta-v0
mv vicuna-13b-delta-v0 /data/MiniGPT-4/vicuna_weights

安装补丁

cd /data/MiniGPT-4/
cd ckp/
#https://drive.google.com/file/d/1a4zLvaiDBr-36pasffmgpvH5P7CKmpze/view
#https://drive.google.com/u/0/uc?id=1a4zLvaiDBr-36pasffmgpvH5P7CKmpze&export=download
wget https://doc-0s-08-docs.googleusercontent.com/docs/securesc/dbq4d7c2ha9354fqj5612le3gl157ov5/pcnbepjp7icjk54rrfgio602v738i398/1681803150000/09448752369347632296/09178445193473466964/1a4zLvaiDBr-36pasffmgpvH5P7CKmpze?e=download&ax=ALy03A4aDltm3f1TddEAJesIj7YsB_KKlm56C61-M72rzjuPpluLCR3UOUv28FXMkNc3q5s


## 修改配置
vim /data/MiniGPT-4/eval_configs/minigpt4_eval.yaml
 ckpt: '/data/MiniGPT-4/ckp/'

vim /data/MiniGPT-4/minigpt4/configs/models/minigpt4.yaml 
  llama_model: "/data/MiniGPT-4/vicuna_weights/"

安装依赖

pip3.9 install omegaconf
#1681803684
yum install xz-devel -y
yum install python-backports-lzma -y
pip3.9 install backports.lzma
yum install python-backports-lzma -y
yum install -y xz-devel mesa-libGL python-backports-lzma
vim /usr/local/python3.9/lib/python3.9/lzma.py

pip3.9 install iopath
pip3.9 install timm
pip3.9 install cv2



pip3.9 install  opencv-python  -i https://pypi.tuna.tsinghua.edu.cn/simple


pip3.9 install webdataset  -i https://pypi.tuna.tsinghua.edu.cn/simple

pip3.9 install sentencepiece #  -i https://pypi.tuna.tsinghua.edu.cn/simple
pip3.9 install  transformers
python3.9  -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('we love you'))"
conda install -c huggingface transformers

cd ..

git clone https://github.com/huggingface/transformers.git

cd transformers
pip3.9 install -e .  -i https://pypi.tuna.tsinghua.edu.cn/simple
pip3.9 install decord
pip3.9 install decord  -i https://pypi.tuna.tsinghua.edu.cn/simple
pip3.9 install accelerate
pip3.9 install  bitsandbytes  -i https://pypi.tuna.tsinghua.edu.cn/simple

修复 /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found 报错

strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX 
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_DEBUG_MESSAGE_LENGTH
wget http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-5.2.0/gcc-5.2.0.tar.bz2
tar -xf gcc-5.2.0.tar.bz2
cd gcc-5.2.0
./contrib/download_prerequisites
mkdir gcc-temp
cd gcc-temp
../configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
make && make install
mv /usr/bin/gcc /usr/bin/gcc.bak
 /usr/sbin/update-alternatives --install  /usr/bin/gcc gcc /usr/local/bin/x86_64-unknown-linux-gnu-gcc-5.2.0 52
 
gcc -v

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/5.2.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
Thread model: posix
gcc version 5.2.0 (GCC) 



 g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/5.2.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
Thread model: posix
gcc version 5.2.0 (GCC) 



strings /usr/local/lib64/libstdc++.so.6|grep GLIBCXX
2. 复制链接

cp /usr/local/lib64/libstdc++.so.6.0.21  /usr/lib64

cd /usr/lib64

rm -f libstdc++.so.6

ln -s libstdc++.so.6.0.21 libstdc++.so.6

ll libstdc*

补充

pip3.9 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu

vim  /data/MiniGPT-4/minigpt4/models/mini_gpt4.py:92                                     │
│                                                                                                  │
│    86 │   │   self.llama_tokenizer.pad_token = self.llama_tokenizer.eos_token                    │
│    87 │   │                                                                                      │
│    88 │   │   if self.low_resource:                                                              │
│ ❱  89 │   │   │   self.llama_model = LlamaForCausalLM.from_pretrained(                           │
│    90 │   │   │   │   llama_model,                                                               │
│    91 │   │   │   │   torch_dtype=torch.float16,                                                 │
│    92 │   │   │   │   #load_in_8bit=True, 



mkdir -p /export/home/.cache/minigpt4

wget https://repo.anaconda.com/archive/Anaconda3-5.3.0-Linux-x86_64.sh
chmod +x Anaconda3-5.3.0-Linux-x86_64.sh
./Anaconda3-5.3.0-Linux-x86_64.sh
vim /root/.bashrc
export PATH=/root/anaconda3/bin:$PATH
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
conda env create -f environment.yml
conda activate minigpt4
python demo.py --cfg-path eval_configs/minigpt4_eval.yaml
>> Home

51ak

2023/04/18

Categories: centos python Tags: 整理

《数据库工作笔记》公众号
扫描上面的二维码,关注我的《数据库工作笔记》公众号