aanchal77 commited on
Commit
7af1646
·
verified ·
1 Parent(s): c208586

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -3
app.py CHANGED
@@ -35,9 +35,23 @@ pipe = pipe.to(device)
35
 
36
  # Extra CPU optimizations
37
  if device == "cpu":
38
- pipe.enable_attention_slicing()
39
- pipe.enable_sequential_cpu_offload()
40
- pipe.enable_vae_tiling()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
 
42
  # Define image generation function with quality toggle
43
  def generate(prompt, quality):
 
35
 
36
  # Extra CPU optimizations
37
  if device == "cpu":
38
+ try:
39
+ pipe.enable_attention_slicing()
40
+ print("✅ Attention slicing enabled")
41
+ except Exception as e:
42
+ print(f"⚠️ Could not enable attention slicing: {e}")
43
+
44
+ try:
45
+ pipe.enable_sequential_cpu_offload()
46
+ print("✅ Sequential CPU offload enabled")
47
+ except Exception as e:
48
+ print(f"⚠️ Could not enable sequential CPU offload: {e}")
49
+
50
+ try:
51
+ pipe.enable_vae_tiling()
52
+ print("✅ VAE tiling enabled")
53
+ except Exception as e:
54
+ print(f"⚠️ Could not enable VAE tiling: {e}")
55
 
56
  # Define image generation function with quality toggle
57
  def generate(prompt, quality):