赞
踩
repo 缺少 installation guide,各种版本对齐限制,导致了不得不写下来。
cuda 12.1
torch 2.3.0
torchvision 0.18+cu121
conda和pip混用,而且这个不行就换另一个。
conda create -n cogvlm2 python=3.10.14
conda activate cogvlm2
conda install cudatoolkit==11.8
按照requirements的最低版本是2.0.0,但实际上按照Pytorch官网,2.0支持最高cuda11.8, 2.0以上就会有cuda12.1,如果用了cuda12.1噩梦就来了。
conda install pytorch==2.0.0 torchvision==0.15.0 torchaudio==2.0.0 pytorch-cuda=11.8 -c pytorch -c nvidia
但,不要用conda install --file 或者 pip install -r。因为requirements.txt 里面用到了>=,个人觉得就是最大的一个坑!我的方法是先用conda search <pkg_name>,找到符合要求的包就用最低版本安装,找不到就用pip,但是要留意pip在安装中会卸掉一些你前面装好的包,这也是一个天坑,例如那个xformers,如果不加版本,它会装最新的,然后它会给你卸掉原来装好的pytorch2.0 然后给你装最新的pytorch2.3.1,然后跑模型的时候就会报下面这个错误:
RuntimeError: operator torchvision::nms does not exist
这坑也是没谁了。为了节省大家时间,我把我的环境贴在下面,大家可以参考。之所以说参考,因为不是所有的包都可以通过conda或者pip安装,因此转成yaml或者txt也没用,
# # Name Version Build Channel _libgcc_mutex 0.1 main https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main _openmp_mutex 5.1 1_gnu https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main accelerate 0.32.1 pypi_0 pypi aiofiles 23.2.1 pypi_0 pypi aiohttp 3.9.5 pypi_0 pypi aiosignal 1.3.1 pypi_0 pypi annotated-types 0.7.0 pypi_0 pypi anyio 3.7.1 pypi_0 pypi async-timeout 4.0.3 pypi_0 pypi asyncer 0.0.2 pypi_0 pypi attrs 23.2.0 pypi_0 pypi bidict 0.23.1 pypi_0 pypi bitsandbytes 0.43.1 pypi_0 pypi blas 1.0 mkl https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free brotli-python 1.0.9 py310h6a678d5_8 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main bzip2 1.0.8 h5eee18b_6 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main ca-certificates 2024.3.11 h06a4308_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main certifi 2024.7.4 py310h06a4308_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main chainlit 1.0.0 pypi_0 pypi charset-normalizer 2.0.4 pyhd3eb1b0_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main click 8.1.7 pypi_0 pypi cuda-cudart 11.8.89 0 nvidia cuda-cupti 11.8.87 0 nvidia cuda-libraries 11.8.0 0 nvidia cuda-nvrtc 11.8.89 0 nvidia cuda-nvtx 11.8.86 0 nvidia cuda-runtime 11.8.0 0 nvidia cudatoolkit 11.8.0 h6a678d5_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main dataclasses-json 0.5.14 pypi_0 pypi deprecated 1.2.14 pypi_0 pypi distro 1.9.0 pypi_0 pypi einops 0.8.0 pypi_0 pypi exceptiongroup 1.2.1 pypi_0 pypi fastapi 0.100.1 pypi_0 pypi fastapi-socketio 0.0.10 pypi_0 pypi ffmpeg 4.3 hf484d3e_0 pytorch filelock 3.13.1 py310h06a4308_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main filetype 1.2.0 pypi_0 pypi freetype 2.12.1 h4a9f257_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main frozenlist 1.4.1 pypi_0 pypi fsspec 2024.6.1 pypi_0 pypi gmp 6.2.1 h295c915_3 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main gmpy2 2.1.2 py310heeb90bb_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main gnutls 3.6.15 he1e5248_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main googleapis-common-protos 1.63.2 pypi_0 pypi grpcio 1.64.1 pypi_0 pypi h11 0.14.0 pypi_0 pypi httpcore 0.17.3 pypi_0 pypi httpx 0.24.1 pypi_0 pypi huggingface-hub 0.23.0 pypi_0 pypi idna 3.7 py310h06a4308_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main importlib-metadata 7.1.0 pypi_0 pypi intel-openmp 2023.1.0 hdb19cb5_46306 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main jinja2 3.1.4 py310h06a4308_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main jpeg 9e h5eee18b_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main lame 3.100 h7b6447c_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main lazify 0.4.0 pypi_0 pypi lcms2 2.12 h3be6417_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main ld_impl_linux-64 2.38 h1181459_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main lerc 3.0 h295c915_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main libcublas 11.11.3.6 0 nvidia libcufft 10.9.0.58 0 nvidia libcufile 1.9.1.3 0 nvidia libcurand 10.3.5.147 0 nvidia libcusolver 11.4.1.48 0 nvidia libcusparse 11.7.5.86 0 nvidia libdeflate 1.17 h5eee18b_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main libffi 3.4.4 h6a678d5_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main libgcc-ng 11.2.0 h1234567_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main libgomp 11.2.0 h1234567_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main libiconv 1.14 0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free libidn2 2.3.4 h5eee18b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main libnpp 11.8.0.86 0 nvidia libnvjpeg 11.9.0.86 0 nvidia libpng 1.6.39 h5eee18b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main libstdcxx-ng 11.2.0 h1234567_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main libtasn1 4.19.0 h5eee18b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main libtiff 4.5.1 h6a678d5_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main libunistring 0.9.10 h27cfd23_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main libuuid 1.41.5 h5eee18b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main libwebp-base 1.3.2 h5eee18b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main literalai 0.0.1 pypi_0 pypi loguru 0.7.2 pypi_0 pypi lz4-c 1.9.4 h6a678d5_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main markupsafe 2.1.3 py310h5eee18b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main marshmallow 3.21.3 pypi_0 pypi mkl 2023.1.0 h213fc3f_46344 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main mkl-service 2.4.0 py310h5eee18b_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main mkl_fft 1.3.8 py310h5eee18b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main mkl_random 1.2.4 py310hdb19cb5_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main mpc 1.0.3 0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free mpfr 4.0.2 hb69a4c5_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main mpmath 1.3.0 py310h06a4308_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main multidict 6.0.5 pypi_0 pypi mypy-extensions 1.0.0 pypi_0 pypi ncurses 6.4 h6a678d5_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main nest-asyncio 1.6.0 pypi_0 pypi nettle 3.7.3 hbbd107a_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main networkx 3.3 py310h06a4308_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main numpy 1.26.4 py310h5f9d8c6_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main numpy-base 1.26.4 py310hb5e798b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main openai 1.30.1 pypi_0 pypi openh264 2.1.1 h4ff587b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main openjpeg 2.4.0 h9ca470c_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main openssl 3.0.14 h5eee18b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main opentelemetry-api 1.25.0 pypi_0 pypi opentelemetry-exporter-otlp 1.25.0 pypi_0 pypi opentelemetry-exporter-otlp-proto-common 1.25.0 pypi_0 pypi opentelemetry-exporter-otlp-proto-grpc 1.25.0 pypi_0 pypi opentelemetry-exporter-otlp-proto-http 1.25.0 pypi_0 pypi opentelemetry-instrumentation 0.46b0 pypi_0 pypi opentelemetry-proto 1.25.0 pypi_0 pypi opentelemetry-sdk 1.25.0 pypi_0 pypi opentelemetry-semantic-conventions 0.46b0 pypi_0 pypi packaging 23.2 pypi_0 pypi pillow 10.3.0 py310h5eee18b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pip 24.0 py310h06a4308_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main protobuf 4.25.3 pypi_0 pypi psutil 6.0.0 pypi_0 pypi pydantic 2.8.2 pypi_0 pypi pydantic-core 2.20.1 pypi_0 pypi pyjwt 2.8.0 pypi_0 pypi pyre-extensions 0.0.23 pypi_0 pypi pysocks 1.7.1 py310h06a4308_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main python 3.10.14 h955ad1f_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main python-dotenv 1.0.1 pypi_0 pypi python-engineio 4.9.1 pypi_0 pypi python-graphql-client 0.4.3 pypi_0 pypi python-multipart 0.0.6 pypi_0 pypi python-socketio 5.11.3 pypi_0 pypi pytorch 2.0.0 py3.10_cuda11.8_cudnn8.7.0_0 pytorch pytorch-cuda 11.8 h7e8668a_5 pytorch pytorch-mutex 1.0 cuda pytorch pyyaml 6.0.1 pypi_0 pypi readline 8.2 h5eee18b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main regex 2024.5.15 pypi_0 pypi requests 2.32.2 py310h06a4308_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main safetensors 0.4.3 pypi_0 pypi setuptools 69.5.1 py310h06a4308_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main simple-websocket 1.0.0 pypi_0 pypi sniffio 1.3.1 pypi_0 pypi sqlite 3.45.3 h5eee18b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main sse-starlette 2.1.2 pypi_0 pypi starlette 0.27.0 pypi_0 pypi sympy 1.12 py310h06a4308_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main syncer 2.0.3 pypi_0 pypi tbb 2021.8.0 hdb19cb5_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main timm 0.9.16 pypi_0 pypi tk 8.6.14 h39e8969_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main tokenizers 0.19.1 pypi_0 pypi tomli 2.0.1 pypi_0 pypi torchaudio 2.0.0 py310_cu118 pytorch torchtriton 2.0.0 py310 pytorch torchvision 0.15.0 py310_cu118 pytorch tqdm 4.66.4 pypi_0 pypi transformers 4.40.0 pypi_0 pypi typing-inspect 0.9.0 pypi_0 pypi typing_extensions 4.11.0 py310h06a4308_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main tzdata 2024a h04d1e81_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main uptrace 1.24.0 pypi_0 pypi urllib3 2.2.2 py310h06a4308_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main uvicorn 0.23.2 pypi_0 pypi watchfiles 0.20.0 pypi_0 pypi websockets 12.0 pypi_0 pypi wheel 0.43.0 py310h06a4308_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main wrapt 1.16.0 pypi_0 pypi wsproto 1.2.0 pypi_0 pypi xformers 0.0.18 pypi_0 pypi xz 5.4.6 h5eee18b_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main yarl 1.9.4 pypi_0 pypi zipp 3.19.2 pypi_0 pypi zlib 1.2.13 h5eee18b_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main zstd 1.5.5 hc292b87_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
另外,我把/basic_demo/requirements.txt 的内容改了一下,安装时参考这个更快。(修改了一下,直接把顺序,包和命令都写下来)
conda install accelerate==0.32.1 transformers==4.40 pillow pydantic==2.8.2 timm==0.9.16 openai==1.30.1 loguru==0.7.2 einops==0.8.0 sse-starlette==2.1.0 bitsandbytes==0.43.1
pip install xformers==0.0.18 huggingface-hub==0.23.0 chainlit==1.0
(cogvlm2) think@xsyDL-4090solo:~/CogVLM2-main/basic_demo$ python cli_demo.py --quant 4
Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.
Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████| 8/8 [00:04<00:00, 1.94it/s]
image path >>>>>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。