diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-08-09 11:47:44 +0000 |
---|---|---|
committer | AUTOMATIC1111 <16777216c@gmail.com> | 2023-08-09 11:47:44 +0000 |
commit | aa10faa591f1ca0bd93ae3d53a0a4c15a3fbaf82 (patch) | |
tree | a1132f683eaf61c354905f9cf833db93d522006b /modules/sd_models.py | |
parent | 358f55db6a64e83aec86cc73d26924d6d69d5c6e (diff) | |
download | stable-diffusion-webui-gfx803-aa10faa591f1ca0bd93ae3d53a0a4c15a3fbaf82.tar.gz stable-diffusion-webui-gfx803-aa10faa591f1ca0bd93ae3d53a0a4c15a3fbaf82.tar.bz2 stable-diffusion-webui-gfx803-aa10faa591f1ca0bd93ae3d53a0a4c15a3fbaf82.zip |
fix checkpoint name jumping around in the list of checkpoints for no good reason
Diffstat (limited to 'modules/sd_models.py')
-rw-r--r-- | modules/sd_models.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/modules/sd_models.py b/modules/sd_models.py index b490fa99..7a866a07 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -68,7 +68,9 @@ class CheckpointInfo: self.title = name if self.shorthash is None else f'{name} [{self.shorthash}]'
self.short_title = self.name_for_extra if self.shorthash is None else f'{self.name_for_extra} [{self.shorthash}]'
- self.ids = [self.hash, self.model_name, self.title, name, self.name_for_extra, f'{name} [{self.hash}]'] + ([self.shorthash, self.sha256, f'{self.name} [{self.shorthash}]'] if self.shorthash else [])
+ self.ids = [self.hash, self.model_name, self.title, name, self.name_for_extra, f'{name} [{self.hash}]']
+ if self.shorthash:
+ self.ids += [self.shorthash, self.sha256, f'{self.name} [{self.shorthash}]', f'{self.name_for_extra} [{self.shorthash}]']
def register(self):
checkpoints_list[self.title] = self
@@ -80,10 +82,14 @@ class CheckpointInfo: if self.sha256 is None:
return
- self.shorthash = self.sha256[0:10]
+ shorthash = self.sha256[0:10]
+ if self.shorthash == self.sha256[0:10]:
+ return self.shorthash
+
+ self.shorthash = shorthash
if self.shorthash not in self.ids:
- self.ids += [self.shorthash, self.sha256, f'{self.name} [{self.shorthash}]']
+ self.ids += [self.shorthash, self.sha256, f'{self.name} [{self.shorthash}]', f'{self.name_for_extra} [{self.shorthash}]']
checkpoints_list.pop(self.title, None)
self.title = f'{self.name} [{self.shorthash}]'
|