diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-09-30 07:02:28 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-30 07:02:28 +0000 |
commit | 951842d7858f94d5d49999f57f37df8e1991c4ae (patch) | |
tree | acd5300efb62f53432c66473d2960e2d00d7a389 | |
parent | 591ad1dbc38aa7e160ab1c34226dc9269b35983c (diff) | |
parent | 63485b2c55d2e5d1d5fc64d3964120a7305a9aee (diff) | |
download | stable-diffusion-webui-gfx803-951842d7858f94d5d49999f57f37df8e1991c4ae.tar.gz stable-diffusion-webui-gfx803-951842d7858f94d5d49999f57f37df8e1991c4ae.tar.bz2 stable-diffusion-webui-gfx803-951842d7858f94d5d49999f57f37df8e1991c4ae.zip |
Merge pull request #13139 from AUTOMATIC1111/ckpt-dir-path-separator
fix `--ckpt-dir` path separator and option use `short name` for checkpoint dropdown
-rw-r--r-- | modules/sd_models.py | 5 | ||||
-rw-r--r-- | modules/shared_items.py | 4 | ||||
-rw-r--r-- | modules/shared_options.py | 3 |
3 files changed, 7 insertions, 5 deletions
diff --git a/modules/sd_models.py b/modules/sd_models.py index 5ef7aa13..7f8502f5 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -50,11 +50,12 @@ class CheckpointInfo: def __init__(self, filename):
self.filename = filename
abspath = os.path.abspath(filename)
+ abs_ckpt_dir = os.path.abspath(shared.cmd_opts.ckpt_dir) if shared.cmd_opts.ckpt_dir is not None else None
self.is_safetensors = os.path.splitext(filename)[1].lower() == ".safetensors"
- if shared.cmd_opts.ckpt_dir is not None and abspath.startswith(shared.cmd_opts.ckpt_dir):
- name = abspath.replace(shared.cmd_opts.ckpt_dir, '')
+ if abs_ckpt_dir and abspath.startswith(abs_ckpt_dir):
+ name = abspath.replace(abs_ckpt_dir, '')
elif abspath.startswith(model_path):
name = abspath.replace(model_path, '')
else:
diff --git a/modules/shared_items.py b/modules/shared_items.py index 84d69c8d..b1459f8c 100644 --- a/modules/shared_items.py +++ b/modules/shared_items.py @@ -44,9 +44,9 @@ def refresh_unet_list(): modules.sd_unet.list_unets()
-def list_checkpoint_tiles():
+def list_checkpoint_tiles(use_short=False):
import modules.sd_models
- return modules.sd_models.checkpoint_tiles()
+ return modules.sd_models.checkpoint_tiles(use_short)
def refresh_checkpoints():
diff --git a/modules/shared_options.py b/modules/shared_options.py index d07f3cd1..8e8d402d 100644 --- a/modules/shared_options.py +++ b/modules/shared_options.py @@ -134,7 +134,7 @@ options_templates.update(options_section(('training', "Training"), { }))
options_templates.update(options_section(('sd', "Stable Diffusion"), {
- "sd_model_checkpoint": OptionInfo(None, "Stable Diffusion checkpoint", gr.Dropdown, lambda: {"choices": shared_items.list_checkpoint_tiles()}, refresh=shared_items.refresh_checkpoints, infotext='Model hash'),
+ "sd_model_checkpoint": OptionInfo(None, "Stable Diffusion checkpoint", gr.Dropdown, lambda: {"choices": shared_items.list_checkpoint_tiles(shared.opts.sd_checkpoint_dropdown_use_short)}, refresh=shared_items.refresh_checkpoints, infotext='Model hash'),
"sd_checkpoints_limit": OptionInfo(1, "Maximum number of checkpoints loaded at the same time", gr.Slider, {"minimum": 1, "maximum": 10, "step": 1}),
"sd_checkpoints_keep_in_cpu": OptionInfo(True, "Only keep one model on device").info("will keep models other than the currently used one in RAM rather than VRAM"),
"sd_checkpoint_cache": OptionInfo(0, "Checkpoints to cache in RAM", gr.Slider, {"minimum": 0, "maximum": 10, "step": 1}).info("obsolete; set to 0 and use the two settings above instead"),
@@ -262,6 +262,7 @@ options_templates.update(options_section(('ui', "User interface"), { "ui_tab_order": OptionInfo([], "UI tab order", ui_components.DropdownMulti, lambda: {"choices": list(shared.tab_names)}).needs_reload_ui(),
"hidden_tabs": OptionInfo([], "Hidden UI tabs", ui_components.DropdownMulti, lambda: {"choices": list(shared.tab_names)}).needs_reload_ui(),
"ui_reorder_list": OptionInfo([], "txt2img/img2img UI item order", ui_components.DropdownMulti, lambda: {"choices": list(shared_items.ui_reorder_categories())}).info("selected items appear first").needs_reload_ui(),
+ "sd_checkpoint_dropdown_use_short": OptionInfo(False, "Use short name for Stable Diffusion checkpoint dropdown"),
"hires_fix_show_sampler": OptionInfo(False, "Hires fix: show hires checkpoint and sampler selection").needs_reload_ui(),
"hires_fix_show_prompts": OptionInfo(False, "Hires fix: show hires prompt and negative prompt").needs_reload_ui(),
"disable_token_counters": OptionInfo(False, "Disable prompt token counters").needs_reload_ui(),
|