Spaces:
Running
on
Zero
Running
on
Zero
bugfix
Browse files
app.py
CHANGED
@@ -100,22 +100,24 @@ def run_lora(prompt, lora_strings_json, cfg_scale, steps, randomize_seed, seed,
|
|
100 |
# Load LoRA weights
|
101 |
if lora_strings_json:
|
102 |
try:
|
103 |
-
|
104 |
except:
|
105 |
-
|
106 |
-
if
|
107 |
with calculateDuration("Loading LoRA weights"):
|
108 |
pipe.unload_lora_weights()
|
109 |
adapter_names = []
|
110 |
-
|
|
|
111 |
lora_repo = lora_info.get("repo")
|
112 |
weights = lora_info.get("weights")
|
113 |
adapter_name = lora_info.get("adapter_name")
|
|
|
114 |
if lora_repo and weights and adapter_name:
|
115 |
# 加载 LoRA 权重
|
116 |
pipe.load_lora_weights(lora_repo, weight_name=weights, adapter_name=adapter_name)
|
117 |
adapter_names.append(adapter_name)
|
118 |
-
|
119 |
pipe.set_adapters(adapter_names, adapter_weights=adapter_weights)
|
120 |
|
121 |
# Set random seed for reproducibility
|
|
|
100 |
# Load LoRA weights
|
101 |
if lora_strings_json:
|
102 |
try:
|
103 |
+
lora_configs = json.loads(lora_strings_json)
|
104 |
except:
|
105 |
+
lora_configs = None
|
106 |
+
if lora_configs:
|
107 |
with calculateDuration("Loading LoRA weights"):
|
108 |
pipe.unload_lora_weights()
|
109 |
adapter_names = []
|
110 |
+
adapter_weights = []
|
111 |
+
for lora_info in lora_configs:
|
112 |
lora_repo = lora_info.get("repo")
|
113 |
weights = lora_info.get("weights")
|
114 |
adapter_name = lora_info.get("adapter_name")
|
115 |
+
adapter_weight = lora_info.get("adapter_weight")
|
116 |
if lora_repo and weights and adapter_name:
|
117 |
# 加载 LoRA 权重
|
118 |
pipe.load_lora_weights(lora_repo, weight_name=weights, adapter_name=adapter_name)
|
119 |
adapter_names.append(adapter_name)
|
120 |
+
adapter_weights.append(adapter_weight)
|
121 |
pipe.set_adapters(adapter_names, adapter_weights=adapter_weights)
|
122 |
|
123 |
# Set random seed for reproducibility
|