Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -138,15 +138,31 @@ def load_models() -> str | None:
|
|
| 138 |
try:
|
| 139 |
import torch
|
| 140 |
from diffusers import ComponentsManager
|
| 141 |
-
|
| 142 |
from h3_split_blocks import MiniMaxH3GeneratorBlocks
|
| 143 |
-
|
| 144 |
lower_duration_floor()
|
|
|
|
| 145 |
manager = ComponentsManager()
|
| 146 |
blocks = MiniMaxH3GeneratorBlocks()
|
| 147 |
-
|
| 148 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
pipe.load_components(dtype=torch.bfloat16)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
pipe.transformer.set_attention_backend(ATTENTION)
|
| 151 |
|
| 152 |
# Still startup, still free: an AoTI package carries no weights and opens its archive lazily inside the GPU
|
|
|
|
| 138 |
try:
|
| 139 |
import torch
|
| 140 |
from diffusers import ComponentsManager
|
|
|
|
| 141 |
from h3_split_blocks import MiniMaxH3GeneratorBlocks
|
| 142 |
+
|
| 143 |
lower_duration_floor()
|
| 144 |
+
|
| 145 |
manager = ComponentsManager()
|
| 146 |
blocks = MiniMaxH3GeneratorBlocks()
|
| 147 |
+
|
| 148 |
+
print(
|
| 149 |
+
f"[gen] loading {[c.name for c in blocks.expected_components]} from {MODEL_REPO} ...",
|
| 150 |
+
flush=True,
|
| 151 |
+
)
|
| 152 |
+
|
| 153 |
+
pipe = blocks.init_pipeline(
|
| 154 |
+
MODEL_REPO,
|
| 155 |
+
components_manager=manager,
|
| 156 |
+
collection="h3",
|
| 157 |
+
)
|
| 158 |
+
|
| 159 |
pipe.load_components(dtype=torch.bfloat16)
|
| 160 |
+
# Load TenStrip fine-tuned checkpoint into the transformer
|
| 161 |
+
from huggingface_hub import hf_hub_download
|
| 162 |
+
from safetensors.torch import load_model
|
| 163 |
+
finetune_path = hf_hub_download(repo_id="TenStrip/10Eros-Max", filename="10Eros_Max_h3_fl2va_bf16_test1.safetensors")
|
| 164 |
+
load_model(pipe.transformer, finetune_path, strict=False, device="cpu")
|
| 165 |
+
pipe.transformer.to(torch.bfloat16)
|
| 166 |
pipe.transformer.set_attention_backend(ATTENTION)
|
| 167 |
|
| 168 |
# Still startup, still free: an AoTI package carries no weights and opens its archive lazily inside the GPU
|