modular cleanup

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2026-08-29 17:40:04 +02:00
parent 525e8dec9d
commit a637d57ea5
11 changed files with 435 additions and 147 deletions
-2
View File
@@ -37,7 +37,6 @@ class ReqFramepack(BaseModel):
mp4_opt: str | None = Field(default="crf=16", title="Options", description="Options for the video codec")
mp4_ext: str | None = Field(default="mp4", title="Format", description="Format for the video")
mp4_interpolate: int | None = Field(default=0, title="Interpolation", description="Interpolation for the video")
attention: str | None = Field(default="Default", title="Attention", description="Attention type for the model")
vae_type: str | None = Field(default="Local", title="VAE", description="VAE type for the model")
vlm_enhance: bool | None = Field(default=False, title="VLM enhance", description="Enable VLM enhance")
vlm_model: str | None = Field(default=None, title="VLM model", description="VLM model to use")
@@ -114,7 +113,6 @@ def framepack_post(request: ReqFramepack):
mp4_opt=request.mp4_opt,
mp4_ext=request.mp4_ext,
mp4_interpolate=request.mp4_interpolate,
attention=request.attention,
vae_type=request.vae_type,
vlm_enhance=request.vlm_enhance,
vlm_model=request.vlm_model,
+1 -1
View File
@@ -16,7 +16,7 @@ def rename(src:str, dst:str):
raise e
def install_requirements(attention:str='SDPA'):
def install_requirements():
install('av')
+2 -3
View File
@@ -63,7 +63,6 @@ def create_ui(prompt, negative, styles, _overrides, script_inputs, mp4_fps, mp4_
optimized_prompt = gr.Checkbox(label='FP use optimized system prompt', value=True)
use_cfgzero = gr.Checkbox(label='FP enable CFGZero', value=False)
use_preview = gr.Checkbox(label='FP enable Preview', value=True)
attention = gr.Dropdown(label="FP attention", choices=['Default', 'Xformers', 'FlashAttention', 'SageAttention'], value='Default', type='value')
vae_type = gr.Dropdown(label="FP VAE", choices=['Full', 'Tiny', 'Remote'], value='Full', type='value')
with gr.Column(elem_id='framepack-output-column', scale=2) as _column_output:
@@ -88,7 +87,7 @@ def create_ui(prompt, negative, styles, _overrides, script_inputs, mp4_fps, mp4_
duration.change(fn=change_sections, inputs=[duration, mp4_fps, mp4_interpolate, latent_ws, variant], outputs=[section_html, section_prompt])
mp4_fps.change(fn=change_sections, inputs=[duration, mp4_fps, mp4_interpolate, latent_ws, variant], outputs=[section_html, section_prompt])
mp4_interpolate.change(fn=change_sections, inputs=[duration, mp4_fps, mp4_interpolate, latent_ws, variant], outputs=[section_html, section_prompt])
btn_load.click(fn=load_model, inputs=[variant, attention], outputs=framepack_outputs)
btn_load.click(fn=load_model, inputs=[variant], outputs=framepack_outputs)
btn_unload.click(fn=unload_model, outputs=framepack_outputs)
receipe_get.click(fn=framepack_load.get_model, inputs=[], outputs=receipe)
receipe_set.click(fn=framepack_load.set_model, inputs=[receipe], outputs=[])
@@ -108,7 +107,7 @@ def create_ui(prompt, negative, styles, _overrides, script_inputs, mp4_fps, mp4_
use_teacache, use_cfgzero, use_preview,
mp4_fps, mp4_codec, mp4_sf, mp4_video, mp4_frames, mp4_thumb, mp4_opt, mp4_ext, mp4_interpolate,
mp4_scale, mp4_upscaler,
attention, vae_type, variant,
vae_type, variant,
vlm_enhance, vlm_model, vlm_system_prompt,
]
+4 -4
View File
@@ -91,11 +91,11 @@ def prepare_prompts(p, init_image, prompt:str, section_prompt:str, num_sections:
return generated_prompts
def load_model(variant, attention):
def load_model(variant):
global loaded_variant # pylint: disable=global-statement
if (shared.sd_model_type != 'hunyuanvideo') or (loaded_variant != variant):
yield gr.update(), gr.update(), 'Verifying FramePack'
framepack_install.install_requirements(attention)
framepack_install.install_requirements()
# framepack_install.git_clone(git_repo=git_repo, git_dir=git_dir, tmp_dir=tmp_dir)
# framepack_install.git_update(git_dir=git_dir, git_commit=git_commit)
# sys.path.append(git_dir)
@@ -114,7 +114,7 @@ def unload_model():
yield gr.update(), gr.update(), 'Model unloaded'
def run_framepack(task_id, _ui_state, init_image, end_image, start_weight, end_weight, vision_weight, prompt, system_prompt, optimized_prompt, section_prompt, negative_prompt, styles, seed, resolution, duration, latent_ws, steps, cfg_scale, cfg_distilled, cfg_rescale, shift, use_teacache, use_cfgzero, use_preview, mp4_fps, mp4_codec, mp4_sf, mp4_video, mp4_frames, mp4_thumb, mp4_opt, mp4_ext, mp4_interpolate, mp4_scale, mp4_upscaler, attention, vae_type, variant, vlm_enhance, vlm_model, vlm_system_prompt, *_args, **_kwargs):
def run_framepack(task_id, _ui_state, init_image, end_image, start_weight, end_weight, vision_weight, prompt, system_prompt, optimized_prompt, section_prompt, negative_prompt, styles, seed, resolution, duration, latent_ws, steps, cfg_scale, cfg_distilled, cfg_rescale, shift, use_teacache, use_cfgzero, use_preview, mp4_fps, mp4_codec, mp4_sf, mp4_video, mp4_frames, mp4_thumb, mp4_opt, mp4_ext, mp4_interpolate, mp4_scale, mp4_upscaler, vae_type, variant, vlm_enhance, vlm_model, vlm_system_prompt, *_args, **_kwargs):
variant = variant or 'Bi-Directional'
if variant == 'None':
log.error('FramePack: no model selected')
@@ -137,7 +137,7 @@ def run_framepack(task_id, _ui_state, init_image, end_image, start_weight, end_w
with call_queue.get_lock():
progress.start_task(task_id)
yield from load_model(variant, attention)
yield from load_model(variant)
if shared.sd_model_type != 'hunyuanvideo':
progress.finish_task(task_id)
yield gr.update(), gr.update(), 'Model load failed'