Spaces:
Sleeping
Sleeping
Fix conditioner call in _generate; drop unsupported label on Markdown output
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
Ported from [@mrfakename/minimax-h3-ultra-fast](https://huggingface.co/spaces/mrfakename/minimax-h3-ultra-fast),
|
| 4 |
trimmed to the text-to-video path: the React studio, keyframe/FL2VA inputs, Ref2VA references, storyboard stitching
|
| 5 |
and custom-LoRA URL downloads are removed, and the UI is an ordinary Gradio Blocks app. The engine is unchanged —
|
| 6 |
-
a pruned NVFP4 transformer plus a local truncated NVFP4 conditioner, with the full-precision VAEs kept
|
| 7 |
|
| 8 |
Env overrides (`H3_*`) behave exactly as in the source Space: `H3_ENGINE=nvfp4|bf16`, `H3_CONDITIONER_MODE=local|remote`,
|
| 9 |
`H3_PLACEMENT=lazy|pack|offload`, `H3_ATTENTION`, `H3_GPU_SIZE`, `H3_MAX_GPU_DURATION`.
|
|
@@ -16,7 +16,6 @@ import os
|
|
| 16 |
import re
|
| 17 |
import tempfile
|
| 18 |
import time
|
| 19 |
-
import traceback
|
| 20 |
from collections import OrderedDict
|
| 21 |
from functools import cache
|
| 22 |
|
|
@@ -354,8 +353,6 @@ def _download_egrid() -> str:
|
|
| 354 |
if _sha256(path) == EGRID_SHA256:
|
| 355 |
return path
|
| 356 |
temporary = path + ".download"
|
| 357 |
-
import requests
|
| 358 |
-
|
| 359 |
with requests.get(EGRID_URL, stream=True, timeout=60) as response:
|
| 360 |
response.raise_for_status()
|
| 361 |
with open(temporary, "wb") as output:
|
|
@@ -389,7 +386,7 @@ def resolve_lora(preset: str) -> tuple[str | None, str | None, str, float]:
|
|
| 389 |
raise ValueError("LoRA file is missing a declared size or exceeds the 2 GiB safety limit.")
|
| 390 |
path = hf_hub_download(repo_id=repo_id, filename=filename, token=False)
|
| 391 |
# Only the older pruned-base adapter contains AdaLN targets and needs its external timestep lookup grid.
|
| 392 |
-
egrid_path =
|
| 393 |
return path, egrid_path, f"{repo_id}/{filename}", adapter_scale
|
| 394 |
|
| 395 |
|
|
@@ -454,7 +451,7 @@ def _generate(
|
|
| 454 |
print(f"[cond] reused {num_text_tokens}-token embedding", flush=True)
|
| 455 |
else:
|
| 456 |
conditioned = time.time()
|
| 457 |
-
condition_state =
|
| 458 |
prompt=prompt,
|
| 459 |
image=None,
|
| 460 |
last_image=None,
|
|
@@ -741,7 +738,7 @@ with demo:
|
|
| 741 |
generate_btn = gr.Button("Generate", variant="primary")
|
| 742 |
with gr.Column(scale=2):
|
| 743 |
video_out = gr.Video(label="Result (video + audio)")
|
| 744 |
-
report = gr.Markdown(
|
| 745 |
|
| 746 |
generation_preset.change(
|
| 747 |
lambda preset: gr.Accordion(visible=preset == CUSTOM_PRESET),
|
|
|
|
| 3 |
Ported from [@mrfakename/minimax-h3-ultra-fast](https://huggingface.co/spaces/mrfakename/minimax-h3-ultra-fast),
|
| 4 |
trimmed to the text-to-video path: the React studio, keyframe/FL2VA inputs, Ref2VA references, storyboard stitching
|
| 5 |
and custom-LoRA URL downloads are removed, and the UI is an ordinary Gradio Blocks app. The engine is unchanged —
|
| 6 |
+
a pruned NVFP4 transformer plus a local truncated NVFP4 conditioner, with the full-precision VAEs kept.
|
| 7 |
|
| 8 |
Env overrides (`H3_*`) behave exactly as in the source Space: `H3_ENGINE=nvfp4|bf16`, `H3_CONDITIONER_MODE=local|remote`,
|
| 9 |
`H3_PLACEMENT=lazy|pack|offload`, `H3_ATTENTION`, `H3_GPU_SIZE`, `H3_MAX_GPU_DURATION`.
|
|
|
|
| 16 |
import re
|
| 17 |
import tempfile
|
| 18 |
import time
|
|
|
|
| 19 |
from collections import OrderedDict
|
| 20 |
from functools import cache
|
| 21 |
|
|
|
|
| 353 |
if _sha256(path) == EGRID_SHA256:
|
| 354 |
return path
|
| 355 |
temporary = path + ".download"
|
|
|
|
|
|
|
| 356 |
with requests.get(EGRID_URL, stream=True, timeout=60) as response:
|
| 357 |
response.raise_for_status()
|
| 358 |
with open(temporary, "wb") as output:
|
|
|
|
| 386 |
raise ValueError("LoRA file is missing a declared size or exceeds the 2 GiB safety limit.")
|
| 387 |
path = hf_hub_download(repo_id=repo_id, filename=filename, token=False)
|
| 388 |
# Only the older pruned-base adapter contains AdaLN targets and needs its external timestep lookup grid.
|
| 389 |
+
egrid_path = None if not needs_egrid else _download_egrid()
|
| 390 |
return path, egrid_path, f"{repo_id}/{filename}", adapter_scale
|
| 391 |
|
| 392 |
|
|
|
|
| 451 |
print(f"[cond] reused {num_text_tokens}-token embedding", flush=True)
|
| 452 |
else:
|
| 453 |
conditioned = time.time()
|
| 454 |
+
condition_state = COND_PIPE(
|
| 455 |
prompt=prompt,
|
| 456 |
image=None,
|
| 457 |
last_image=None,
|
|
|
|
| 738 |
generate_btn = gr.Button("Generate", variant="primary")
|
| 739 |
with gr.Column(scale=2):
|
| 740 |
video_out = gr.Video(label="Result (video + audio)")
|
| 741 |
+
report = gr.Markdown()
|
| 742 |
|
| 743 |
generation_preset.change(
|
| 744 |
lambda preset: gr.Accordion(visible=preset == CUSTOM_PRESET),
|