p1atdev commited on
Commit
72c2560
1 Parent(s): 23f3fad

fix: move to cuda before torch compile

Browse files
Files changed (1) hide show
  1. diffusion.py +3 -4
diffusion.py CHANGED
@@ -38,17 +38,16 @@ class ImageGenerator:
38
  subfolder="scheduler",
39
  )
40
 
41
- # xformers
42
- # self.pipe.enable_xformers_memory_efficient_attention()
43
  self.pipe.unet.set_attn_processor(AttnProcessor2_0())
44
 
 
 
45
  try:
46
  self.pipe = torch.compile(self.pipe)
47
  except Exception as e:
48
  print("torch.compile is not supported on this system")
49
 
50
- self.pipe.to("cuda")
51
-
52
  @torch.no_grad()
53
  @spaces.GPU(duration=30)
54
  def generate(
 
38
  subfolder="scheduler",
39
  )
40
 
41
+ # sdpa
 
42
  self.pipe.unet.set_attn_processor(AttnProcessor2_0())
43
 
44
+ self.pipe.to("cuda")
45
+
46
  try:
47
  self.pipe = torch.compile(self.pipe)
48
  except Exception as e:
49
  print("torch.compile is not supported on this system")
50
 
 
 
51
  @torch.no_grad()
52
  @spaces.GPU(duration=30)
53
  def generate(