RamAnanth1 commited on
Commit
d29f4c0
β€’
1 Parent(s): 453e407

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py CHANGED
@@ -29,6 +29,30 @@ model, _, _ = load_model(config, ckpt_path,
29
  )
30
  ddim_sampler = DDIMSampler(model)
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  @torch.no_grad()
33
  def sample_text2video(model, prompt, n_samples, batch_size,
34
  sample_type="ddim", sampler=None,
 
29
  )
30
  ddim_sampler = DDIMSampler(model)
31
 
32
+ def sample_denoising_batch(model, noise_shape, condition, *args,
33
+ sample_type="ddim", sampler=None,
34
+ ddim_steps=None, eta=None,
35
+ unconditional_guidance_scale=1.0, uc=None,
36
+ denoising_progress=False,
37
+ **kwargs,
38
+ ):
39
+
40
+ assert(sampler is not None)
41
+ assert(ddim_steps is not None)
42
+ assert(eta is not None)
43
+ ddim_sampler = sampler
44
+ samples, _ = ddim_sampler.sample(S=ddim_steps,
45
+ conditioning=condition,
46
+ batch_size=noise_shape[0],
47
+ shape=noise_shape[1:],
48
+ verbose=denoising_progress,
49
+ unconditional_guidance_scale=unconditional_guidance_scale,
50
+ unconditional_conditioning=uc,
51
+ eta=eta,
52
+ **kwargs,
53
+ )
54
+ return samples
55
+
56
  @torch.no_grad()
57
  def sample_text2video(model, prompt, n_samples, batch_size,
58
  sample_type="ddim", sampler=None,