ford442 commited on
Commit
77eb9f6
·
verified ·
1 Parent(s): 55c0667

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -156,13 +156,13 @@ def infer(
156
  print('-- filtered prompt --')
157
  print(enhanced_prompt)
158
  if latent_file: # Check if a latent file is provided
159
- initial_latents = pipeline.prepare_latents(
160
  batch_size=1,
161
- num_channels_latents=pipeline.unet.in_channels,
162
- height=pipeline.unet.sample_size[0],
163
- width=pipeline.unet.sample_size[1],
164
- dtype=pipeline.unet.dtype,
165
- device=pipeline.device,
166
  generator=generator,
167
  )
168
  sd_image_a = torch.load(latent_file.name) # Load the latent
@@ -203,13 +203,13 @@ def infer(
203
  # Encode the generated image into latents
204
  with torch.no_grad():
205
  generated_latents = vae.encode(generated_image_tensor.to(torch.bfloat16)).latent_dist.sample().mul_(0.18215)
206
- initial_latents = pipeline.prepare_latents(
207
  batch_size=1,
208
- num_channels_latents=pipeline.unet.in_channels,
209
- height=pipeline.unet.sample_size[0],
210
- width=pipeline.unet.sample_size[1],
211
- dtype=pipeline.unet.dtype,
212
- device=pipeline.device,
213
  generator=generator,
214
  )
215
  initial_latents += generated_latents
 
156
  print('-- filtered prompt --')
157
  print(enhanced_prompt)
158
  if latent_file: # Check if a latent file is provided
159
+ initial_latents = pipe.prepare_latents(
160
  batch_size=1,
161
+ num_channels_latents=pipe.unet.in_channels,
162
+ height=pipe.unet.sample_size[0],
163
+ width=pipe.unet.sample_size[1],
164
+ dtype=pipe.unet.dtype,
165
+ device=pipe.device,
166
  generator=generator,
167
  )
168
  sd_image_a = torch.load(latent_file.name) # Load the latent
 
203
  # Encode the generated image into latents
204
  with torch.no_grad():
205
  generated_latents = vae.encode(generated_image_tensor.to(torch.bfloat16)).latent_dist.sample().mul_(0.18215)
206
+ initial_latents = pipe.prepare_latents(
207
  batch_size=1,
208
+ num_channels_latents=pipe.unet.in_channels,
209
+ height=pipe.unet.sample_size[0],
210
+ width=pipe.unet.sample_size[1],
211
+ dtype=pipe.unet.dtype,
212
+ device=pipe.device,
213
  generator=generator,
214
  )
215
  initial_latents += generated_latents