Skip to content

Commit

Permalink
fix: avoid multi models exists same vae file
Browse files Browse the repository at this point in the history
  • Loading branch information
bluelovers committed Aug 25, 2024
1 parent 237c52b commit 6b586a4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sd_webui_pnginfo_injection/on_before_image_saved.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ def _add_resource_hashes_core_dict(res: dict, p=None, resource_hashes: dict = No
if xx and xx != resource_hashes:
resource_hashes.update(xx)

hash_keys = {"Model hash": ["model", "sd_model_hash", "Model"], "VAE hash": ["vae", "sd_vae_hash", "VAE"]}
hash_keys = {"Model hash": ["model", "sd_model_hash", "Model"], "VAE hash": ["vae", "sd_vae_hash", None]}
for res_key, [hash_key, p_key, res_name_key] in hash_keys.items():
if res_key in res:
k = res[res_name_key]
v = res[res_key]

hashes_is_changed |= _add_to_resource_hashes(resource_hashes, hash_key, v)
hashes_is_changed |= _add_to_resource_hashes(resource_hashes, f"{hash_key}:{k}", v)

if bool(res_name_key and res_name_key in res and res[res_name_key]):
hashes_is_changed |= _add_to_resource_hashes(resource_hashes, f"{hash_key}:{res[res_name_key]}", v)
elif p is not None and lazy_getattr(p, p_key):
hashes_is_changed |= _add_to_resource_hashes(resource_hashes, hash_key, lazy_getattr(p, p_key))

Expand Down

0 comments on commit 6b586a4

Please sign in to comment.