forked from CoderPat/LLaVA-NeXT
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconda_install.sh
More file actions
executable file
·77 lines (59 loc) · 2.4 KB
/
conda_install.sh
File metadata and controls
executable file
·77 lines (59 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/zsh
# Script for setting up a conda environment with for launching servers
# It sidesteps system-wide installations by relying on conda for most packages
# and by building openssl from source
# TODO: only got it to work with a static build of OpenSSL, which is not ideal
set +x
# Load modules for miniconda & nvcc in HPC
#module load miniforge3/24.3.0-0
#module load nccl/2.22.3-1-cuda-12.4.1
#module load cuda/12.4.1
ENV_NAME="${ENV_NAME:-llava-next-env}"
# get the directory of this script, which should be the root directory of the project
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
set -eo pipefail
# check if CONDA_HOME is set
if [ -z "$CONDA_HOME" ]
then
echo "Please set CONDA_HOME to the location of your conda installation"
exit 1
fi
# Conda envs may not be in the conda home directory
CONDA_ENVS="${CONDA_ENVS:-$CONDA_HOME/envs}"
echo "Using environment name: $ENV_NAME"
echo "Using Conda home path: $CONDA_HOME"
echo "Using Conda environments path: $CONDA_ENVS"
echo "LLaVA-NeXT dir: $DIR"
source ${CONDA_HOME}/etc/profile.d/conda.sh
# if the environment already exists, just activate it
if conda env list | grep -q ${ENV_NAME}; then
echo "Environment ${ENV_NAME} already exists, activating it"
conda activate ${ENV_NAME}
else
echo "Environment ${ENV_NAME} does not exist, creating it"
conda create -y -n ${ENV_NAME} python=3.10
conda activate ${ENV_NAME}
fi
pip install ninja
# install our own copy of CUDA and set environment variables
#conda install -y openldap
#conda install -y -c "nvidia/label/cuda-12.4.0" cuda-toolkit cuda-nvcc cudnn
#export PATH=${CONDA_ENVS}/${ENV_NAME}/bin:$PATH
#export LD_LIBRARY_PATH=${CONDA_ENVS}/${ENV_NAME}/lib:$LD_LIBRARY_PATH
#export CUDA_HOME=${CONDA_ENVS}/${ENV_NAME}
echo "nvcc path: $(which nvcc)"
nvcc -V
pip install -e ".[train]"
# Install flash-attn if not already installed (check with pip list)
if ! pip list | grep "flash_attn"; then
git clone https://github.com/Dao-AILab/flash-attention.git
cd flash-attention && git checkout v2.5.8
git submodule update --init --recursive && rm -rf build
python setup.py install
cd .. && rm -rf flash-attention
fi
# pip install "flash-attn<=2.7.2" --no-build-isolation
conda env config vars set PATH=$PATH
conda env config vars set LD_LIBRARY_PATH=$LD_LIBRARY_PATH
conda env config vars set CUDA_HOME=$CUDA_HOME
conda env config vars set PYTHONPATH=$DIR:$PYTHONPATH