Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -154,9 +154,6 @@ def load_models() -> str | None:
|
|
| 154 |
pipe.load_components(dtype=torch.bfloat16)
|
| 155 |
pipe.transformer.set_attention_backend(ATTENTION)
|
| 156 |
|
| 157 |
-
pipe.load_components(dtype=torch.bfloat16)
|
| 158 |
-
pipe.transformer.set_attention_backend(ATTENTION)
|
| 159 |
-
|
| 160 |
# --- Diagnostic: dump the LoRA files' key names/shapes and the transformer's own shapes to the Space
|
| 161 |
# logs, so the exact rename map can be worked out without a notebook or shell. Set H3_LORA_DEBUG=0 in
|
| 162 |
# the Space's env vars to silence this once you're done, or just delete this block later.
|
|
@@ -192,14 +189,6 @@ def load_models() -> str | None:
|
|
| 192 |
for k, shape in sorted(norm_out.items()):
|
| 193 |
print(f"[lora-debug] {k} {shape}", flush=True)
|
| 194 |
|
| 195 |
-
if LORA_REPO.lower() not in ("", "off", "none"):
|
| 196 |
-
from peft.tuners.tuners_utils import BaseTunerLayer
|
| 197 |
-
|
| 198 |
-
try:
|
| 199 |
-
counts = {}
|
| 200 |
-
for name, filename in LORA_FILES.items():
|
| 201 |
-
...
|
| 202 |
-
|
| 203 |
# Approach B: attach both LoRA adapters as PEFT layers on the transformer, inactive (weight 0) until a
|
| 204 |
# request asks for them. `load_lora_adapter` is the model-level loader (`PeftAdapterMixin`), used because
|
| 205 |
# `MiniMaxH3ModularPipeline` has no pipeline-level `load_lora_weights` of its own.
|
|
|
|
| 154 |
pipe.load_components(dtype=torch.bfloat16)
|
| 155 |
pipe.transformer.set_attention_backend(ATTENTION)
|
| 156 |
|
|
|
|
|
|
|
|
|
|
| 157 |
# --- Diagnostic: dump the LoRA files' key names/shapes and the transformer's own shapes to the Space
|
| 158 |
# logs, so the exact rename map can be worked out without a notebook or shell. Set H3_LORA_DEBUG=0 in
|
| 159 |
# the Space's env vars to silence this once you're done, or just delete this block later.
|
|
|
|
| 189 |
for k, shape in sorted(norm_out.items()):
|
| 190 |
print(f"[lora-debug] {k} {shape}", flush=True)
|
| 191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
# Approach B: attach both LoRA adapters as PEFT layers on the transformer, inactive (weight 0) until a
|
| 193 |
# request asks for them. `load_lora_adapter` is the model-level loader (`PeftAdapterMixin`), used because
|
| 194 |
# `MiniMaxH3ModularPipeline` has no pipeline-level `load_lora_weights` of its own.
|