From e3858289be942b1899fd1839d1b74ab2787dece5 Mon Sep 17 00:00:00 2001 From: Justin John Date: Sat, 4 Nov 2023 12:00:37 +0530 Subject: [PATCH] Update app.py --- animation/TokenFlow-WebUI/app.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/animation/TokenFlow-WebUI/app.py b/animation/TokenFlow-WebUI/app.py index 214c482..b0f4054 100644 --- a/animation/TokenFlow-WebUI/app.py +++ b/animation/TokenFlow-WebUI/app.py @@ -32,6 +32,7 @@ unet = UNet2DConditionModel.from_pretrained(model_id, subfolder="unet", revision tokenflow_pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=to).to(device) if device == "cuda": tokenflow_pipe.enable_xformers_memory_efficient_attention() + # tokenflow_pipe.enable_attention_slicing() def randomize_seed_fn(): seed = random.randint(0, np.iinfo(np.int32).max) @@ -120,7 +121,7 @@ def preprocess_and_invert(input_video, steps, n_timesteps = 50, batch_size: int = 8, - n_frames: int = 40, + n_frames: int = 10000, inversion_prompt:str = '', ): @@ -172,11 +173,11 @@ def edit_with_pnp(input_video, pnp_attn_t: float = 0.5, pnp_f_t: float = 0.8, batch_size: int = 8, #needs to be the same as for preprocess - n_frames: int = 40,#needs to be the same as for preprocess + n_frames: int = 10000,#needs to be the same as for preprocess n_timesteps: int = 50, gudiance_scale: float = 7.5, inversion_prompt: str = "", #needs to be the same as for preprocess - n_fps: int = 10, + n_fps: int = 30, progress=gr.Progress(track_tqdm=True) ): config = {} @@ -281,19 +282,19 @@ with gr.Blocks(css="style.css") as demo: randomize_seed = gr.Checkbox(label='Randomize seed', value=False) gudiance_scale = gr.Slider(label='Guidance Scale', minimum=1, maximum=30, value=7.5, step=0.5, interactive=True) - steps = gr.Slider(label='Inversion steps', minimum=10, maximum=500, - value=200, step=1, interactive=True) + steps = gr.Slider(label='Inversion steps', minimum=10, maximum=200, + value=500, step=1, interactive=True) with gr.Column(min_width=100): inversion_prompt = gr.Textbox(lines=1, label="Inversion prompt", interactive=True, placeholder="") batch_size = gr.Slider(label='Batch size', minimum=1, maximum=10, - value=8, step=1, interactive=True) - n_frames = gr.Slider(label='Num frames', minimum=2, maximum=200, - value=24, step=1, interactive=True) + value=10, step=1, interactive=True) + n_frames = gr.Slider(label='Num frames', minimum=2, maximum=10000, + value=10000, step=1, interactive=True) n_timesteps = gr.Slider(label='Diffusion steps', minimum=25, maximum=100, value=25, step=25, interactive=True) n_fps = gr.Slider(label='Frames per second', minimum=1, maximum=60, - value=10, step=1, interactive=True) + value=30, step=1, interactive=True) with gr.TabItem('Plug-and-Play Parameters'): with gr.Column(min_width=100): @@ -378,4 +379,4 @@ with gr.Blocks(css="style.css") as demo: ) demo.queue() -demo.launch() +demo.launch() \ No newline at end of file