linoyts HF staff commited on
Commit
74526f5
1 Parent(s): e4f255d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -31,15 +31,15 @@ def generate(slider_x, slider_y, prompt, seed, iterations, steps,
31
  print("x_concept_1", x_concept_1, "x_concept_2", x_concept_2)
32
  if not sorted(slider_x) == sorted([x_concept_1, x_concept_2]):
33
  avg_diff = clip_slider.find_latent_direction(slider_x[0], slider_x[1], num_iterations=iterations)
34
- avg_diff[0].to(torch.float16)
35
- avg_diff[1].to(torch.float16)
36
  x_concept_1, x_concept_2 = slider_x[0], slider_x[1]
37
 
38
  print("avg_diff[0].dtype", avg_diff[0].dtype)
39
  if not sorted(slider_y) == sorted([y_concept_1, y_concept_2]):
40
  avg_diff_2nd = clip_slider.find_latent_direction(slider_y[0], slider_y[1], num_iterations=iterations)
41
- avg_diff_2nd[0].to(torch.float16)
42
- avg_diff_2nd[1].to(torch.float16)
43
  y_concept_1, y_concept_2 = slider_y[0], slider_y[1]
44
  end_time = time.time()
45
  print(f"direction time: {end_time - start_time:.2f} ms")
 
31
  print("x_concept_1", x_concept_1, "x_concept_2", x_concept_2)
32
  if not sorted(slider_x) == sorted([x_concept_1, x_concept_2]):
33
  avg_diff = clip_slider.find_latent_direction(slider_x[0], slider_x[1], num_iterations=iterations)
34
+ avg_diff[0] = avg_diff[0].to(torch.float16)
35
+ avg_diff[1] = avg_diff[1].to(torch.float16)
36
  x_concept_1, x_concept_2 = slider_x[0], slider_x[1]
37
 
38
  print("avg_diff[0].dtype", avg_diff[0].dtype)
39
  if not sorted(slider_y) == sorted([y_concept_1, y_concept_2]):
40
  avg_diff_2nd = clip_slider.find_latent_direction(slider_y[0], slider_y[1], num_iterations=iterations)
41
+ avg_diff_2nd[0] = avg_diff_2nd[0].to(torch.float16)
42
+ avg_diff_2nd[1] = avg_diff_2nd[1].to(torch.float16)
43
  y_concept_1, y_concept_2 = slider_y[0], slider_y[1]
44
  end_time = time.time()
45
  print(f"direction time: {end_time - start_time:.2f} ms")