Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files18 unmodified lines192021222324252642 unmodified lines6970717273747576777879808182838485868788899091929394959697110 unmodified lines2082092102112122132142157 unmodified lines22322422519922622722822943 unmodified lines273274275276277278279280281282283284285286287342 unmodified lines63063163263363463563663763863964064164264364464564664764864965065165265318 unmodified linesimport spacesimport gradio as gr
import pk_workflow as pk
MODEL_REPO = os.environ.get("H3_MODEL_REPO", "MiniMaxAI/MiniMax-H3")CONDITIONER_SPACE = os.environ.get("H3_CONDITIONER", "dagloop5/qwen3vl-conditioner")# `pack` moves only `transformer_ref` onto the card at startup, the same way fl2va scopes this to its own42 unmodified lines "1536x672 · 21:9 full": (672, 1536),}DEFAULT_CANVAS = "960x544 · 16:9 fast"
# Only the three plain scheduler.step() samplers from the fl2va Space — the SDE-family and two-evaluation# samplers (dpmpp_2m/3m_sde_gpu, dpmpp_2s_ancestral, dpmpp_sde_gpu, seeds_2) aren't ported here.SAMPLERS = { "euler": "euler", "euler ancestral": "euler_ancestral", "er_sde": "er_sde",}DEFAULT_SAMPLER = "euler"
SCHEDULES = { "linear_quadratic · PlagueKind": "linear_quadratic", "sgm_uniform": "sgm_uniform", "simple": "simple", "beta": "beta", "ddim_uniform": "ddim_uniform", "normal": "normal", "native (pipeline default)": "native",}DEFAULT_SCHEDULE = "linear_quadratic · PlagueKind"DEFAULT_VIDEO_SHIFT = 12.0DEFAULT_AUDIO_SHIFT = 3.0
FPS, FRAMES_PER_CHUNK, LATENTS_PER_CHUNK = 24, 17, 5# It is the *snapped* frame count the ceiling has to hold for: 15 s is 360 frames, which rounds up to 362, i.e.# 15.083 s, and is refused. 14 is the last whole second that survives the snap.110 unmodified linesPIPE = NoneMANAGER = NoneLOAD_ERROR: str | None = NoneFILM = NoneFILM_ERROR: str | None = None
def load_models() -> str | None:7 unmodified lines the 150 GB quota (`OSError: [Errno 28] No space left on device` out of `os.posix_fallocate`, mid-pack); the ~61.7 GB `transformer_ref` alone fits, same as fl2va's `transformer`. """ global PIPE, MANAGER, LOAD_ERROR global PIPE, MANAGER, LOAD_ERROR, FILM, FILM_ERROR
if PIPE is not None or LOAD_ERROR is not None: return LOAD_ERROR43 unmodified lines f"**Loading `{MODEL_REPO}` failed** after {time.time() - started:.0f}s: " f"`{type(error).__name__}: {error}`" )
# 69 MB of post-processing, and the demo is still a demo without it, so a failure here is not fatal. try: FILM = pk.load_film() print("[ref2va] FILM loaded", flush=True) except Exception as error: FILM_ERROR = f"{type(error).__name__}: {error}" print(f"[ref2va] FILM unavailable ({FILM_ERROR}); frame interpolation disabled", flush=True)
return LOAD_ERROR
342 unmodified lines label="Duration (s)", minimum=MIN_DURATION, maximum=MAX_UI_DURATION, step=1, value=5 ) steps = gr.Slider(label="Steps", minimum=MIN_STEPS, maximum=40, step=1, value=28) sampler = gr.Dropdown( label="Sampler", choices=list(SAMPLERS), value=DEFAULT_SAMPLER, info="`euler ancestral` re-injects noise each step — expect seed to matter more.", ) schedule = gr.Dropdown( label="Sigma schedule", choices=list(SCHEDULES), value=DEFAULT_SCHEDULE, info="`linear_quadratic` front-loads half the steps into the first 2.5% of the trajectory.", ) video_shift = gr.Slider( label="Video shift", minimum=0.5, maximum=50.0, step=0.5, value=DEFAULT_VIDEO_SHIFT ) audio_shift = gr.Slider( label="Audio shift", minimum=0.5, maximum=20.0, step=0.5, value=DEFAULT_AUDIO_SHIFT ) seed = gr.Number(label="Seed", value=42, precision=0)
with gr.Column():app.py+55-1