sd: fix LoRA multiplier logic to switch to at_runtime mode (#2029)

`0. in inputs.lora_multipliers` didn't work because the C array has
variable length.

Also fixed a few corner cases related to the default multipliers
(mainly to ensure robustness against future changes, since in most
cases the multiplier list is already sanitized by a previous
function).
This commit is contained in:
Wagner Bruna
2026-03-12 04:36:51 -03:00
committed by GitHub
parent 318a5486ce
commit 796f7bdeff
2 changed files with 18 additions and 15 deletions
+11
View File
@@ -53,6 +53,17 @@ def extract_loras_from_prompt(*args, **kwargs):
return koboldcpp.extract_loras_from_prompt(*args, **kwargs)
def mk_lora_info(*args, **kwargs):
"""
>>> mk_lora_info(['/x/lora1.safetensors', '/y/lora2.gguf'], [])
[('/x/lora1.safetensors', 'lora1', 'lora1.safetensors', 1.0), ('/y/lora2.gguf', 'lora2', 'lora2.gguf', 1.0)]
>>> mk_lora_info(['/x/lora1.safetensors', '/y/lora1.safetensors'], [0.3])
[('/x/lora1.safetensors', 'lora1', 'lora1.safetensors', 0.3), ('/y/lora1.safetensors', 'lora1_2', 'lora1_2.safetensors', 0.3)]
>>> mk_lora_info(['./lora1.gguf', '/y/lora2.gguf', 'lora3.gguf'], [0, 0.3])
[('./lora1.gguf', 'lora1', 'lora1.gguf', 0), ('/y/lora2.gguf', 'lora2', 'lora2.gguf', 0.3), ('lora3.gguf', 'lora3', 'lora3.gguf', 0)]
"""
return koboldcpp.mk_lora_info(*args, **kwargs)
def sanitize_lora_multipliers(*args, **kwargs):
"""
>>> sanitize_lora_multipliers(None)