multiple cleanups

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2026-08-17 09:35:07 +02:00
parent 392c969754
commit 9f650367cb
14 changed files with 30 additions and 20 deletions
+1 -1
View File
@@ -111,7 +111,7 @@ if __name__ == "__main__":
parser.add_argument('--rescale', type=float, default=0.0, help='cfg rescale')
parser.add_argument('--distilled', type=float, default=10.0, help='cfg distilled')
parser.add_argument('--shift', type=float, default=3.0, help='sampler shift')
parser.add_argument('--variant', type=str, default='bi-directional', choices=['bi-directional', 'forward-only'], help='model variant')
parser.add_argument('--variant', type=str, default='Bi-Directional', choices=['Bi-Directional', 'Forward-Only'], help='model variant')
args = parser.parse_args()
log.info(f'api-framepack: {args}')
generate(args)
+4 -3
View File
@@ -5,8 +5,9 @@ from modules.logger import log
models = {
'bi-directional': 'lllyasviel/FramePackI2V_HY',
'forward-only': 'lllyasviel/FramePack_F1_I2V_HY_20250503',
'None': None,
'Bi-Directional': 'lllyasviel/FramePackI2V_HY',
'Forward-Only': 'lllyasviel/FramePack_F1_I2V_HY_20250503',
}
default_model = {
'pipeline': { 'repo': 'hunyuanvideo-community/HunyuanVideo', 'subfolder': '' },
@@ -21,7 +22,7 @@ default_model = {
'tokenizer_2': { 'repo': 'hunyuanvideo-community/HunyuanVideo', 'subfolder': 'tokenizer_2' },
'feature_extractor': { 'repo': 'lllyasviel/flux_redux_bfl', 'subfolder': 'feature_extractor' },
'image_encoder': { 'repo': 'lllyasviel/flux_redux_bfl', 'subfolder': 'image_encoder' },
'transformer': { 'repo': models.get('bi-directional'), 'subfolder': '' },
'transformer': { 'repo': models.get('Bi-Directional'), 'subfolder': '' },
}
model = default_model.copy()
+1 -1
View File
@@ -18,7 +18,7 @@ def create_ui(prompt, negative, styles, _overrides, script_inputs, mp4_fps, mp4_
with gr.Row():
generate = gr.Button('Generate', elem_id="framepack_generate_btn", variant='primary', visible=False)
with gr.Row():
variant = gr.Dropdown(label="FP model variant", choices=list(framepack_load.models), value='bi-directional', type='value')
variant = gr.Dropdown(label="FP model variant", choices=list(framepack_load.models), value='None', type='value')
with gr.Row():
resolution = gr.Slider(label="FP resolution", minimum=240, maximum=1088, value=640, step=16)
duration = gr.Slider(label="FP duration", minimum=1, maximum=120, value=4, step=0.1)
+2 -2
View File
@@ -14,7 +14,7 @@ stream = None # AsyncStream
def get_latent_paddings(mp4_fps, mp4_interpolate, latent_window_size, total_second_length, variant):
try:
real_fps = mp4_fps / (mp4_interpolate + 1)
is_f1 = variant == 'forward-only'
is_f1 = variant == 'Forward-Only'
if is_f1:
total_latent_sections = (total_second_length * real_fps) / (latent_window_size * 4)
total_latent_sections = int(max(round(total_latent_sections), 1))
@@ -59,7 +59,7 @@ def worker(
from modules.framepack.pipeline import utils
from modules.framepack.pipeline import k_diffusion_hunyuan
is_f1 = variant == 'forward-only'
is_f1 = variant == 'Forward-Only'
total_generated_frames = 0
total_generated_latent_frames = 0
latent_paddings = get_latent_paddings(mp4_fps, mp4_interpolate, latent_window_size, total_second_length, variant)
+5 -1
View File
@@ -115,7 +115,11 @@ def unload_model():
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, attention, vae_type, variant, vlm_enhance, vlm_model, vlm_system_prompt, *_args, **_kwargs):
variant = variant or 'bi-directional'
variant = variant or 'Bi-Directional'
if variant == 'None':
log.error('FramePack: no model selected')
yield gr.update(), gr.update(), 'No FramePack model selected'
return
if init_image is None:
init_image = np.zeros((resolution, resolution, 3), dtype=np.uint8)
mode = 't2v'