Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -634,18 +634,9 @@ def _generate(
|
|
| 634 |
# to call on every request. Filtered to `LOADED_LORAS`: a slider for a LoRA that failed at startup has no
|
| 635 |
# adapter behind it, and `set_adapters` would raise if asked to activate a name that was never attached.
|
| 636 |
if LOADED_LORAS:
|
| 637 |
-
|
| 638 |
-
|
| 639 |
-
|
| 640 |
-
# with how many LoRAs are loaded, not how many are actually in use for a given request. Called
|
| 641 |
-
# unconditionally, even with an empty list, rather than only `if active:` — skipping the call when every
|
| 642 |
-
# slider is 0 would leave whichever adapters the *previous* request activated still live.
|
| 643 |
-
active = {
|
| 644 |
-
name: strength
|
| 645 |
-
for name, strength in lora_strengths.items()
|
| 646 |
-
if name in LOADED_LORAS and strength > 0
|
| 647 |
-
}
|
| 648 |
-
PIPE.transformer.set_adapters(list(active), weights=list(active.values()))
|
| 649 |
|
| 650 |
if PLACEMENT == "lazy":
|
| 651 |
PIPE.to("cuda")
|
|
|
|
| 634 |
# to call on every request. Filtered to `LOADED_LORAS`: a slider for a LoRA that failed at startup has no
|
| 635 |
# adapter behind it, and `set_adapters` would raise if asked to activate a name that was never attached.
|
| 636 |
if LOADED_LORAS:
|
| 637 |
+
active = {name: strength for name, strength in lora_strengths.items() if name in LOADED_LORAS}
|
| 638 |
+
if active:
|
| 639 |
+
PIPE.transformer.set_adapters(list(active), weights=list(active.values()))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 640 |
|
| 641 |
if PLACEMENT == "lazy":
|
| 642 |
PIPE.to("cuda")
|