AYYasaswini commited on
Commit
af4b7f8
·
verified ·
1 Parent(s): 8d8f5ce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -25
app.py CHANGED
@@ -142,31 +142,6 @@ def latents_to_pil(latents):
142
  pil_images = [Image.fromarray(image) for image in images]
143
  return pil_images
144
 
145
- """We'll use a pic from the web here, but you can load your own instead by uploading it and editing the filename in the next cell."""
146
-
147
-
148
- # Setting the number of sampling steps:
149
- set_timesteps(scheduler, 15)
150
-
151
- """You can see how our new set of steps corresponds to those used in training:"""
152
-
153
- # See these in terms of the original 1000 steps used for training:
154
- print(scheduler.timesteps)
155
-
156
- """And how much noise is present at each:"""
157
-
158
- # Look at the equivalent noise levels:
159
- print(scheduler.sigmas)
160
-
161
- # TODO maybe show timestep as well
162
-
163
- """This 'sigma' is the amount of noise added to the latent representation. Let's visualize what this looks like by adding a bit of noise to our encoded image and then decoding this noised version:"""
164
-
165
- noise = torch.randn_like(encoded) # Random noise
166
- sampling_step = 10 # Equivalent to step 10 out of 15 in the schedule above
167
- # encoded_and_noised = scheduler.add_noise(encoded, noise, timestep) # Diffusers 0.3 and below
168
- encoded_and_noised = scheduler.add_noise(encoded, noise, timesteps=torch.tensor([scheduler.timesteps[sampling_step]]))
169
- latents_to_pil(encoded_and_noised.float())[0] # Display
170
 
171
  """What does this look like at different timesteps? Experiment and see for yourself!
172
 
 
142
  pil_images = [Image.fromarray(image) for image in images]
143
  return pil_images
144
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
 
146
  """What does this look like at different timesteps? Experiment and see for yourself!
147