Skip to content

Commit

Permalink
Merge branch 'dev2' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
bmaltais authored Nov 11, 2023
2 parents a0cdb13 + 504c602 commit 43bd029
Show file tree
Hide file tree
Showing 12 changed files with 207 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/typos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
- uses: actions/checkout@v4

- name: typos-action
uses: crate-ci/[email protected].18
uses: crate-ci/[email protected].21
2 changes: 1 addition & 1 deletion .release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v22.1.0
v22.1.1
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ To set up the project, follow these steps:
.\setup.bat
```

During the accelerate config step use the default values as proposed during the configuration unless you know your hardware demand otherwise. Tfe amount of VRAM on your GPU does not have an impact on the values used.
During the accelerate config step use the default values as proposed during the configuration unless you know your hardware demand otherwise. The amount of VRAM on your GPU does not have an impact on the values used.

#### Optional: CUDNN 8.6

Expand Down Expand Up @@ -368,6 +368,7 @@ If you prefer to use Docker, follow the instructions below:
```bash
git clone https://github.com/bmaltais/kohya_ss.git
cd kohya_ss
docker compose create
docker compose build
docker compose run --service-ports kohya-ss-gui
```
Expand Down Expand Up @@ -626,6 +627,8 @@ save_file(state_dict, file)
ControlNet-LLLite, a novel method for ControlNet with SDXL, is added. See [documentation](./docs/train_lllite_README.md) for details.

## Change History
* 2023/11/03 (v22.1.1)
- Implement headless support for tensorboard as proposed by @sammcj

* 2023/10/10 (v22.1.0)
- Remove support for torch 1 to align with kohya_ss sd-scripts code base.
Expand Down
2 changes: 1 addition & 1 deletion docs/LoRA/top_level.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Access EDG's tutorials here: https://ko-fi.com/post/EDGs-tutorials-P5P6KT5MT

- Set the `Max resolution` to at least 1024x1024, as this is the standard resolution for SDXL.
- Use a GPU that has at least 12GB memory for the LoRA training process.
- We strongly recommend using the `--train_unet_only` option for SDXL LoRA to avoid unforeseen training results caused by dual text encoders in SDXL.
- We strongly recommend using the `--network_train_unet_only` option for SDXL LoRA to avoid unforeseen training results caused by dual text encoders in SDXL.
- PyTorch 2 tends to use less GPU memory than PyTorch 1.

Here's an example configuration for the Adafactor optimizer with a fixed learning rate:
Expand Down
2 changes: 1 addition & 1 deletion dreambooth_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ def dreambooth_tab(

button_start_tensorboard.click(
start_tensorboard,
inputs=folders.logging_dir,
inputs=[dummy_headless, folders.logging_dir],
show_progress=False,
)

Expand Down
2 changes: 1 addition & 1 deletion finetune_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ def list_presets(path):

button_start_tensorboard.click(
start_tensorboard,
inputs=logging_dir,
inputs=[dummy_headless, logging_dir],
)

button_stop_tensorboard.click(
Expand Down
17 changes: 10 additions & 7 deletions library/tensorboard_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
# Set the default tensorboard port
DEFAULT_TENSORBOARD_PORT = 6006

def start_tensorboard(logging_dir, wait_time=5):
def start_tensorboard(headless, logging_dir, wait_time=5):
global tensorboard_proc

headless_bool = True if headless.get('label') == 'True' else False

# Read the TENSORBOARD_PORT from the environment, or use the default
tensorboard_port = os.environ.get('TENSORBOARD_PORT', DEFAULT_TENSORBOARD_PORT)
Expand Down Expand Up @@ -51,13 +53,14 @@ def start_tensorboard(logging_dir, wait_time=5):
log.error('Failed to start Tensorboard:', e)
return

# Wait for some time to allow TensorBoard to start up
time.sleep(wait_time)
if not headless_bool:
# Wait for some time to allow TensorBoard to start up
time.sleep(wait_time)

# Open the TensorBoard URL in the default browser
tensorboard_url = f'http://localhost:{tensorboard_port}'
log.info(f'Opening TensorBoard URL in browser: {tensorboard_url}')
webbrowser.open(tensorboard_url)
# Open the TensorBoard URL in the default browser
tensorboard_url = f'http://localhost:{tensorboard_port}'
log.info(f'Opening TensorBoard URL in browser: {tensorboard_url}')
webbrowser.open(tensorboard_url)


def stop_tensorboard():
Expand Down
2 changes: 1 addition & 1 deletion lora_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1538,7 +1538,7 @@ def update_LoRA_settings(LoRA_type):

button_start_tensorboard.click(
start_tensorboard,
inputs=folders.logging_dir,
inputs=[dummy_headless, folders.logging_dir],
show_progress=False,
)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"adaptive_noise_scale": 0,
"additional_parameters": "",
"batch_size": "1",
"block_lr": "",
"bucket_no_upscale": false,
"bucket_reso_steps": 64,
"cache_latents": true,
"cache_latents_to_disk": true,
"caption_dropout_every_n_epochs": 0.0,
"caption_dropout_rate": 0,
"caption_extension": ".txt",
"caption_metadata_filename": "meta_cap.json",
"clip_skip": "1",
"color_aug": false,
"dataset_repeats": "1",
"epoch": 1,
"flip_aug": false,
"full_bf16": false,
"full_fp16": false,
"full_path": true,
"generate_caption_database": true,
"generate_image_buckets": true,
"gradient_accumulation_steps": 1.0,
"gradient_checkpointing": true,
"image_folder": "/kohya_ss/dataset/1_/",
"keep_tokens": 0,
"latent_metadata_filename": "meta_lat.json",
"learning_rate": 1e-06,
"logging_dir": "/kohya_ss/output/SDXL1.0_Essenz-series-by-AI_Characters_Concept_Morphing-v1.0",
"lr_scheduler": "constant",
"lr_scheduler_args": "",
"lr_warmup": 0,
"max_bucket_reso": "4096",
"max_data_loader_n_workers": "0",
"max_resolution": "1024,1024",
"max_timestep": 1000,
"max_token_length": "75",
"max_train_epochs": "100",
"mem_eff_attn": false,
"min_bucket_reso": "64",
"min_snr_gamma": 0,
"min_timestep": 0,
"mixed_precision": "fp16",
"model_list": "stabilityai/stable-diffusion-xl-base-1.0",
"multires_noise_discount": 0,
"multires_noise_iterations": 0,
"noise_offset": 0,
"noise_offset_type": "Original",
"num_cpu_threads_per_process": 2,
"optimizer": "AdamW8bit",
"optimizer_args": "",
"output_dir": "/kohya_ss/output/SDXL1.0_Essenz-series-by-AI_Characters_Concept_Morphing-v1.0",
"output_name": "SDXL1.0_Essenz-series-by-AI_Characters_Concept_Morphing-v1.0",
"persistent_data_loader_workers": false,
"pretrained_model_name_or_path": "stabilityai/stable-diffusion-xl-base-1.0",
"random_crop": false,
"resume": "",
"sample_every_n_epochs": 0,
"sample_every_n_steps": 0,
"sample_prompts": "",
"sample_sampler": "k_dpm_2",
"save_every_n_epochs": 10,
"save_every_n_steps": 0,
"save_last_n_steps": 0,
"save_last_n_steps_state": 0,
"save_model_as": "safetensors",
"save_precision": "fp16",
"save_state": false,
"scale_v_pred_loss_like_noise_pred": false,
"sdxl_cache_text_encoder_outputs": false,
"sdxl_checkbox": true,
"sdxl_no_half_vae": true,
"seed": "",
"shuffle_caption": false,
"train_batch_size": 1,
"train_dir": "/kohya_ss/output/SDXL1.0_Essenz-series-by-AI_Characters_Concept_Morphing-v1.0",
"train_text_encoder": true,
"use_latent_files": "Yes",
"use_wandb": false,
"v2": false,
"v_parameterization": false,
"v_pred_like_loss": 0,
"vae_batch_size": 0,
"wandb_api_key": "",
"weighted_captions": false,
"xformers": "xformers"
}
97 changes: 97 additions & 0 deletions presets/lora/SDXL - LoRA aitrepreneur clothing v1.0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"LoRA_type": "Standard",
"adaptive_noise_scale": 0,
"additional_parameters": "",
"block_alphas": "",
"block_dims": "",
"block_lr_zero_threshold": "",
"bucket_no_upscale": true,
"bucket_reso_steps": 64,
"cache_latents": true,
"cache_latents_to_disk": true,
"caption_dropout_every_n_epochs": 0.0,
"caption_dropout_rate": 0,
"caption_extension": ".txt",
"clip_skip": "1",
"color_aug": false,
"conv_alpha": 32,
"conv_block_alphas": "",
"conv_block_dims": "",
"conv_dim": 32,
"decompose_both": false,
"dim_from_weights": false,
"down_lr_weight": "",
"enable_bucket": true,
"epoch": 15,
"factor": -1,
"flip_aug": false,
"full_bf16": false,
"full_fp16": false,
"gradient_accumulation_steps": 2,
"gradient_checkpointing": true,
"keep_tokens": "0",
"learning_rate": 0.0009,
"lora_network_weights": "",
"lr_scheduler": "constant",
"lr_scheduler_args": "",
"lr_scheduler_num_cycles": "1",
"lr_scheduler_power": "",
"lr_warmup": 0,
"max_bucket_reso": 2048,
"max_data_loader_n_workers": "0",
"max_resolution": "1024,1024",
"max_timestep": 1000,
"max_token_length": "75",
"max_train_epochs": "",
"max_train_steps": "",
"mem_eff_attn": false,
"mid_lr_weight": "",
"min_bucket_reso": 256,
"min_snr_gamma": 0,
"min_timestep": 0,
"mixed_precision": "bf16",
"module_dropout": 0,
"multires_noise_discount": 0,
"multires_noise_iterations": 0,
"network_alpha": 1,
"network_dim": 128,
"network_dropout": 0,
"no_token_padding": false,
"noise_offset": 0,
"noise_offset_type": "Original",
"num_cpu_threads_per_process": 2,
"optimizer": "Adafactor",
"optimizer_args": "scale_parameter=False relative_step=False warmup_init=False",
"persistent_data_loader_workers": false,
"prior_loss_weight": 1.0,
"random_crop": false,
"rank_dropout": 0,
"save_every_n_epochs": 1,
"save_every_n_steps": 0,
"save_last_n_steps": 0,
"save_last_n_steps_state": 0,
"save_precision": "bf16",
"scale_v_pred_loss_like_noise_pred": false,
"scale_weight_norms": 0,
"sdxl": true,
"sdxl_cache_text_encoder_outputs": false,
"sdxl_no_half_vae": true,
"seed": "12345",
"shuffle_caption": false,
"stop_text_encoder_training": 0,
"text_encoder_lr": 0.0009,
"train_batch_size": 1,
"train_on_input": true,
"training_comment": "trigger: supergirl costume",
"unet_lr": 0.0009,
"unit": 1,
"up_lr_weight": "",
"use_cp": false,
"use_wandb": false,
"v2": false,
"v_parameterization": false,
"v_pred_like_loss": 0,
"vae_batch_size": 0,
"weighted_captions": false,
"xformers": "xformers"
}
2 changes: 1 addition & 1 deletion requirements_windows_torch2.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
torch==2.0.1+cu118 torchvision==0.15.2+cu118 --index-url https://download.pytorch.org/whl/cu118 # no_verify
xformers==0.0.21
bitsandbytes==0.35.0 # no_verify
bitsandbytes==0.41.1 # no_verify
# https://github.com/jllllll/bitsandbytes-windows-webui/releases/download/wheels/bitsandbytes-0.41.1-py3-none-win_amd64.whl # no_verify
tensorboard==2.14.1 tensorflow==2.14.0
-r requirements.txt
2 changes: 1 addition & 1 deletion textual_inversion_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ def ti_tab(

button_start_tensorboard.click(
start_tensorboard,
inputs=folders.logging_dir,
inputs=[dummy_headless, folders.logging_dir],
show_progress=False,
)

Expand Down

0 comments on commit 43bd029

Please sign in to comment.