File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 33import os
44
55import civitai .lib as civitai
6- from modules import script_callbacks , sd_vae , shared
6+ from modules import script_callbacks , sd_vae , shared , hashes
7+ import lora
78
89additional_network_type_map = {
910 'lora' : 'LORA' ,
@@ -62,6 +63,24 @@ def add_resource_hashes(params):
6263 short_hash = matching_resource [0 ]['hash' ][:10 ]
6364 resource_hashes [f'{ network_type } :{ network_name } ' ] = short_hash
6465
66+ # check loaded_loras
67+ for item in lora .loaded_loras :
68+ name = item .name
69+ if f'lora:{ name } ' in resource_hashes .keys ():
70+ continue
71+
72+ lora_on_disk = item .lora_on_disk if item .lora_on_disk is not None else None
73+ if not lora_on_disk :
74+ continue
75+
76+ hash = hashes .sha256 (lora_on_disk .filename , "lora/" + lora_on_disk .name )
77+ if not hash :
78+ continue
79+ short_hash = hash [0 :10 ]
80+
81+ name = name .replace (":" , "" ).replace ("," , "" )
82+ resource_hashes [f'lora:{ name } ' ] = short_hash
83+
6584 # Check for model hash in generation parameters
6685 model_match = re .search (model_hash_pattern , generation_params )
6786 if hashify_resources and model_match :
You can’t perform that action at this time.
0 commit comments