Update handler.py
Browse files- handler.py +3 -2
handler.py
CHANGED
|
@@ -29,7 +29,9 @@ class EndpointHandler:
|
|
| 29 |
token=hf_token
|
| 30 |
).to("cuda")
|
| 31 |
|
| 32 |
-
|
|
|
|
|
|
|
| 33 |
|
| 34 |
print("🚀 Pipeline loaded successfully!")
|
| 35 |
|
|
@@ -39,7 +41,6 @@ class EndpointHandler:
|
|
| 39 |
prompt = data.get("prompt", "")
|
| 40 |
negative_prompt = data.get("negative_prompt", "blurry, bad quality, distorted, extra limbs")
|
| 41 |
|
| 42 |
-
# Always generate 10 images
|
| 43 |
num_images = 10
|
| 44 |
|
| 45 |
# Decode uploaded image
|
|
|
|
| 29 |
token=hf_token
|
| 30 |
).to("cuda")
|
| 31 |
|
| 32 |
+
# IMPORTANT FIX — remove xformers, use PyTorch attention instead
|
| 33 |
+
if hasattr(self.pipe, "enable_model_cpu_offload"):
|
| 34 |
+
self.pipe.enable_model_cpu_offload()
|
| 35 |
|
| 36 |
print("🚀 Pipeline loaded successfully!")
|
| 37 |
|
|
|
|
| 41 |
prompt = data.get("prompt", "")
|
| 42 |
negative_prompt = data.get("negative_prompt", "blurry, bad quality, distorted, extra limbs")
|
| 43 |
|
|
|
|
| 44 |
num_images = 10
|
| 45 |
|
| 46 |
# Decode uploaded image
|