Spaces:
Runtime error
Runtime error
Update generator.py
Browse files- generator.py +9 -9
generator.py
CHANGED
|
@@ -763,19 +763,19 @@ class RetroArtConverter:
|
|
| 763 |
|
| 764 |
pipe_kwargs["generator"] = generator
|
| 765 |
|
| 766 |
-
# --- FIX:
|
| 767 |
-
# No more try/finally, no more .to(device)
|
| 768 |
-
# This works because optimize_pipeline() no longer offloads the text encoders.
|
| 769 |
if self.use_compel and self.compel is not None:
|
| 770 |
try:
|
| 771 |
print("Encoding prompts with Compel...")
|
| 772 |
-
conditioning = self.compel(prompt)
|
| 773 |
-
negative_conditioning = self.compel(negative_prompt)
|
| 774 |
|
| 775 |
-
|
| 776 |
-
|
| 777 |
-
|
| 778 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 779 |
|
| 780 |
print("[OK] Using Compel-encoded prompts")
|
| 781 |
except Exception as e:
|
|
|
|
| 763 |
|
| 764 |
pipe_kwargs["generator"] = generator
|
| 765 |
|
| 766 |
+
# --- START FIX: Call Compel in a single batch ---
|
|
|
|
|
|
|
| 767 |
if self.use_compel and self.compel is not None:
|
| 768 |
try:
|
| 769 |
print("Encoding prompts with Compel...")
|
|
|
|
|
|
|
| 770 |
|
| 771 |
+
# Pass both prompts as a list
|
| 772 |
+
conditioning_batch = self.compel([prompt, negative_prompt])
|
| 773 |
+
|
| 774 |
+
# Unpack the batch results
|
| 775 |
+
pipe_kwargs["prompt_embeds"] = conditioning_batch[0][0]
|
| 776 |
+
pipe_kwargs["pooled_prompt_embeds"] = conditioning_batch[0][1]
|
| 777 |
+
pipe_kwargs["negative_prompt_embeds"] = conditioning_batch[1][0]
|
| 778 |
+
pipe_kwargs["negative_pooled_prompt_embeds"] = conditioning_batch[1][1]
|
| 779 |
|
| 780 |
print("[OK] Using Compel-encoded prompts")
|
| 781 |
except Exception as e:
|