vilarin commited on
Commit
c15af9a
·
verified ·
1 Parent(s): 20f6444

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -76,7 +76,8 @@ class ModelWrapper:
76
  @staticmethod
77
  def _get_time():
78
  return time.time()
79
-
 
80
  def sample(self, noise, unet_added_conditions, prompt_embed, fast_vae_decode):
81
  alphas_cumprod = self.scheduler.alphas_cumprod.to(self.device)
82
 
@@ -123,10 +124,8 @@ class ModelWrapper:
123
 
124
  add_time_ids = self.build_condition_input(height, width).repeat(num_images, 1)
125
 
126
- noise = torch.randn(num_images, 4, height // self.vae_downsample_ratio, width // self.vae_downsample_ratio, generator=generator).to(device="cuda",dtype=torch.float16)
127
 
128
- noise = noise.to(torch.float16)
129
-
130
  prompt_inputs = self._encode_prompt(prompt)
131
 
132
  start_time = self._get_time()
@@ -159,7 +158,7 @@ class ModelWrapper:
159
 
160
  return output_image_list, f"Run successfully in {(end_time-start_time):.2f} seconds"
161
 
162
- @spaces.GPU()
163
  def get_x0_from_noise(sample, model_output, alphas_cumprod, timestep):
164
  alpha_prod_t = alphas_cumprod[timestep].reshape(-1, 1, 1, 1)
165
  beta_prod_t = 1 - alpha_prod_t
 
76
  @staticmethod
77
  def _get_time():
78
  return time.time()
79
+
80
+ @spaces.GPU()
81
  def sample(self, noise, unet_added_conditions, prompt_embed, fast_vae_decode):
82
  alphas_cumprod = self.scheduler.alphas_cumprod.to(self.device)
83
 
 
124
 
125
  add_time_ids = self.build_condition_input(height, width).repeat(num_images, 1)
126
 
127
+ noise = torch.randn(num_images, 4, height // self.vae_downsample_ratio, width // self.vae_downsample_ratio, generator=generator).to(device="cuda", dtype=torch.float16)
128
 
 
 
129
  prompt_inputs = self._encode_prompt(prompt)
130
 
131
  start_time = self._get_time()
 
158
 
159
  return output_image_list, f"Run successfully in {(end_time-start_time):.2f} seconds"
160
 
161
+
162
  def get_x0_from_noise(sample, model_output, alphas_cumprod, timestep):
163
  alpha_prod_t = alphas_cumprod[timestep].reshape(-1, 1, 1, 1)
164
  beta_prod_t = 1 - alpha_prod_t