diff --git a/TODO.md b/TODO.md index 03761fc3e..c9bbf8646 100644 --- a/TODO.md +++ b/TODO.md @@ -17,7 +17,6 @@ Stuff to be added... - Reload browser on server restart - Remove origin wiki - Import core repos -- Import rembg - Improve core `Stability-AI` code: - Improve core `k-Diffusion` code @@ -25,8 +24,6 @@ Stuff to be added... Stuff to be investigated... -- Gradio `app_kwargs`: - ## Merge PRs Pick & merge PRs from main repo... @@ -58,20 +55,3 @@ Tech that can be integrated as part of the core workflow... ### Pending Code Updates -- tested with **torch 2.1** and **cuda 12.1** - (production remains on torch2.0.1+cuda11.8) -- fully extend support of `--data-dir` - allows multiple installations to share pretty much everything, not just models -- redo api authentication - now api authentication will use same user/pwd (if specified) for ui and strictly enforce it using httpbasicauth - new authentication is also fully supported in combination with ssl for both sync and async calls - if you want to use api programatically, see examples in `cli/sdapi.py` -- add dark/light theme mode toggle -- redo some `clip-skip` functionality -- better matching for vae vs model -- update to `xyz grid` to allow creation of large number of images without -- update `gradio` (again) -- more prompt parser optimizations -- better error handling when importing image settings which are not compatible with current install - for example, when upscaler or sampler originally used is not available -- fixes...amazing how many issues were introduced by porting new a1111 code without adding almost no new functionality diff --git a/launch.py b/launch.py index 2b58226a1..c52096bbb 100644 --- a/launch.py +++ b/launch.py @@ -9,9 +9,9 @@ commandline_args = os.environ.get('COMMANDLINE_ARGS', "") sys.argv += shlex.split(commandline_args) import installer +installer.ensure_base_requirements() installer.setup_logging(False) installer.add_args() -installer.ensure_base_requirements() installer.parse_args() installer.extensions_preload(force=False) diff --git a/modules/hashes.py b/modules/hashes.py index 2a7c7aed3..f36291362 100644 --- a/modules/hashes.py +++ b/modules/hashes.py @@ -23,8 +23,11 @@ def cache(subsection): if not os.path.isfile(cache_filename): cache_data = {} else: - with open(cache_filename, "r", encoding="utf8") as file: - cache_data = json.load(file) + try: + with open(cache_filename, "r", encoding="utf8") as file: + cache_data = json.load(file) + except: + cache_data = None s = cache_data.get(subsection, {}) cache_data[subsection] = s return s diff --git a/modules/images.py b/modules/images.py index 7c615dd13..3065205bb 100644 --- a/modules/images.py +++ b/modules/images.py @@ -236,7 +236,7 @@ def resize_image(resize_mode, im, width, height, upscaler_name=None): upscalers = [x for x in shared.sd_upscalers if x.name == upscaler_name] if len(upscalers) == 0: upscaler = shared.sd_upscalers[0] - shared.log.warning(f"Could not find upscaler named {upscaler_name or ''}, using {upscaler.name} as a fallback") + shared.log.warning(f"Could not find upscaler: {upscaler_name or ''} using fallback: {upscaler.name}") else: upscaler = upscalers[0] im = upscaler.scaler.upscale(im, scale, upscaler.data_path) @@ -521,7 +521,8 @@ def save_image(image, path, basename, seed=None, prompt=None, extension='jpg', i if path is None: # set default path to avoid errors when functions are triggered manually or via api and param is not set path = shared.opts.outdir_save namegen = FilenameGenerator(p, seed, prompt, image) - save_to_dirs = save_to_dirs or (grid and shared.opts.grid_save_to_dirs) or (not grid and shared.opts.save_to_dirs and not no_prompt) + if save_to_dirs is None: + save_to_dirs = (grid and shared.opts.grid_save_to_dirs) or (not grid and shared.opts.save_to_dirs and not no_prompt) if save_to_dirs: dirname = namegen.apply(shared.opts.directories_filename_pattern or "[prompt_words]").lstrip(' ').rstrip('\\ /') path = os.path.join(path, dirname) diff --git a/modules/shared.py b/modules/shared.py index b8203e356..584b848cf 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -307,7 +307,7 @@ options_templates.update(options_section(('saving-images', "Image options"), { "save_init_img": OptionInfo(False, "Save init images when using image processing"), "save_to_dirs": OptionInfo(False, "Save images to a subdirectory"), "grid_save_to_dirs": OptionInfo(False, "Save grids to a subdirectory"), - "use_save_to_dirs_for_ui": OptionInfo(False, "When using \"Save\" button, save images to a subdirectory"), + "use_save_to_dirs_for_ui": OptionInfo(False, "When using Save button, save images to a subdirectory"), "directories_filename_pattern": OptionInfo("[date]", "Directory name pattern", component_args=hide_dirs), "directories_max_prompt_words": OptionInfo(8, "Max prompt words for [prompt_words] pattern", gr.Slider, {"minimum": 1, "maximum": 20, "step": 1, **hide_dirs}), })) @@ -605,6 +605,8 @@ class Options: expected_type = type(default_value) if expected_type == bool and value == "False": value = False + elif expected_type == type(value): + pass else: value = expected_type(value) return value diff --git a/scripts/postprocessing_upscale.py b/scripts/postprocessing_upscale.py index e1faddeaf..55c43fc41 100644 --- a/scripts/postprocessing_upscale.py +++ b/scripts/postprocessing_upscale.py @@ -84,7 +84,7 @@ class ScriptPostprocessingUpscale(scripts_postprocessing.ScriptPostprocessing): upscaler1 = next(iter([x for x in shared.sd_upscalers if x.name == upscaler_1_name]), None) if not upscaler1: - shared.log.warning(f"Could not find upscaler named {upscaler_1_name or ''}") + shared.log.warning(f"Could not find upscaler: {upscaler_1_name or ''}") return if upscaler_2_name == "None": @@ -92,7 +92,7 @@ class ScriptPostprocessingUpscale(scripts_postprocessing.ScriptPostprocessing): upscaler2 = next(iter([x for x in shared.sd_upscalers if x.name == upscaler_2_name and x.name != "None"]), None) if not upscaler2 and (upscaler_2_name is not None): - shared.log.warning(f"Could not find upscaler named {upscaler_1_name or ''}") + shared.log.warning(f"Could not find upscaler: {upscaler_2_name or ''}") return upscaled_image = self.upscale(pp.image, pp.info, upscaler1, upscale_mode, upscale_by, upscale_to_width, upscale_to_height, upscale_crop) @@ -130,7 +130,7 @@ class ScriptPostprocessingUpscaleSimple(ScriptPostprocessingUpscale): upscaler1 = next(iter([x for x in shared.sd_upscalers if x.name == upscaler_name]), None) if upscaler1 is None: - shared.log.warning(f"Could not find upscaler named {upscaler_name or ''}") + shared.log.warning(f"Could not find upscaler: {upscaler_name or ''}") pp.image = self.upscale(pp.image, pp.info, upscaler1, 0, upscale_by, 0, 0, False) pp.info["Postprocess upscaler"] = upscaler1.name