diff --git a/example3_multitrans.py b/example3_multitrans.py index 479ab5a..cb5772b 100644 --- a/example3_multitrans.py +++ b/example3_multitrans.py @@ -32,47 +32,28 @@ torch.set_grad_enabled(False) #%% First let us spawn a stable diffusion holder device = "cuda:0" -num_inference_steps = 20 # Number of diffusion interations fp_ckpt = "../stable_diffusion_models/ckpt/768-v-ema.ckpt" fp_config = '../stablediffusion/configs/stable-diffusion/v2-inference-v.yaml' - -sdh = StableDiffusionHolder(fp_ckpt, fp_config, device, num_inference_steps=num_inference_steps) +sdh = StableDiffusionHolder(fp_ckpt, fp_config, device) #%% MULTITRANS - -num_inference_steps = 30 # Number of diffusion interations -list_nmb_branches = [2, 10, 50, 100, 200] # -list_injection_strength = list(np.linspace(0.5, 0.95, 4)) # Branching structure: how deep is the blending -list_injection_strength.insert(0, 0.0) - - - - - -guidance_scale = 5 fps = 30 -duration_single_trans = 20 -width = 768 -height = 768 - -lb = LatentBlending(sdh, num_inference_steps, guidance_scale) - -# deepth_strength = 0.5 -# num_inference_steps, list_injection_idx, list_nmb_branches = lb.get_branching('medium', deepth_strength, fps*duration_single_trans) - +duration_single_trans = 15 +quality = 'high' +deepth_strength = 0.55 +lb = LatentBlending(sdh) +lb.autosetup_branching(quality=quality, deepth_strength=deepth_strength) list_prompts = [] list_prompts.append("surrealistic statue made of glitter and dirt, standing in a lake, atmospheric light, strange glow") list_prompts.append("statue of a mix between a tree and human, made of marble, incredibly detailed") list_prompts.append("weird statue of a frog monkey, many colors, standing next to the ruins of an ancient city") -list_prompts.append("statue made of hot metal, bizzarre, dark clouds in the sky") list_prompts.append("statue of a spider that looked like a human") list_prompts.append("statue of a bird that looked like a scorpion") list_prompts.append("statue of an ancient cybernetic messenger annoucing good news, golden, futuristic") - -list_seeds = [234187386, 422209351, 241845736, 28652396, 783279867, 831049796, 234903931] +list_seeds = [954375479, 332539350, 956051013, 408831845, 250009012, 675588737] fp_movie = "movie_example3.mp4" ms = MovieSaver(fp_movie, fps=fps) @@ -80,19 +61,9 @@ ms = MovieSaver(fp_movie, fps=fps) lb.run_multi_transition( list_prompts, list_seeds, - list_nmb_branches, - # list_injection_idx=list_injection_idx, - list_injection_strength=list_injection_strength, ms=ms, fps=fps, duration_single_trans=duration_single_trans ) -#%% -#for img in lb.tree_final_imgs: -# if img is not None: -# ms.write_frame(img) -# -#ms.finalize() - diff --git a/latent_blending.py b/latent_blending.py index 4f71124..faf126a 100644 --- a/latent_blending.py +++ b/latent_blending.py @@ -454,9 +454,6 @@ class LatentBlending(): self, list_prompts: List[str], list_seeds: List[int] = None, - list_nmb_branches: List[int] = None, - list_injection_strength: List[float] = None, - list_injection_idx: List[int] = None, ms: MovieSaver = None, fps: float = 24, duration_single_trans: float = 15, @@ -468,14 +465,6 @@ class LatentBlending(): list of the prompts. There will be a transition starting from the first to the last. list_seeds: List[int] = None: Random Seeds for each prompt. - list_nmb_branches: List[int]: - list of the number of branches for each injection. - list_injection_strength: List[float]: - list of injection strengths within interval [0, 1), values need to be increasing. - Alternatively you can direclty specify the list_injection_idx. - list_injection_idx: List[int]: - list of injection strengths within interval [0, 1), values need to be increasing. - Alternatively you can specify the list_injection_strength. ms: MovieSaver You need to spawn a moviesaver instance. fps: float: @@ -505,7 +494,7 @@ class LatentBlending(): recycle_img1 = True local_seeds = [list_seeds[i], list_seeds[i+1]] - list_imgs = self.run_transition(list_nmb_branches, list_injection_strength=list_injection_strength, list_injection_idx=list_injection_idx, recycle_img1=recycle_img1, fixed_seeds=local_seeds) + list_imgs = self.run_transition(recycle_img1=recycle_img1, fixed_seeds=local_seeds) list_imgs_interp = add_frames_linear_interp(list_imgs, fps, duration_single_trans) # Save movie frame