diff --git a/README.md b/README.md index c400a63f3..7c03e8863 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/vladmandic) -![Last Commit](https://img.shields.io/github/last-commit/vladmandic/human?style=flat-square&svg=true) -![License](https://img.shields.io/github/license/vladmandic/human?style=flat-square&svg=true) -![GitHub Status Checks](https://img.shields.io/github/checks-status/vladmandic/human/main?style=flat-square&svg=true) +![Last Commit](https://img.shields.io/github/last-commit/vladmandic/automatic?style=flat-square&svg=true) +![License](https://img.shields.io/github/license/vladmandic/automatic?style=flat-square&svg=true) +![GitHub Status Checks](https://img.shields.io/github/checks-status/vladmandic/automatic/main?style=flat-square&svg=true) # SD.Next diff --git a/TODO.md b/TODO.md index cc1b284d6..f6f064d70 100644 --- a/TODO.md +++ b/TODO.md @@ -23,14 +23,12 @@ Stuff to be investigated... Pick & merge PRs from main repo... -- Compare commits: - -## Models - -StabilityAI is working on new stuff... - -- SD XL -- SD ReImagined +- +- TODO: + - ruff stuff from 05/10/2023 + - modules/sub_quadratic_attention.py + - +- STATUS: up-to-date 05/13/2023 ## Integration @@ -50,14 +48,9 @@ Tech that can be integrated as part of the core workflow... - Bunch of stuff: - -- -- - shared.info -- hints -- localization - docker - port `p.all_hr_prompts` - test `lyco_patch_lora` - fix `lyco` logging - save `ui-settings.json` -- `data-dir` security issues diff --git a/extensions-builtin/sd-webui-controlnet b/extensions-builtin/sd-webui-controlnet index 4f884009e..fb86dffcb 160000 --- a/extensions-builtin/sd-webui-controlnet +++ b/extensions-builtin/sd-webui-controlnet @@ -1 +1 @@ -Subproject commit 4f884009efddf72c33493e3a7927f04817a719d7 +Subproject commit fb86dffcb169d38ce53226d3a03e8aee9252ef67 diff --git a/modules/codeformer/codeformer_arch.py b/modules/codeformer/codeformer_arch.py index 11dcc3ee7..ef83c2f75 100644 --- a/modules/codeformer/codeformer_arch.py +++ b/modules/codeformer/codeformer_arch.py @@ -121,7 +121,6 @@ class TransformerSALayer(nn.Module): tgt_mask: Optional[Tensor] = None, tgt_key_padding_mask: Optional[Tensor] = None, query_pos: Optional[Tensor] = None): - # self attention tgt2 = self.norm1(tgt) q = k = self.with_pos_embed(tgt2, query_pos) @@ -275,4 +274,4 @@ class CodeFormer(VQAutoEncoder): x = self.fuse_convs_dict[f_size](enc_feat_dict[f_size].detach(), x, w) out = x # logits doesn't need softmax before cross_entropy loss - return out, logits, lq_feat \ No newline at end of file + return out, logits, lq_feat diff --git a/modules/generation_parameters_copypaste.py b/modules/generation_parameters_copypaste.py index 7f68b0cb9..5abd7cfc4 100644 --- a/modules/generation_parameters_copypaste.py +++ b/modules/generation_parameters_copypaste.py @@ -2,6 +2,7 @@ import base64 import io import os import re +import json from PIL import Image import gradio as gr @@ -34,12 +35,18 @@ def reset(): def quote(text): - if ',' not in str(text): + if ',' not in str(text) and '\n' not in str(text) and ':' not in str(text): + return text + return json.dumps(text, ensure_ascii=False) + + +def unquote(text): + if len(text) == 0 or text[0] != '"' or text[-1] != '"': + return text + try: + return json.loads(text) + except Exception: return text - text = str(text) - text = text.replace('\\', '\\\\') - text = text.replace('"', '\\"') - return f'"{text}"' def image_from_url_text(filedata): @@ -259,13 +266,16 @@ Steps: 20, Sampler: Euler a, CFG scale: 7, Seed: 965400086, Size: 512x512, Model res["Prompt"] = prompt res["Negative prompt"] = negative_prompt for k, v in re_param.findall(lastline): - v = v[1:-1] if len(v) > 0 and v[0] == '"' and v[-1] == '"' else v + if v[0] == '"' and v[-1] == '"': + v = unquote(v) m = re_imagesize.match(v) if m is not None: res[f"{k}-1"] = m.group(1) res[f"{k}-2"] = m.group(2) else: res[k] = v + + # Missing CLIP skip means it was set to 1 (the default) if "Clip skip" not in res: res["Clip skip"] = "1" diff --git a/modules/hypernetworks/ui.py b/modules/hypernetworks/ui.py index 76599f5ad..593f1c745 100644 --- a/modules/hypernetworks/ui.py +++ b/modules/hypernetworks/ui.py @@ -7,13 +7,13 @@ import modules.hypernetworks.hypernetwork from modules import devices, sd_hijack, shared not_available = ["hardswish", "multiheadattention"] -keys = list(x for x in modules.hypernetworks.hypernetwork.HypernetworkModule.activation_dict.keys() if x not in not_available) +keys = list(x for x in modules.hypernetworks.hypernetwork.HypernetworkModule.activation_dict if x not in not_available) def create_hypernetwork(name, enable_sizes, overwrite_old, layer_structure=None, activation_func=None, weight_init=None, add_layer_norm=False, use_dropout=False, dropout_structure=None): filename = modules.hypernetworks.hypernetwork.create_hypernetwork(name, enable_sizes, overwrite_old, layer_structure, activation_func, weight_init, add_layer_norm, use_dropout, dropout_structure) - return gr.Dropdown.update(choices=sorted([x for x in shared.hypernetworks.keys()])), f"Created: {filename}", "" + return gr.Dropdown.update(choices=sorted([x for x in shared.hypernetworks])), f"Created: {filename}", "" def train_hypernetwork(*args): diff --git a/modules/models/diffusion/uni_pc/uni_pc.py b/modules/models/diffusion/uni_pc/uni_pc.py index 0ff426ae3..5b10b35ac 100644 --- a/modules/models/diffusion/uni_pc/uni_pc.py +++ b/modules/models/diffusion/uni_pc/uni_pc.py @@ -277,6 +277,8 @@ def model_wrapper( Returns: A noise prediction model that accepts the noised data and the continuous time as the inputs. """ + model_kwargs = model_kwargs or {} + classifier_kwargs = classifier_kwargs or {} def get_model_input_time(t_continuous): """ diff --git a/modules/paths_internal.py b/modules/paths_internal.py index 2601e4709..3c2ce7fba 100644 --- a/modules/paths_internal.py +++ b/modules/paths_internal.py @@ -3,7 +3,8 @@ import argparse import os -script_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) +modules_path = os.path.dirname(os.path.realpath(__file__)) +script_path = os.path.dirname(modules_path) sd_configs_path = os.path.join(script_path, "configs") sd_default_config = os.path.join(sd_configs_path, "v1-inference.yaml") sd_model_file = os.path.join(script_path, 'model.ckpt') @@ -11,7 +12,7 @@ default_sd_model_file = sd_model_file # Parse the --data-dir flag first so we can use it as a base for our other argument default values parser_pre = argparse.ArgumentParser(add_help=False) -parser_pre.add_argument("--data-dir", type=str, default=os.path.dirname(os.path.dirname(os.path.realpath(__file__))), help="base path where all user data is stored",) +parser_pre.add_argument("--data-dir", type=str, default=os.path.dirname(modules_path), help="base path where all user data is stored", ) parser_pre.add_argument("--models-dir", type=str, default="models", help="base path where all models are stored",) cmd_opts_pre = parser_pre.parse_known_args()[0] data_path = cmd_opts_pre.data_dir diff --git a/modules/textual_inversion/textual_inversion.py b/modules/textual_inversion/textual_inversion.py index e09adc184..abff2c7ba 100644 --- a/modules/textual_inversion/textual_inversion.py +++ b/modules/textual_inversion/textual_inversion.py @@ -165,8 +165,7 @@ class EmbeddingDatabase: # textual inversion embeddings if 'string_to_param' in data: param_dict = data['string_to_param'] - if hasattr(param_dict, '_parameters'): - param_dict = getattr(param_dict, '_parameters') # fix for torch 1.12.1 loading saved file from torch 1.11 + param_dict = getattr(param_dict, '_parameters', param_dict) # fix for torch 1.12.1 loading saved file from torch 1.11 assert len(param_dict) == 1, 'embedding file has multiple terms in it' emb = next(iter(param_dict.items()))[1] # diffuser concepts @@ -437,7 +436,7 @@ def train_embedding(id_task, embedding_name, learn_rate, batch_size, gradient_st shared.log.info("No saved optimizer exists in checkpoint") if shared.cmd_opts.use_ipex: - scaler = ipex.cpu.autocast._grad_scaler.GradScaler() #scaler.step(optimizer): PI_ERROR_INVALID_ARG_VALUE + scaler = ipex.cpu.autocast._grad_scaler.GradScaler() #scaler.step(optimizer): PI_ERROR_INVALID_ARG_VALUE # pylint: disable=protected-access shared.sd_model = shared.sd_model.to(dtype=torch.float32) shared.sd_model.train() shared.sd_model, optimizer = ipex.optimize(shared.sd_model, optimizer=optimizer, dtype=devices.dtype) diff --git a/modules/ui.py b/modules/ui.py index 082f973bc..96ed73baf 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -1048,8 +1048,8 @@ def create_ui(): train_embedding_name = gr.Dropdown(label='Embedding', elem_id="train_embedding", choices=sorted(sd_hijack.model_hijack.embedding_db.word_embeddings.keys())) create_refresh_button(train_embedding_name, sd_hijack.model_hijack.embedding_db.load_textual_inversion_embeddings, lambda: {"choices": sorted(sd_hijack.model_hijack.embedding_db.word_embeddings.keys())}, "refresh_train_embedding_name") - train_hypernetwork_name = gr.Dropdown(label='Hypernetwork', elem_id="train_hypernetwork", choices=[x for x in modules.shared.hypernetworks.keys()]) - create_refresh_button(train_hypernetwork_name, modules.shared.reload_hypernetworks, lambda: {"choices": sorted([x for x in modules.shared.hypernetworks.keys()])}, "refresh_train_hypernetwork_name") + train_hypernetwork_name = gr.Dropdown(label='Hypernetwork', elem_id="train_hypernetwork", choices=sorted(modules.shared.hypernetworks)) + create_refresh_button(train_hypernetwork_name, modules.shared.reload_hypernetworks, lambda: {"choices": sorted(modules.shared.hypernetworks)}, "refresh_train_hypernetwork_name") with FormRow(): embedding_learn_rate = gr.Textbox(label='Embedding Learning rate', placeholder="Embedding Learning rate", value="0.005", elem_id="train_embedding_learn_rate") @@ -1276,8 +1276,6 @@ def create_ui(): elem_id = f"setting_{key}" if not is_quicksettings: - # FIXME: the visibility is only copied once initially, so if the user changes it, it won't be updated - # This can probably be fixed by using a proper wrapper element dirtyable_setting = gr.Group(elem_classes="dirtyable", visible=(args or {}).get("visible", True)) dirtyable_setting.__enter__() dirty_indicator = gr.Button( @@ -1368,7 +1366,7 @@ def create_ui(): quicksettings_names = opts.quicksettings_list quicksettings_names = {x: i for i, x in enumerate(quicksettings_names) if x != 'quicksettings'} quicksettings_list = [] - previous_section = None + previous_section = [] tab_item_keys = [] current_tab = None current_row = None @@ -1377,7 +1375,7 @@ def create_ui(): section_must_be_skipped = item.section[0] is None if previous_section != item.section and not section_must_be_skipped: elem_id, text = item.section - if current_tab is not None: + if current_tab is not None and len(previous_section) > 0: create_dirty_indicator(previous_section[0], tab_item_keys) tab_item_keys = [] current_row.__exit__() @@ -1397,7 +1395,7 @@ def create_ui(): component_dict[k] = component tab_item_keys.append(k) components.append(component) - if current_tab is not None: + if current_tab is not None and len(previous_section) > 0: create_dirty_indicator(previous_section[0], tab_item_keys) tab_item_keys = [] current_row.__exit__() diff --git a/modules/ui_extensions.py b/modules/ui_extensions.py index bd2ddbd6a..f2fe6edd4 100644 --- a/modules/ui_extensions.py +++ b/modules/ui_extensions.py @@ -152,12 +152,12 @@ def install_extension_from_url(dirname, url, branch_name, search_text, sort_colu shutil.rmtree(tmpdir, True) if not branch_name: # if no branch is specified, use the default branch - with git.Repo.clone_from(url, tmpdir) as repo: + with git.Repo.clone_from(url, tmpdir, filter=['blob:none']) as repo: repo.remote().fetch() for submodule in repo.submodules: submodule.update() else: - with git.Repo.clone_from(url, tmpdir, branch=branch_name) as repo: + with git.Repo.clone_from(url, tmpdir, filter=['blob:none'], branch=branch_name) as repo: repo.remote().fetch() for submodule in repo.submodules: submodule.update() diff --git a/wiki b/wiki index dd857a9c3..038560070 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit dd857a9c3c41af32938ffad1609d97409b337931 +Subproject commit 038560070daa08ca723364147144dd762829c6b4