Update app.py
Browse files44 unmodified lines4546474849505117 unmodified lines69707172737475366 unmodified lines442443444445446447448283 unmodified lines73273373473573673782 unmodified lines82082182282382482523 unmodified lines84985085185285385479 unmodified lines934935936937938939144 unmodified lines108410851086108710881089404 unmodified lines149414951496149714981499150015011502123 unmodified lines16261627162816291630163199 unmodified lines17311732173317341735173644 unmodified linesos.environ.get("H3_LORA_I_REPO", "alibaba-pai/MiniMax-H3-Acc-LoRAs"),os.environ.get("H3_LORA_I_FILE", "MiniMax-H3-FL2VA-Acc-8Step.safetensors"),),"loraa": (LORA_REPO, os.environ.get("H3_LORA_A_FILE", "minimax-h3_fl2v_general_helper_3xd.safetensors")),"lorab": (LORA_REPO, os.environ.get("H3_LORA_B_FILE", "TCI_MiniMax_H3.safetensors")),"lorac": (LORA_REPO, os.environ.get("H3_LORA_C_FILE", "HM-AIO-V2.5.safetensors")),"lorad": (LORA_REPO, os.environ.get("H3_LORA_D_FILE", "Furry enhancer Video H3 V2.54.safetensors")),17 unmodified lines# the status line's failure list. Keep these two dicts' keys in sync when adding a LoRA.LORA_LABELS = {"lora1": "MiniMax-H3-FL2VA-Acc-8Step","loraa": "General Enhancer","lorab": "TCI","lorac": "HM-AIO", # hmmotion"lorad": "Anthro Realism",366 unmodified linesimport torchfrom diffusers import ComponentsManagerfrom h3_split_blocks import MiniMaxH3GeneratorBlockslower_duration_floor()raise_duration_ceiling()283 unmodified linesvideo_shift,audio_shift,proj_cache,sampler,total_steps,stage_from,82 unmodified linesif resume_video_latents is not Noneelse {})if given_video is not None:# Momentum: keyframe-free, so no `image`/`last_image` at all — the carried clip already# determines the opening frames more directly than a keyframe could.23 unmodified linesoutput_type="pt",generator=torch.Generator("cpu").manual_seed(int(seed)),**resume_kwargs,)denoised = time.time() - started79 unmodified linessemantic_bridge_magnitude_match="per_token",semantic_bridge_adapter="semantic_bridge_v1",proj_cache=True,progress=gr.Progress(track_tqdm=True),*,advance: bool = False,144 unmodified linesfloat(video_shift),float(audio_shift),bool(proj_cache),SAMPLERS.get(sampler, "euler"),int(target_steps) if stage_enabled else None,steps_done if advance else 0,404 unmodified lines)with gr.Accordion("Custom LoRAs", open=False):lora_a_strength = gr.Slider(label="General Enhancer LoRA",minimum=0.0,maximum=2.0,step=0.05,value=DEFAULT_LORA_A_STRENGTH,)123 unmodified lines"bunny_action_logic_v1: action/combat, character-action ownership in multi-character scenes.",)with gr.Accordion("Chunked Generation", open=False, visible=False):gr.Markdown("Splits a longer product into independent, full-quality chunks joined afterward — each "99 unmodified linessemantic_bridge_magnitude_match,semantic_bridge_adapter,proj_cache,]# `functools.partial` binds `advance`/`chunk_advance` by keyword regardless of their position in `generate`'s44 unmodified lines4546474849505117 unmodified lines69707172737475366 unmodified lines442443444445446447448283 unmodified lines73273373473573673773873974074182 unmodified lines82482582682782882983083183283383483583683783883984084184223 unmodified lines86686786886987087187279 unmodified lines952953954955956957958959960961144 unmodified lines1106110711081109111011111112111311141115404 unmodified lines152015211522152315241525152615271528123 unmodified lines165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167699 unmodified lines177617771778177917801781178217831784178544 unmodified linesos.environ.get("H3_LORA_I_REPO", "alibaba-pai/MiniMax-H3-Acc-LoRAs"),os.environ.get("H3_LORA_I_FILE", "MiniMax-H3-FL2VA-Acc-8Step.safetensors"),),"loraa": (LORA_REPO, os.environ.get("H3_LORA_A_FILE", "SLIDER_LG_H3.safetensors")),"lorab": (LORA_REPO, os.environ.get("H3_LORA_B_FILE", "TCI_MiniMax_H3.safetensors")),"lorac": (LORA_REPO, os.environ.get("H3_LORA_C_FILE", "HM-AIO-V2.5.safetensors")),"lorad": (LORA_REPO, os.environ.get("H3_LORA_D_FILE", "Furry enhancer Video H3 V2.54.safetensors")),17 unmodified lines# the status line's failure list. Keep these two dicts' keys in sync when adding a LoRA.LORA_LABELS = {"lora1": "MiniMax-H3-FL2VA-Acc-8Step","loraa": "Fluid Enhancer","lorab": "TCI","lorac": "HM-AIO", # hmmotion"lorad": "Anthro Realism",366 unmodified linesimport torchfrom diffusers import ComponentsManagerfrom h3_keyframe_control import MiniMaxH3KeyframeGeneratorBlocks as MiniMaxH3GeneratorBlockslower_duration_floor()raise_duration_ceiling()283 unmodified linesvideo_shift,audio_shift,proj_cache,first_frame_at,last_frame_at,first_frame_strength,last_frame_strength,sampler,total_steps,stage_from,82 unmodified linesif resume_video_latents is not Noneelse {})present = [(first_frame_at, first_frame_strength, first_frame),(last_frame_at, last_frame_strength, last_frame),]present = [(f, s) for f, s, img in present if img is not None]keyframe_kwargs = ({"keyframe_frames": tuple(f for f, _ in present),"keyframe_strengths": tuple(s for _, s in present),}if presentelse {})if given_video is not None:# Momentum: keyframe-free, so no `image`/`last_image` at all — the carried clip already# determines the opening frames more directly than a keyframe could.23 unmodified linesoutput_type="pt",generator=torch.Generator("cpu").manual_seed(int(seed)),**resume_kwargs,**keyframe_kwargs,)denoised = time.time() - started79 unmodified linessemantic_bridge_magnitude_match="per_token",semantic_bridge_adapter="semantic_bridge_v1",proj_cache=True,first_frame_at=0,last_frame_at=361,first_frame_strength=0.999,last_frame_strength=0.999,progress=gr.Progress(track_tqdm=True),*,advance: bool = False,144 unmodified linesfloat(video_shift),float(audio_shift),bool(proj_cache),int(first_frame_at),int(last_frame_at),float(first_frame_strength),float(last_frame_strength),SAMPLERS.get(sampler, "euler"),int(target_steps) if stage_enabled else None,steps_done if advance else 0,404 unmodified lines)with gr.Accordion("Custom LoRAs", open=False):lora_a_strength = gr.Slider(label="Fluid Enhancer LoRA",minimum=0.0,maximum=5.0,step=0.05,value=DEFAULT_LORA_A_STRENGTH,)123 unmodified lines"bunny_action_logic_v1: action/combat, character-action ownership in multi-character scenes.",)with gr.Accordion("Keyframe Injection", open=False):gr.Markdown("Which pixel frame each keyframe is injected at, and how strongly. Defaults are the stock ""first/last behavior. Other positions were not trained for and may or may not work.")first_frame_at = gr.Slider(label="First image: injection frame", minimum=0, maximum=361, step=1, value=0)last_frame_at = gr.Slider(label="Last image: injection frame (max = end of video)",minimum=0, maximum=361, step=1, value=361,)first_frame_strength = gr.Slider(label="First image: strength", minimum=0.0, maximum=0.999, step=0.001, value=0.999)last_frame_strength = gr.Slider(label="Last image: strength", minimum=0.0, maximum=0.999, step=0.001, value=0.999)with gr.Accordion("Chunked Generation", open=False, visible=False):gr.Markdown("Splits a longer product into independent, full-quality chunks joined afterward — each "99 unmodified linessemantic_bridge_magnitude_match,semantic_bridge_adapter,proj_cache,first_frame_at,last_frame_at,first_frame_strength,last_frame_strength,]# `functools.partial` binds `advance`/`chunk_advance` by keyword regardless of their position in `generate`'s
app.py+54-5