Skip to content

Commit 4275c12

Browse files
authored
v21.7.11
- This is a significant update to how setup work across different platform. It might be causing issues... especially for linux env like runpod. If you encounter problems please report them in the issues so I can try to address them. You can revert to the previous release with `git checkout v21.7.10` The setup solution is now much more modulat and will simplify requirements support across different environments... hoping this will make it easier to run on different OS.
1 parent 4f0e1f5 commit 4275c12

35 files changed

+1372
-621
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ test/output
1919
test/logs
2020
test/*.json
2121
test/ft
22+
requirements_tmp_for_setup.txt
23+
0.13.3

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ RUN python3 -m pip install wheel
2626
## RUN python3 -m pip install -v -U git+https://github.com/facebookresearch/xformers.git@main#egg=xformers
2727

2828
# Install requirements
29-
COPY requirements_unix.txt setup.py ./
30-
RUN python3 -m pip install --use-pep517 -r requirements_unix.txt xformers
29+
COPY requirements_linux.txt ./setup/setup.py ./
30+
RUN python3 -m pip install --use-pep517 -r requirements_linux.txt xformers
3131

3232
# Replace pillow with pillow-simd
3333
RUN python3 -m pip uninstall -y pillow && \

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ If you run on Linux, there is an alternative docker container port with less lim
102102

103103
venv support need to be pre-installed. Can be done on ubuntu 22.04 with `apt install python3.10-venv`
104104

105+
For Linux, make sure to install the cudaNN drivers following the instructions from: `https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64`
106+
105107
Make sure to use a version of python >= 3.10.6 and < 3.11.0
106108

107109
#### Setup
@@ -353,6 +355,10 @@ This will store a backup file with your current locally installed pip packages a
353355

354356
## Change History
355357

358+
* 2023/06/23 (v21.7.11)
359+
- This is a significant update to how setup work across different platform. It might be causing issues... especially for linux env like runpod. If you encounter problems please report them in the issues so I can try to address them. You can revert to the previous release with `git checkout v21.7.10`
360+
361+
The setup solution is now much more modulat and will simplify requirements support across different environments... hoping this will make it easier to run on different OS.
356362
* 2023/06/19 (v21.7.10)
357363
- Quick fix for linux GUI startup where it would try to install darwin requirements on top of linux. Ugly fix but work. Hopefulle some linux user will improve via a PR.
358364
* 2023/06/18 (v21.7.9)

gui.bat

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
call .\venv\Scripts\deactivate.bat
44

55
:: Calling external python program to check for local modules
6-
python .\tools\check_local_modules.py --no_question
6+
python .\setup\check_local_modules.py --no_question
77

88
:: Activate the virtual environment
99
call .\venv\Scripts\activate.bat
1010
set PATH=%PATH%;%~dp0venv\Lib\site-packages\torch\lib
1111

1212
:: Validate requirements
13-
python.exe .\tools\validate_requirements.py
13+
python.exe .\setup\validate_requirements.py
1414

1515
:: If the exit code is 0, run the kohya_gui.py script with the command-line arguments
1616
if %errorlevel% equ 0 (
17-
python.exe kohya_gui.py %*
17+
cmd /k python.exe kohya_gui.py %*
1818
)

gui.ps1

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ if ($pipOutput) {
2929
$env:PATH += ";$($MyInvocation.MyCommand.Path)\venv\Lib\site-packages\torch\lib"
3030

3131
# Debug info about system
32-
# python.exe .\tools\debug_info.py
32+
# python.exe .\setup\debug_info.py
3333

3434
# Validate the requirements and store the exit code
35-
python.exe .\tools\validate_requirements.py
35+
python.exe .\setup\validate_requirements.py
3636

3737
# If the exit code is 0, read arguments from gui_parameters.txt (if it exists)
3838
# and run the kohya_gui.py script with the command-line arguments

gui.sh

+8-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ cd "$SCRIPT_DIR"
1717
source "$SCRIPT_DIR/venv/bin/activate"
1818

1919
# If the requirements are validated, run the kohya_gui.py script with the command-line arguments
20-
if python "$SCRIPT_DIR"/tools/validate_requirements_unix.py -r "$SCRIPT_DIR"/requirements_unix.txt; then
21-
python "$SCRIPT_DIR/kohya_gui.py" "$@"
20+
if [[ "$OSTYPE" == "darwin"* ]]; then
21+
if python "$SCRIPT_DIR"/setup/validate_requirements.py -r "$SCRIPT_DIR"/requirements_macos.txt; then
22+
python "$SCRIPT_DIR/kohya_gui.py" "$@"
23+
fi
24+
else
25+
if python "$SCRIPT_DIR"/setup/validate_requirements.py -r "$SCRIPT_DIR"/requirements_linux.txt; then
26+
python "$SCRIPT_DIR/kohya_gui.py" "$@"
27+
fi
2228
fi

library/convert_model_gui.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ def gradio_convert_model_tab(headless=False):
174174
gr.Markdown(
175175
'This utility can be used to convert from one stable diffusion model format to another.'
176176
)
177+
178+
model_ext = gr.Textbox(value='*.safetensors *.ckpt', visible=False)
179+
model_ext_name = gr.Textbox(value='Model types', visible=False)
180+
177181
with gr.Row():
178182
source_model_input = gr.Textbox(
179183
label='Source model',
@@ -198,7 +202,7 @@ def gradio_convert_model_tab(headless=False):
198202
)
199203
button_source_model_file.click(
200204
get_file_path,
201-
inputs=[source_model_input],
205+
inputs=[source_model_input, model_ext, model_ext_name],
202206
outputs=source_model_input,
203207
show_progress=False,
204208
)

library/custom_logging.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import logging
33
import time
4+
import sys
45

56
from rich.theme import Theme
67
from rich.logging import RichHandler
@@ -23,7 +24,10 @@ def setup_logging(clean=False, debug=False):
2324
except:
2425
pass
2526

26-
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s | %(levelname)s | %(pathname)s | %(message)s', filename='setup.log', filemode='a', encoding='utf-8', force=True)
27+
if sys.version_info >= (3, 9):
28+
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s | %(levelname)s | %(pathname)s | %(message)s', filename='setup.log', filemode='a', encoding='utf-8', force=True)
29+
else:
30+
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s | %(levelname)s | %(pathname)s | %(message)s', filename='setup.log', filemode='a', force=True)
2731

2832
console = Console(log_time=True, log_time_format='%H:%M:%S-%f', theme=Theme({
2933
"traceback.border": "black",

pyproject.toml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[build-system]
2+
requires = ["poetry-core>=1.0.0"]
3+
build-backend = "poetry.core.masonry.api"
4+
5+
[tool.poetry]
6+
name = "library"
7+
version = "1.0.3"
8+
description = "Libraries required to run kohya_ss GUI"
9+
authors = ["Bernard Maltais <bernard@ducourier.com>"]
10+
license = "Apache-2.0" # Apache Software License
11+
12+
[[tool.poetry.source]]
13+
name = "library"
14+
path = "library"
15+
16+
[tool.poetry.dependencies]
17+
python = ">=3.9,<3.11"
18+
19+
[tool.poetry.dev-dependencies]
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
accelerate==0.19.0
21
albumentations==1.3.0
32
altair==4.2.2
43
bitsandbytes==0.35.0
@@ -8,25 +7,20 @@ easygui==0.98.3
87
einops==0.6.0
98
fairscale==0.4.13
109
ftfy==6.1.1
11-
gradio==3.23.0; sys_platform == 'darwin'
12-
gradio==3.32.0; sys_platform != 'darwin'
13-
huggingface-hub==0.13.3; sys_platform == 'darwin'
14-
huggingface-hub==0.13.3; sys_platform != 'darwin'
10+
gradio==3.33.1
11+
huggingface-hub>=0.13.3
1512
lion-pytorch==0.0.6
1613
lycoris_lora==0.1.6
1714
opencv-python==4.7.0.68
1815
prodigyopt==1.0
1916
pytorch-lightning==1.9.0
2017
rich==13.4.1
2118
safetensors==0.2.6
22-
tensorboard==2.10.1 ; sys_platform != 'darwin'
23-
tensorboard==2.12.1 ; sys_platform == 'darwin'
24-
tensorflow==2.10.1; sys_platform != 'darwin'
2519
timm==0.6.12
2620
tk==0.1.0
2721
toml==0.10.2
2822
transformers==4.26.0
2923
voluptuous==0.13.1
3024
wandb==0.15.0
3125
# for kohya_ss library
32-
.
26+
-e . # no_verify leave this to specify not checking this a verification stage

requirements_linux.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
torch==2.0.1+cu118 torchvision==0.15.2+cu118 --extra-index-url https://download.pytorch.org/whl/cu118 # no_verify leave this to specify not checking this a verification stage
2+
xformers==0.0.20
3+
accelerate==0.19.0 tensorboard==2.12.1 tensorflow==2.12.0
4+
-r requirements.txt

requirements_macos_amd64.txt

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
torch==2.0.0 torchvision==0.15.1 -f https://download.pytorch.org/whl/cpu/torch_stable.html
2+
xformers
3+
accelerate==0.19.0 tensorflow-macos tensorboard==2.12.1
4+
-r requirements.txt
5+
6+
# accelerate==0.15.0
7+
# albumentations==1.3.0
8+
# altair==4.2.2
9+
# bitsandbytes==0.35.0
10+
# dadaptation==3.1
11+
# diffusers[torch]==0.10.2
12+
# easygui==0.98.3
13+
# einops==0.6.0
14+
# fairscale==0.4.13
15+
# ftfy==6.1.1
16+
# gradio==3.23.0
17+
# huggingface-hub==0.13.0
18+
# lion-pytorch==0.0.6
19+
# lycoris_lora==0.1.6
20+
# opencv-python==4.7.0.68
21+
# pytorch-lightning==1.9.0
22+
# rich==13.4.1
23+
# safetensors==0.2.6
24+
# timm==0.6.12
25+
# tk==0.1.0
26+
# toml==0.10.2
27+
# transformers==4.26.0
28+
# voluptuous==0.13.1
29+
# wandb==0.15.0
30+
# # for kohya_ss library
31+
# .

requirements_macos_arm64.txt

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
torch==2.0.0 torchvision==0.15.1 -f https://download.pytorch.org/whl/cpu/torch_stable.html
2+
xformers
3+
accelerate==0.19.0 tensorflow-metal tensorboard==2.12.1
4+
-r requirements.txt
5+
6+
# accelerate==0.15.0
7+
# albumentations==1.3.0
8+
# altair==4.2.2
9+
# bitsandbytes==0.35.0
10+
# dadaptation==3.1
11+
# diffusers[torch]==0.10.2
12+
# easygui==0.98.3
13+
# einops==0.6.0
14+
# fairscale==0.4.13
15+
# ftfy==6.1.1
16+
# gradio==3.23.0
17+
# huggingface-hub==0.13.0
18+
# lion-pytorch==0.0.6
19+
# lycoris_lora==0.1.6
20+
# opencv-python==4.7.0.68
21+
# pytorch-lightning==1.9.0
22+
# rich==13.4.1
23+
# safetensors==0.2.6
24+
# timm==0.6.12
25+
# tk==0.1.0
26+
# toml==0.10.2
27+
# transformers==4.26.0
28+
# voluptuous==0.13.1
29+
# wandb==0.15.0
30+
# # for kohya_ss library
31+
# .

requirements_unix.txt

-31
This file was deleted.

requirements_windows_torch1.txt

+31-29
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
1-
accelerate==0.15.0
2-
albumentations==1.3.0
3-
altair==4.2.2
4-
bitsandbytes==0.35.0
5-
dadaptation==3.1
6-
diffusers[torch]==0.10.2
7-
easygui==0.98.3
8-
einops==0.6.0
9-
fairscale==0.4.13
10-
ftfy==6.1.1
11-
gradio==3.32.0
12-
huggingface-hub==0.13.3
13-
lion-pytorch==0.0.6
14-
lycoris_lora==0.1.6
15-
opencv-python==4.7.0.68
16-
prodigyopt==1.0
17-
pytorch-lightning==1.9.0
18-
rich==13.4.1
19-
safetensors==0.2.6
20-
tensorboard==2.10.1
21-
tensorflow==2.10.1
22-
timm==0.6.12
23-
tk==0.1.0
24-
toml==0.10.2
25-
transformers==4.26.0
26-
voluptuous==0.13.1
27-
wandb==0.15.0
28-
# for kohya_ss library
29-
.
1+
torch==1.12.1+cu116 torchvision==0.13.1+cu116 --index-url https://download.pytorch.org/whl/cu116 # no_verify
2+
https://github.com/C43H66N12O12S2/stable-diffusion-webui/releases/download/f/xformers-0.0.14.dev0-cp310-cp310-win_amd64.whl -U -I --no-deps # no_verify
3+
accelerate==0.15.0 tensorboard==2.10.1 tensorflow==2.10.1
4+
-r requirements.txt
5+
6+
# albumentations==1.3.0
7+
# altair==4.2.2
8+
# bitsandbytes==0.35.0
9+
# dadaptation==3.1
10+
# diffusers[torch]==0.10.2
11+
# easygui==0.98.3
12+
# einops==0.6.0
13+
# fairscale==0.4.13
14+
# ftfy==6.1.1
15+
# gradio==3.32.0
16+
# huggingface-hub==0.13.3
17+
# lion-pytorch==0.0.6
18+
# lycoris_lora==0.1.6
19+
# opencv-python==4.7.0.68
20+
# prodigyopt==1.0
21+
# pytorch-lightning==1.9.0
22+
# rich==13.4.1
23+
# safetensors==0.2.6
24+
# timm==0.6.12
25+
# tk==0.1.0
26+
# toml==0.10.2
27+
# transformers==4.26.0
28+
# voluptuous==0.13.1
29+
# wandb==0.15.0
30+
# # for kohya_ss library
31+
# .

0 commit comments

Comments
 (0)