MCPcopy Create free account
hub / github.com/360CVGroup/FancyVideo / ddim_loop

Function ddim_loop

fancyvideo/utils/util.py:76–86  ·  view source on GitHub ↗
(pipeline, ddim_scheduler, latent, num_inv_steps, prompt)

Source from the content-addressed store, hash-verified

74
75@torch.no_grad()
76def ddim_loop(pipeline, ddim_scheduler, latent, num_inv_steps, prompt):
77 context = init_prompt(prompt, pipeline)
78 uncond_embeddings, cond_embeddings = context.chunk(2)
79 all_latent = [latent]
80 latent = latent.clone().detach()
81 for i in tqdm(range(num_inv_steps)):
82 t = ddim_scheduler.timesteps[len(ddim_scheduler.timesteps) - i - 1]
83 noise_pred = get_noise_pred_single(latent, t, cond_embeddings, pipeline.unet)
84 latent = next_step(noise_pred, t, latent, ddim_scheduler)
85 all_latent.append(latent)
86 return all_latent
87
88
89@torch.no_grad()

Callers 1

ddim_inversionFunction · 0.85

Calls 3

init_promptFunction · 0.85
get_noise_pred_singleFunction · 0.85
next_stepFunction · 0.85

Tested by

no test coverage detected