Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -427,6 +427,19 @@ def load_models() -> str | None:
|
|
| 427 |
print(f"[gen] loading {[c.name for c in blocks.expected_components]} from {MODEL_REPO} ...", flush=True)
|
| 428 |
pipe = blocks.init_pipeline(MODEL_REPO, components_manager=manager, collection="h3")
|
| 429 |
pipe.load_components(dtype=torch.bfloat16)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 430 |
pipe.transformer.set_attention_backend(ATTENTION)
|
| 431 |
|
| 432 |
# --- Diagnostic: dump the LoRA files' key names/shapes and the transformer's own shapes to the Space
|
|
|
|
| 427 |
print(f"[gen] loading {[c.name for c in blocks.expected_components]} from {MODEL_REPO} ...", flush=True)
|
| 428 |
pipe = blocks.init_pipeline(MODEL_REPO, components_manager=manager, collection="h3")
|
| 429 |
pipe.load_components(dtype=torch.bfloat16)
|
| 430 |
+
|
| 431 |
+
# 10Eros-Max beta_5: an in-place weight replacement on the already-loaded official transformer, not a
|
| 432 |
+
# meta-device swap — the reference file is *partial* (it never carries `time_embedder`, reusing the
|
| 433 |
+
# base model's own), so a `strict=True` load would fail on those missing keys regardless. Because this
|
| 434 |
+
# never replaces the parameter objects themselves, only their data, the dtype each parameter already
|
| 435 |
+
# has — correctly set by `load_components` above, `_keep_in_fp32_modules` included — is preserved
|
| 436 |
+
# automatically. None of the meta-device pitfalls from the full-checkpoint path apply here.
|
| 437 |
+
import h3_eros
|
| 438 |
+
|
| 439 |
+
eros_status = h3_eros.apply_eros(pipe.transformer)
|
| 440 |
+
if eros_status:
|
| 441 |
+
print(f"[gen] {eros_status}", flush=True)
|
| 442 |
+
|
| 443 |
pipe.transformer.set_attention_backend(ATTENTION)
|
| 444 |
|
| 445 |
# --- Diagnostic: dump the LoRA files' key names/shapes and the transformer's own shapes to the Space
|