mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-11-27 06:40:10 +08:00
Merge pull request #16062 from AUTOMATIC1111/fix-infotext-Lora-hashes-fro-hires-fix-different-lora
fix infotext Lora hashes fro hires fix different lora
This commit is contained in:
commit
3bd4a08119
@ -9,6 +9,8 @@ class ExtraNetworkLora(extra_networks.ExtraNetwork):
|
||||
self.errors = {}
|
||||
"""mapping of network names to the number of errors the network had during operation"""
|
||||
|
||||
remove_symbols = str.maketrans('', '', ":,")
|
||||
|
||||
def activate(self, p, params_list):
|
||||
additional = shared.opts.sd_lora
|
||||
|
||||
@ -43,22 +45,15 @@ class ExtraNetworkLora(extra_networks.ExtraNetwork):
|
||||
networks.load_networks(names, te_multipliers, unet_multipliers, dyn_dims)
|
||||
|
||||
if shared.opts.lora_add_hashes_to_infotext:
|
||||
network_hashes = []
|
||||
if not getattr(p, "is_hr_pass", False) or not hasattr(p, "lora_hashes"):
|
||||
p.lora_hashes = {}
|
||||
|
||||
for item in networks.loaded_networks:
|
||||
shorthash = item.network_on_disk.shorthash
|
||||
if not shorthash:
|
||||
continue
|
||||
if item.network_on_disk.shorthash and item.mentioned_name:
|
||||
p.lora_hashes[item.mentioned_name.translate(self.remove_symbols)] = item.network_on_disk.shorthash
|
||||
|
||||
alias = item.mentioned_name
|
||||
if not alias:
|
||||
continue
|
||||
|
||||
alias = alias.replace(":", "").replace(",", "")
|
||||
|
||||
network_hashes.append(f"{alias}: {shorthash}")
|
||||
|
||||
if network_hashes:
|
||||
p.extra_generation_params["Lora hashes"] = ", ".join(network_hashes)
|
||||
if p.lora_hashes:
|
||||
p.extra_generation_params["Lora hashes"] = ', '.join(f'{k}: {v}' for k, v in p.lora_hashes.items())
|
||||
|
||||
def deactivate(self, p):
|
||||
if self.errors:
|
||||
|
Loading…
Reference in New Issue
Block a user