Spaces:
Sleeping
Sleeping
Commit ·
a6f96a4
1
Parent(s): e4241ae
Try sequential CPU offload for even more memory savings
Browse files
app.py
CHANGED
|
@@ -66,7 +66,11 @@ log_memory("After loading pipeline")
|
|
| 66 |
# This keeps model weights on CPU and only moves to GPU when needed
|
| 67 |
log_step("Enabling CPU offloading for memory efficiency")
|
| 68 |
try:
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
pipe.enable_model_cpu_offload()
|
| 71 |
print("Enabled model CPU offload")
|
| 72 |
else:
|
|
|
|
| 66 |
# This keeps model weights on CPU and only moves to GPU when needed
|
| 67 |
log_step("Enabling CPU offloading for memory efficiency")
|
| 68 |
try:
|
| 69 |
+
# Try sequential CPU offload first (most memory efficient)
|
| 70 |
+
if hasattr(pipe, 'enable_sequential_cpu_offload'):
|
| 71 |
+
pipe.enable_sequential_cpu_offload()
|
| 72 |
+
print("Enabled sequential CPU offload (most memory efficient)")
|
| 73 |
+
elif hasattr(pipe, 'enable_model_cpu_offload'):
|
| 74 |
pipe.enable_model_cpu_offload()
|
| 75 |
print("Enabled model CPU offload")
|
| 76 |
else:
|