John6666 commited on
Commit
83c14cb
1 Parent(s): 31934a1

Upload animate.py

Browse files
Files changed (1) hide show
  1. demo/animate.py +4 -3
demo/animate.py CHANGED
@@ -72,9 +72,10 @@ class MagicAnimate():
72
  controlnet.to(torch.float16)
73
  self.appearance_encoder.to(torch.float16)
74
 
75
- unet.enable_xformers_memory_efficient_attention()
76
- self.appearance_encoder.enable_xformers_memory_efficient_attention()
77
- controlnet.enable_xformers_memory_efficient_attention()
 
78
 
79
  self.pipeline = AnimationPipeline(
80
  vae=vae, text_encoder=text_encoder, tokenizer=tokenizer, unet=unet, controlnet=controlnet,
 
72
  controlnet.to(torch.float16)
73
  self.appearance_encoder.to(torch.float16)
74
 
75
+ if device == "cuda":
76
+ unet.enable_xformers_memory_efficient_attention()
77
+ self.appearance_encoder.enable_xformers_memory_efficient_attention()
78
+ controlnet.enable_xformers_memory_efficient_attention()
79
 
80
  self.pipeline = AnimationPipeline(
81
  vae=vae, text_encoder=text_encoder, tokenizer=tokenizer, unet=unet, controlnet=controlnet,