-
Notifications
You must be signed in to change notification settings - Fork 4
/
installShivam.bat
142 lines (115 loc) · 4.49 KB
/
installShivam.bat
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
@echo off
cls
echo Checking dependancies
set "VENV_NAME=venv_diffusers_sd_2"
set "VENV_PATH=venv_diffusers_sd_2"
WHERE conda --version
IF %ERRORLEVEL% NEQ 0 (
echo Conda wasn't found. Install conda and run "conda init cmd.exe"
exit
) else (echo Conda is available)
WHERE git --version
IF %ERRORLEVEL% NEQ 0 (
echo Git wasn't found. Install git and make sure it is in PATH
exit
) else (echo Git is available)
if exist %VENV_NAME%\ (
echo Error, a Shivam venv already exists, you cannot install it again without removing %VENV_NAME% first
exit
)
echo Creating Venv
call python -m venv venv_diffusers_sd_2
call venv_diffusers_sd_2\Scripts\activate.ps1
echo Cloning ShivamShrirao
call git clone -q https://github.com/ShivamShrirao/diffusers.git code/resources/shivam
echo Cloning Bitsandbytes
call git clone -q https://github.com/bmaltais/kohya_ss.git code/resources/kohya_ss
echo Installing Torch
call pip install torch==1.12.1+cu116 torchvision==0.13.1+cu116 --extra-index-url https://download.pytorch.org/whl/cu116
echo Installing Diffusers
call pip install git+https://github.com/ShivamShrirao/diffusers.git
echo Installing requirements
cd code/resources/shivam/examples/dreambooth
(
echo accelerate
echo transformers^>=4.21.0
echo ftfy
echo albumentations
echo tensorboard
echo modelcards
) > requirements.txt
call pip install -U -r requirements.txt
call pip install --upgrade git+https://github.com/huggingface/diffusers.git transformers accelerate scipy
cd ../../../../..
echo Installing OmegaCong
call pip install OmegaConf
echo Installing pytorch_lightning
call pip install pytorch_lightning
echo Installing xformers
call pip install -U -I --no-deps https://github.com/C43H66N12O12S2/stable-diffusion-webui/releases/download/f/xformers-0.0.14.dev0-cp310-cp310-win_amd64.whl
echo Installing bitsandbytes
call pip install bitsandbytes==0.35.0
echo Overwriting bitsandbytes libraries
echo Copying resources in Shivam
copy /y "code\resources\kohya_ss\bitsandbytes_windows\*.dll" "%VENV_PATH%\Lib\site-packages\bitsandbytes\"
copy /y "code\resources\kohya_ss\bitsandbytes_windows\cextension.py" "%VENV_PATH%\Lib\site-packages\bitsandbytes\cextension.py"
copy /y "code\resources\kohya_ss\bitsandbytes_windows\main.py" "%VENV_PATH%\Lib\site-packages\bitsandbytes\cuda_setup\main.py"
echo Environment configuration
call accelerate config
call accelerate env
echo Shivam installed
echo Cloning SD 2.1 512
call git init -q models\SD-2-1-512
cd models\SD-2-1-512
call git lfs install
call git remote add -f origin https://huggingface.co/stabilityai/stable-diffusion-2-1-base
call git config core.sparseCheckout true
echo scheduler/ >> .git/info/sparse-checkout
echo text_encoder/ >> .git/info/sparse-checkout
echo tokenizer/ >> .git/info/sparse-checkout
echo unet/ >> .git/info/sparse-checkout
echo vae/ >> .git/info/sparse-checkout
echo model_index.json >> .git/info/sparse-checkout
call git pull -q origin main
cd ..\..
echo Cloning SD 2.1 512
call git init -q models\SD-2-1-768
cd models\SD-2-1-768
call git lfs install
call git remote add -f origin https://huggingface.co/stabilityai/stable-diffusion-2-1
call git config core.sparseCheckout true
echo scheduler/ >> .git/info/sparse-checkout
echo text_encoder/ >> .git/info/sparse-checkout
echo tokenizer/ >> .git/info/sparse-checkout
echo unet/ >> .git/info/sparse-checkout
echo vae/ >> .git/info/sparse-checkout
echo model_index.json >> .git/info/sparse-checkout
call git pull -q origin main
cd ..\..
echo Create data directories
mkdir data
cd data
mkdir reg_images
mkdir instance_images
cd ..
echo Cloning LORA
call git clone -q https://github.com/cloneofsimo/lora.git code/resources/lora
cd code/resources/lora
call pip install -U -r requirements.txt
cd ..\..\..
echo End of install
pause
call pip uninstall torch
call pip uninstall torchvision
call pip install torch==1.12.1+cu116 torchvision==0.13.1+cu116 --extra-index-url https://download.pytorch.org/whl/cu116
call pip uninstall diffusers
call pip install --upgrade diffusers==0.10.0
mkdir outputs
mkdir outputs\txt2img-images
wget https://raw.githubusercontent.com/thibaudart/dreambooth-768/main/train_dreambooth_768.py -O code/resources/shivam/examples/dreambooth/train_dreambooth_768.py
echo to have intermediate checkpoint (we must fix it with: https://github.com/tcapelle/diffusers/commit/d3885e21d0aa237d4c5f6882a4a5da3015c278e3 it ll be better)
call pip uninstall accelerate
call pip install accelerate==0.14.0
call accelerate config
echo new install of lora for inference
call pip install git+https://github.com/cloneofsimo/lora.git