diff options
author | fuchen.ljl <yjqqqqdx_01@163.com> | 2023-12-06 12:42:04 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-06 12:42:04 +0000 |
commit | c2bdbb67b66de06f1163de3f10c290213cd6bdb0 (patch) | |
tree | 0fcb3010a72ad253862f317ea18fdeb46b05a322 /modules/ui_extra_networks_checkpoints.py | |
parent | 4d56383025f2cbd00dc6296161e31a896624ab75 (diff) | |
parent | f92d61497a426a19818625c3ccdaae9beeb82b31 (diff) | |
download | stable-diffusion-webui-gfx803-c2bdbb67b66de06f1163de3f10c290213cd6bdb0.tar.gz stable-diffusion-webui-gfx803-c2bdbb67b66de06f1163de3f10c290213cd6bdb0.tar.bz2 stable-diffusion-webui-gfx803-c2bdbb67b66de06f1163de3f10c290213cd6bdb0.zip |
Merge branch 'dev' into kingljl-patch-memory-leak
Diffstat (limited to 'modules/ui_extra_networks_checkpoints.py')
-rw-r--r-- | modules/ui_extra_networks_checkpoints.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/ui_extra_networks_checkpoints.py b/modules/ui_extra_networks_checkpoints.py index ca6c2607..1693e71f 100644 --- a/modules/ui_extra_networks_checkpoints.py +++ b/modules/ui_extra_networks_checkpoints.py @@ -10,11 +10,16 @@ class ExtraNetworksPageCheckpoints(ui_extra_networks.ExtraNetworksPage): def __init__(self):
super().__init__('Checkpoints')
+ self.allow_prompt = False
+
def refresh(self):
shared.refresh_checkpoints()
def create_item(self, name, index=None, enable_filter=True):
checkpoint: sd_models.CheckpointInfo = sd_models.checkpoint_aliases.get(name)
+ if checkpoint is None:
+ return
+
path, ext = os.path.splitext(checkpoint.filename)
return {
"name": checkpoint.name_for_extra,
@@ -30,9 +35,12 @@ class ExtraNetworksPageCheckpoints(ui_extra_networks.ExtraNetworksPage): }
def list_items(self):
+ # instantiate a list to protect against concurrent modification
names = list(sd_models.checkpoints_list)
for index, name in enumerate(names):
- yield self.create_item(name, index)
+ item = self.create_item(name, index)
+ if item is not None:
+ yield item
def allowed_directories_for_previews(self):
return [v for v in [shared.cmd_opts.ckpt_dir, sd_models.model_path] if v is not None]
|