markhristov commited on
Commit
156df86
·
1 Parent(s): 7d7aca1

the cpu doesn't have half ...

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -27,7 +27,7 @@ scheduler = LMSDiscreteScheduler(beta_start=beta_start, beta_end=beta_end, beta_
27
  def text_enc(prompts, maxlen=None):
28
  if maxlen is None: maxlen = tokenizer.model_max_length
29
  inp = tokenizer(prompts, padding="max_length", max_length=maxlen, truncation=True, return_tensors="pt")
30
- return text_encoder(inp.input_ids.to("cpu"))[0].half()
31
 
32
  def do_both(prompts):
33
  def mk_img(t):
@@ -43,7 +43,7 @@ def do_both(prompts):
43
 
44
  latents = torch.randn((bs, unet.config.in_channels, height//8, width//8))
45
  scheduler.set_timesteps(steps)
46
- latents = latents.to("cpu").half() * scheduler.init_noise_sigma
47
 
48
  for i,ts in enumerate(tqdm(scheduler.timesteps)):
49
  inp = scheduler.scale_model_input(torch.cat([latents] * 2), ts)
 
27
  def text_enc(prompts, maxlen=None):
28
  if maxlen is None: maxlen = tokenizer.model_max_length
29
  inp = tokenizer(prompts, padding="max_length", max_length=maxlen, truncation=True, return_tensors="pt")
30
+ return text_encoder(inp.input_ids.to("cpu"))[0]
31
 
32
  def do_both(prompts):
33
  def mk_img(t):
 
43
 
44
  latents = torch.randn((bs, unet.config.in_channels, height//8, width//8))
45
  scheduler.set_timesteps(steps)
46
+ latents = latents.to("cpu") * scheduler.init_noise_sigma
47
 
48
  for i,ts in enumerate(tqdm(scheduler.timesteps)):
49
  inp = scheduler.scale_model_input(torch.cat([latents] * 2), ts)