-
Notifications
You must be signed in to change notification settings - Fork 1
/
vast2.sh
97 lines (79 loc) · 3.24 KB
/
vast2.sh
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
### DONT RUN IT, IT DONT WORK!
#
### EXECUTE THE STEPS MANUALLY!
### NOTES
#
# if conda activate dont work in shell script, "need conda init...."
#
# eval "$(conda shell.bash hook)"
### END NOTES
# Bash Script to Install kohya_ss on a Vast ai Machine
# tested with RTX 3090 and pytorch/pytorch_2.0.0-cuda11.7-cudnn8-runtime image
# Script need to be tested.
# Made with the Help of Github User Kuriot. Thanks :)
#install necessary tools
apt update
apt install -y libgl1 nano screen unzip # nano screen unzip optional
pip install cmake
pip install lit
pip install gdown #optional
# clone the repo
git clone https://github.com/bmaltais/kohya_ss
# switch into directory
cd kohya_ss
eval "$(conda shell.bash hook)"
conda create -n kohya python=3.10.9
conda activate kohya
conda install pytorch==1.13.1 torchvision==0.14.1 xformers -c pytorch -c nvidia -c xformers
conda install -c conda-forge cudatoolkit=11.8.0
python3 -m pip install 'nvidia-cudnn-cu11>=8.6<9' tensorflow==2.11.* tensorrt==8.6.1 triton
python3 -m pip install accelerate==0.18.0
python3 -m pip install albumentations==1.3.0
python3 -m pip install altair==4.2.2
python3 -m pip install dadaptation==1.5
python3 -m pip install diffusers[torch]==0.10.2
python3 -m pip install easygui==0.98.3
python3 -m pip install einops==0.6.0
python3 -m pip install ftfy==6.1.1
python3 -m pip install gradio==3.28.1
python3 -m pip install lion-pytorch==0.0.6
python3 -m pip install opencv-python==4.7.0.68
python3 -m pip install pytorch-lightning==1.9.0
python3 -m pip install safetensors==0.2.6
python3 -m pip install toml==0.10.2
python3 -m pip install voluptuous==0.13.1
python3 -m pip install wandb==0.15.0
python3 -m pip install fairscale==0.4.13
python3 -m pip install requests==2.28.2
python3 -m pip install timm==0.6.12
python3 -m pip install huggingface-hub==0.13.3
python3 -m pip install lycoris_lora==0.1.4
pip install --use-pep517 --upgrade -r requirements.txt
mkdir -p $CONDA_PREFIX/etc/conda/activate.d
echo 'CUDNN_PATH=$(dirname $(python -c "import nvidia.cudnn;print(nvidia.cudnn.__file__)"))' >> $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/:$CUDNN_PATH/lib' >> $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh
source $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh
ln -sr $CONDA_PREFIX/lib/python3.10/site-packages/tensorrt_libs/libnvinfer.so.8 $CONDA_PREFIX/lib/python3.10/site-packages/tensorrt_libs/libnvinfer.so.7
ln -sr $CONDA_PREFIX/lib/python3.10/site-packages/tensorrt_libs/libnvinfer_plugin.so.8 $CONDA_PREFIX/lib/python3.10/site-packages/tensorrt_libs/libnvinfer_plugin.so.7
conda deactivate
#### if Captioning doesnt work: no module found library...
# pip install --use-pep517 --upgrade -r requirements.txt
#### just a quick note
#switch back
cd ..
# change gui.sh
rm kohya_ss/gui.sh
cat <<EOF > kohya_ss/gui.sh
#!/usr/bin/env bash
eval "\$(conda shell.bash hook)"
source ~/.miniconda3/etc/profile.d/conda.sh
conda activate kohya
export LD_LIBRARY_PATH=\$CONDA_PREFIX/lib/python3.10/site-packages/tensorrt_libs:\$CONDA_PREFIX/lib/:\$CUDNN_PATH/lib:\$LD_LIBRARY_PATH
export MKL_THREADING_LAYER=1
SCRIPT_DIR=\$(cd -- "\$(dirname -- "\$0")" && pwd)
cd "\$SCRIPT_DIR"
python "\$SCRIPT_DIR/kohya_gui.py" "\$@"
EOF
# make executable
chmod +x kohya_ss/gui.sh