Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -114,6 +114,7 @@ def run_lora(prompt, lora_strings_json, cfg_scale, steps, randomize_seed, seed,
|
|
114 |
if lora_configs:
|
115 |
with calculateDuration("Loading LoRA weights"):
|
116 |
active_adapters = pipe.get_active_adapters()
|
|
|
117 |
adapter_names = []
|
118 |
adapter_weights = []
|
119 |
for lora_info in lora_configs:
|
@@ -122,10 +123,15 @@ def run_lora(prompt, lora_strings_json, cfg_scale, steps, randomize_seed, seed,
|
|
122 |
adapter_name = lora_info.get("adapter_name")
|
123 |
adapter_weight = lora_info.get("adapter_weight")
|
124 |
if adapter_name in active_adapters:
|
|
|
125 |
continue
|
126 |
if lora_repo and weights and adapter_name:
|
127 |
# load lora
|
128 |
-
|
|
|
|
|
|
|
|
|
129 |
adapter_names.append(adapter_name)
|
130 |
adapter_weights.append(adapter_weight)
|
131 |
# set lora weights
|
|
|
114 |
if lora_configs:
|
115 |
with calculateDuration("Loading LoRA weights"):
|
116 |
active_adapters = pipe.get_active_adapters()
|
117 |
+
print("get_active_adapters", active_adapters)
|
118 |
adapter_names = []
|
119 |
adapter_weights = []
|
120 |
for lora_info in lora_configs:
|
|
|
123 |
adapter_name = lora_info.get("adapter_name")
|
124 |
adapter_weight = lora_info.get("adapter_weight")
|
125 |
if adapter_name in active_adapters:
|
126 |
+
print(f"Adapter '{adapter_name}' is already loaded, skipping.")
|
127 |
continue
|
128 |
if lora_repo and weights and adapter_name:
|
129 |
# load lora
|
130 |
+
try:
|
131 |
+
pipe.load_lora_weights(lora_repo, weight_name=weights, adapter_name=adapter_name)
|
132 |
+
except ValueError as e:
|
133 |
+
print(f"Error loading LoRA adapter: {e}")
|
134 |
+
continue
|
135 |
adapter_names.append(adapter_name)
|
136 |
adapter_weights.append(adapter_weight)
|
137 |
# set lora weights
|