Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -135,7 +135,7 @@ DEFAULT_CANVAS = "960x544 · 16:9 fast"
|
|
| 135 |
FPS, FRAMES_PER_CHUNK, LATENTS_PER_CHUNK = 24, 17, 5
|
| 136 |
# It is the *snapped* frame count the ceiling has to hold for: 15 s is 360 frames, which rounds up to 362, i.e.
|
| 137 |
# 15.083 s, and is refused.
|
| 138 |
-
MIN_UI_DURATION, MAX_UI_DURATION = 2,
|
| 139 |
|
| 140 |
SAMPLERS = {
|
| 141 |
"euler": "euler",
|
|
@@ -189,6 +189,20 @@ def lower_duration_floor(seconds: float = MIN_UI_DURATION) -> None:
|
|
| 189 |
|
| 190 |
MiniMaxH3ModularPipeline.min_duration = property(lambda self: float(seconds))
|
| 191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
# `load_lora_adapter` requires every key (weights and `network_alphas` alike) to share a `prefix` whenever
|
| 193 |
# `network_alphas` is passed — `prefix=None` with a non-empty `network_alphas` is a hard error. This string is
|
| 194 |
# arbitrary (it's stripped off immediately, and the transformer itself has no `transformer.`-prefixed attribute)
|
|
@@ -396,6 +410,7 @@ def load_models() -> str | None:
|
|
| 396 |
from h3_split_blocks import MiniMaxH3GeneratorBlocks
|
| 397 |
|
| 398 |
lower_duration_floor()
|
|
|
|
| 399 |
manager = ComponentsManager()
|
| 400 |
blocks = MiniMaxH3GeneratorBlocks()
|
| 401 |
print(f"[gen] loading {[c.name for c in blocks.expected_components]} from {MODEL_REPO} ...", flush=True)
|
|
@@ -1100,6 +1115,7 @@ with gr.Blocks(title="PlagueKind · MiniMax-H3") as demo:
|
|
| 1100 |
maximum=MAX_UI_DURATION,
|
| 1101 |
step=1,
|
| 1102 |
value=5,
|
|
|
|
| 1103 |
)
|
| 1104 |
steps = gr.Slider(
|
| 1105 |
label="Steps",
|
|
|
|
| 135 |
FPS, FRAMES_PER_CHUNK, LATENTS_PER_CHUNK = 24, 17, 5
|
| 136 |
# It is the *snapped* frame count the ceiling has to hold for: 15 s is 360 frames, which rounds up to 362, i.e.
|
| 137 |
# 15.083 s, and is refused.
|
| 138 |
+
MIN_UI_DURATION, MAX_UI_DURATION = 2, 30
|
| 139 |
|
| 140 |
SAMPLERS = {
|
| 141 |
"euler": "euler",
|
|
|
|
| 189 |
|
| 190 |
MiniMaxH3ModularPipeline.min_duration = property(lambda self: float(seconds))
|
| 191 |
|
| 192 |
+
|
| 193 |
+
def raise_duration_ceiling(seconds: float = MAX_UI_DURATION) -> None:
|
| 194 |
+
"""Let the pipeline generate past its 15 s ceiling — experimental, past what MiniMax-H3 was trained/released
|
| 195 |
+
at. `min_duration`/`max_duration` are the only place either bound is read (`before_denoise.py`'s validation
|
| 196 |
+
step, `if not min_duration <= duration <= max_duration: raise ValueError`), and nothing architectural depends
|
| 197 |
+
on the value: MiniMax-H3's RoPE computes `inv_freq` on the fly from arbitrary `position_ids`, not a
|
| 198 |
+
fixed-size precomputed table, so there's no hard wraparound past 15 s — just untested territory, expect
|
| 199 |
+
drift, looping, or identity loss rather than a clean extrapolation. Same technique as `lower_duration_floor`,
|
| 200 |
+
the ceiling side.
|
| 201 |
+
"""
|
| 202 |
+
from diffusers.modular_pipelines.minimax_h3.modular_pipeline import MiniMaxH3ModularPipeline
|
| 203 |
+
|
| 204 |
+
MiniMaxH3ModularPipeline.max_duration = property(lambda self: float(seconds))
|
| 205 |
+
|
| 206 |
# `load_lora_adapter` requires every key (weights and `network_alphas` alike) to share a `prefix` whenever
|
| 207 |
# `network_alphas` is passed — `prefix=None` with a non-empty `network_alphas` is a hard error. This string is
|
| 208 |
# arbitrary (it's stripped off immediately, and the transformer itself has no `transformer.`-prefixed attribute)
|
|
|
|
| 410 |
from h3_split_blocks import MiniMaxH3GeneratorBlocks
|
| 411 |
|
| 412 |
lower_duration_floor()
|
| 413 |
+
raise_duration_ceiling()
|
| 414 |
manager = ComponentsManager()
|
| 415 |
blocks = MiniMaxH3GeneratorBlocks()
|
| 416 |
print(f"[gen] loading {[c.name for c in blocks.expected_components]} from {MODEL_REPO} ...", flush=True)
|
|
|
|
| 1115 |
maximum=MAX_UI_DURATION,
|
| 1116 |
step=1,
|
| 1117 |
value=5,
|
| 1118 |
+
info="Unstable past 15 seconds.",
|
| 1119 |
)
|
| 1120 |
steps = gr.Slider(
|
| 1121 |
label="Steps",
|