nami0342 commited on
Commit
7eb088d
Β·
1 Parent(s): ffb6807

Add xFormers library form attention calculate

Browse files
Files changed (2) hide show
  1. app.py +8 -0
  2. requirements.txt +1 -0
app.py CHANGED
@@ -185,6 +185,14 @@ pipe = TryonPipeline.from_pretrained(
185
  pipe.unet_encoder = UNet_Encoder
186
  print("βœ“ TryonPipeline initialized successfully")
187
 
 
 
 
 
 
 
 
 
188
  print("\n" + "=" * 60)
189
  print("All models loaded successfully!")
190
  print("=" * 60 + "\n")
 
185
  pipe.unet_encoder = UNet_Encoder
186
  print("βœ“ TryonPipeline initialized successfully")
187
 
188
+ # xFormers λ©”λͺ¨λ¦¬ 효율적 μ–΄ν…μ…˜ ν™œμ„±ν™” (λ©”λͺ¨λ¦¬ 20-30% κ°μ†Œ, 속도 10-20% ν–₯상)
189
+ print("\n[Optimization] Enabling xFormers memory efficient attention...")
190
+ try:
191
+ pipe.enable_xformers_memory_efficient_attention()
192
+ print("βœ“ xFormers memory efficient attention enabled")
193
+ except Exception as e:
194
+ print(f"⚠ xFormers not available, using default attention: {e}")
195
+
196
  print("\n" + "=" * 60)
197
  print("All models loaded successfully!")
198
  print("=" * 60 + "\n")
requirements.txt CHANGED
@@ -14,6 +14,7 @@ matplotlib==3.7.4
14
  tqdm==4.64.1
15
  config==0.5.1
16
  einops==0.7.0
 
17
  onnxruntime==1.16.2
18
  basicsr
19
  av
 
14
  tqdm==4.64.1
15
  config==0.5.1
16
  einops==0.7.0
17
+ xformers>=0.0.22
18
  onnxruntime==1.16.2
19
  basicsr
20
  av