|
34 | 34 | parser.add_argument("--server", type=str, default='0.0.0.0') |
35 | 35 | parser.add_argument("--port", type=int, required=False) |
36 | 36 | parser.add_argument("--inbrowser", action='store_true') |
37 | | -parser.add_argument("--lora", type=str, default=None, help="Lora path") |
38 | | -parser.add_argument("--lora_is_diffusers", action='store_true', help="Lora is diffusers format") |
39 | 37 | args = parser.parse_args() |
40 | 38 |
|
41 | 39 | # for win desktop probably use --server 127.0.0.1 --inbrowser |
|
84 | 82 | image_encoder.requires_grad_(False) |
85 | 83 | transformer.requires_grad_(False) |
86 | 84 |
|
87 | | -if args.lora: |
88 | | - lora = args.lora |
89 | | - lora_path, lora_name = os.path.split(lora) |
90 | | - print("Loading lora") |
91 | | - transformer = load_lora(transformer, lora_path, lora_name, args.lora_is_diffusers) |
92 | | - |
93 | 85 | if not high_vram: |
94 | 86 | # DynamicSwapInstaller is same as huggingface's enable_sequential_offload but 3x faster |
95 | 87 | DynamicSwapInstaller.install_model(transformer, device=gpu) |
|
108 | 100 |
|
109 | 101 |
|
110 | 102 | @torch.no_grad() |
111 | | -def worker(input_image, prompt, n_prompt, seed, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, use_teacache, mp4_crf): |
| 103 | +def worker(input_image, prompt, n_prompt, seed, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, use_teacache, mp4_crf, resolution): |
112 | 104 | total_latent_sections = (total_second_length * 30) / (latent_window_size * 4) |
113 | 105 | total_latent_sections = int(max(round(total_latent_sections), 1)) |
114 | 106 |
|
@@ -328,14 +320,14 @@ def callback(d): |
328 | 320 | return |
329 | 321 |
|
330 | 322 |
|
331 | | -def process(input_image, prompt, n_prompt, seed, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, use_teacache, mp4_crf): |
| 323 | +def process(input_image, prompt, n_prompt, seed, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, use_teacache, mp4_crf, resolution): |
332 | 324 | global stream |
333 | 325 |
|
334 | 326 | yield None, None, '', '', gr.update(interactive=False), gr.update(interactive=True) |
335 | 327 |
|
336 | 328 | stream = AsyncStream() |
337 | 329 |
|
338 | | - async_run(worker, input_image, prompt, n_prompt, seed, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, use_teacache, mp4_crf) |
| 330 | + async_run(worker, input_image, prompt, n_prompt, seed, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, use_teacache, mp4_crf, resolution) |
339 | 331 |
|
340 | 332 | output_filename = None |
341 | 333 |
|
@@ -372,7 +364,8 @@ def end_process(): |
372 | 364 | gr.Markdown('# FramePack') |
373 | 365 | with gr.Row(): |
374 | 366 | with gr.Column(): |
375 | | - input_image = gr.Image(sources='upload', type="numpy", label="Image", height=320) |
| 367 | + input_image = gr.Image(sources='upload', type="numpy", label="Image", height=320) |
| 368 | + resolution = gr.Slider(label="Resolution", minimum=240, maximum=720, value=640, step=16) |
376 | 369 | prompt = gr.Textbox(label="Prompt", value='') |
377 | 370 | example_quick_prompts = gr.Dataset(samples=quick_prompts, label='Quick List', samples_per_page=1000, components=[prompt]) |
378 | 371 | example_quick_prompts.click(lambda x: x[0], inputs=[example_quick_prompts], outputs=prompt, show_progress=False, queue=False) |
|
0 commit comments