-
Clone this repository:
git clone https://github.com/OpenGVLab/InternVL.git
-
Create a conda virtual environment and activate it:
conda create -n internvl python=3.9 -y conda activate internvl
-
Install
PyTorch>=2.0andtorchvision>=0.15.2withCUDA>=11.6:For examples, to install
torch==2.0.1withCUDA==11.8:conda install pytorch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 pytorch-cuda=11.8 -c pytorch -c nvidia # or pip install torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 --index-url https://download.pytorch.org/whl/cu118 -
Install
flash-attn==0.2.8orflash-attn==2.3.6:If you want to fully replicate my results in the paper, please install
v0.2.8, otherwise install thev2.3.6.This is because different versions of flash attention yield slight differences in results.
git clone https://github.com/Dao-AILab/flash-attention.git cd flash-attention git checkout v0.2.8 python setup.py install -
Install
timm==0.9.12andmmcv-full==1.6.2:pip install -U openmim pip install timm==0.9.12 mim install mmcv-full==1.6.2
-
Install
transformers==4.36.2:pip install transformers==4.36.2
-
Install
apex(optional):git clone https://github.com/NVIDIA/apex.git git checkout 2386a912164b0c5cfcd8be7a2b890fbac5607c82 # https://github.com/NVIDIA/apex/issues/1735 pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --config-settings "--build-option=--cpp_ext" --config-settings "--build-option=--cuda_ext" ./
If you meet
ModuleNotFoundError: No module named 'fused_layer_norm_cuda', please note that this is because apex's CUDA extensions are not being installed successfully. You can try to uninstall apex and the code will default to the PyTorch version of RMSNorm; Or, if you want to use apex, try adding a few lines tosetup.py, like this, and then recompiling.
-
Install other requirements:
pip install opencv-python termcolor yacs pyyaml scipy pip install deepspeed==0.10.0 pip install pycocoevalcap tqdm