diff --git a/README.md b/README.md index 79af78a..fc5ca77 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,14 @@ - Implementation GUI of [Merge Block Weighted] (https://note.com/kohya_ss/n/n9a485a066d5b) idea by kohya_ss - change some part of script to adjust for AUTO1111, basic method is not changed. - - # Recent Update +- 2023/01/12: Add some function + - Save as half + - Save as safetensors + - Select of "Skip/Reset CKIP `position_ids`" + - 2022/12/25: Add new feature and new UI - - Read "README" [English](README_each.md)/[日本語](README_each.ja.md) # @@ -21,22 +23,31 @@ ## Table of contents - * [How to Install](#how-to-install) - * [How to use](#how-to-use) - * [Select `model_A` and `model_B`, and input `Output model name`](#select-model_a-and-model_b-and-input-output-model-name) - * [Set merge ratio for each block of U-Net](#set-merge-ratio-for-each-block-of-u-net) - * [Setting values](#setting-values) - * [Other settings](other-settings) - * [Other function](#other-function) - * [Save Merge Log](#save-merge-log) - * [Sample/Example](#sampleexample) - * [result (x/y)](#result-xy) - * [後述1: weight1](#%E5%BE%8C%E8%BF%B01-weight1) - * [後述2: weight2](#%E5%BE%8C%E8%BF%B02-weight2) - * [Preset's grids](#presets-grids) - * [Examples of Sigmoid-like Functions](#examples-of-sigmoid-like-functions) - * [Special Thanks](#special-thanks) - + +* [How to Install](#how-to-install) + +* [How to use](#how-to-use) + + * [Select `model_A` and `model_B`, and input `Output model name`](#select-model_a-and-model_b-and-input-output-model-name) + * [Set merge ratio for each block of U-Net](#set-merge-ratio-for-each-block-of-u-net) + * [Setting values](#setting-values) + * [Other settings](other-settings) + +* [Other function](#other-function) + + * [Save Merge Log](#save-merge-log) + +* [Sample/Example](#sampleexample) + + * [result (x/y)](#result-xy) + * [後述1: weight1](#%E5%BE%8C%E8%BF%B01-weight1) + * [後述2: weight2](#%E5%BE%8C%E8%BF%B02-weight2) + * [Preset's grids](#presets-grids) + * [Examples of Sigmoid-like Functions](#examples-of-sigmoid-like-functions) + +* [Special Thanks](#special-thanks) + + ## How to Install @@ -78,10 +89,12 @@ - Weights must have 25 values and comma separated -### Setting values +## Setting values ![](misc/bw05.png) +### base_alpha + - set "base_alpha" | base_alpha | | @@ -98,6 +111,27 @@ - Merged output is saved in normal "Model" folder. +### Save as half / safetensors + +![](misc/bw09.png) + +- Settings about save + + - "Save as half" mean float16 + + - "Save as safetensors". If you set your output file ext as `.safetensors`, automaticaly saved as safetensors with/without this setting. + +### Skip/Reset CKIP `position_ids`key value + +![](misc/bw10.png) + +- In this function, you can select treatment of `position_ids` value in CLIP. +- Values in this key controls matching of your prompt and embeddings. +- I've try to found the cause of 'Some model ignore No.1 token(word)' problem, and write some report about that. (https://note.com/bbcmc/n/n12c05bf109cc) +- Arenatemp already have spectation of inside of models, and published Extension to fix this CLIP key problem. See also, + - [stable-diffusion-webui-model-toolkit](https://github.com/arenatemp/stable-diffusion-webui-model-toolkit) +- MBW is also affected by this problem, because some model may (potensialy) have this issue, and causes/transfer some trouble to merged result model. + ## Other function ### Save Merge Log diff --git a/misc/bw01-1.png b/misc/bw01-1.png index f0dc6a8..aa9a7c3 100644 Binary files a/misc/bw01-1.png and b/misc/bw01-1.png differ diff --git a/misc/bw01.png b/misc/bw01.png deleted file mode 100644 index b1af269..0000000 Binary files a/misc/bw01.png and /dev/null differ diff --git a/misc/bw09.png b/misc/bw09.png new file mode 100644 index 0000000..134519f Binary files /dev/null and b/misc/bw09.png differ diff --git a/misc/bw10.png b/misc/bw10.png new file mode 100644 index 0000000..fa0a3fc Binary files /dev/null and b/misc/bw10.png differ diff --git a/misc/each/each_00.png b/misc/each/each_00.png index d94ef7a..13487ee 100644 Binary files a/misc/each/each_00.png and b/misc/each/each_00.png differ diff --git a/scripts/mbw/ui_mbw.py b/scripts/mbw/ui_mbw.py index 6f7a62c..72950eb 100644 --- a/scripts/mbw/ui_mbw.py +++ b/scripts/mbw/ui_mbw.py @@ -17,11 +17,11 @@ def on_ui_tabs(): with gr.Column(): with gr.Row(): with gr.Column(variant="panel"): + html_output_block_weight_info = gr.HTML() with gr.Row(): btn_do_merge_block_weighted = gr.Button(value="Run Merge", variant="primary") btn_clear_weight = gr.Button(value="Clear values") btn_reload_checkpoint_mbw = gr.Button(value="Reload checkpoint") - html_output_block_weight_info = gr.HTML() with gr.Column(): dd_preset_weight = gr.Dropdown(label="Preset Weights", choices=presetWeights.get_preset_name_list()) txt_block_weight = gr.Text(label="Weight values", placeholder="Put weight sets. float number x 25") @@ -32,10 +32,11 @@ def on_ui_tabs(): chk_allow_overwrite = gr.Checkbox(label="Allow overwrite output-model", value=False) with gr.Row(): with gr.Column(scale=3): - chk_save_as_half = gr.Checkbox(label="Save as half", value=False) - chk_save_as_safetensors = gr.Checkbox(label="Save as safetensors", value=False) + with gr.Row(): + chk_save_as_half = gr.Checkbox(label="Save as half", value=False) + chk_save_as_safetensors = gr.Checkbox(label="Save as safetensors", value=False) with gr.Column(scale=4): - radio_position_ids = gr.Radio(label="Skip/Reset CLIP position_ids", choices=["None", "Skip", "Force Reset"], value="Skip", type="index") + radio_position_ids = gr.Radio(label="Skip/Reset CLIP position_ids", choices=["None", "Skip", "Force Reset"], value="None", type="index") with gr.Row(): model_A = gr.Dropdown(label="Model A", choices=sd_models.checkpoint_tiles()) model_B = gr.Dropdown(label="Model B", choices=sd_models.checkpoint_tiles()) diff --git a/scripts/mbw_each/ui_mbw_each.py b/scripts/mbw_each/ui_mbw_each.py index 386ca68..3066d0a 100644 --- a/scripts/mbw_each/ui_mbw_each.py +++ b/scripts/mbw_each/ui_mbw_each.py @@ -17,13 +17,13 @@ def on_ui_tabs(): with gr.Column(): with gr.Row(): with gr.Column(variant="panel"): + with gr.Row(): + txt_multi_process_cmd = gr.TextArea(label="Multi Proc Cmd", placeholder="Keep empty if dont use.") + html_output_block_weight_info = gr.HTML() with gr.Row(): btn_do_merge_block_weighted = gr.Button(value="Run Merge", variant="primary") btn_clear_weighted = gr.Button(value="Clear values") btn_reload_checkpoint_mbw = gr.Button(value="Reload checkpoint") - with gr.Row(): - txt_multi_process_cmd = gr.TextArea(label="Multi Proc Cmd", placeholder="Keep empty if dont use.") - html_output_block_weight_info = gr.HTML() with gr.Column(): dd_preset_weight = gr.Dropdown(label="Preset_Weights", choices=presetWeights.get_preset_name_list()) txt_block_weight = gr.Text(label="Weight_values", placeholder="Put weight sets. float number x 25") @@ -34,10 +34,11 @@ def on_ui_tabs(): chk_allow_overwrite = gr.Checkbox(label="Allow overwrite output-model", value=False) with gr.Row(): with gr.Column(scale=3): - chk_save_as_half = gr.Checkbox(label="Save as half", value=False) - chk_save_as_safetensors = gr.Checkbox(label="Save as safetensors", value=False) + with gr.Row(): + chk_save_as_half = gr.Checkbox(label="Save as half", value=False) + chk_save_as_safetensors = gr.Checkbox(label="Save as safetensors", value=False) with gr.Column(scale=4): - radio_position_ids = gr.Radio(label="Skip/Reset CLIP position_ids", choices=["None", "Skip", "Force Reset"], value="Skip", type="index") + radio_position_ids = gr.Radio(label="Skip/Reset CLIP position_ids", choices=["None", "Skip", "Force Reset"], value="None", type="index") with gr.Row(): dd_model_A = gr.Dropdown(label="Model_A", choices=sd_models.checkpoint_tiles()) dd_model_B = gr.Dropdown(label="Model_B", choices=sd_models.checkpoint_tiles())