Spaces:
Runtime error
Runtime error
Update generator.py
Browse files- generator.py +3 -23
generator.py
CHANGED
|
@@ -628,29 +628,9 @@ class RetroArtConverter:
|
|
| 628 |
print(f" - Resampler output: {face_proj_embeds.shape}")
|
| 629 |
print(f" - Scale: {boosted_scale:.2f}")
|
| 630 |
|
| 631 |
-
#
|
| 632 |
-
|
| 633 |
-
|
| 634 |
-
original_embeds = pipe_kwargs['prompt_embeds']
|
| 635 |
-
|
| 636 |
-
# Handle CFG (classifier-free guidance)
|
| 637 |
-
if original_embeds.shape[0] > 1: # Has negative + positive
|
| 638 |
-
# Duplicate for negative + positive
|
| 639 |
-
face_proj_embeds = torch.cat([
|
| 640 |
-
torch.zeros_like(face_proj_embeds), # Negative
|
| 641 |
-
face_proj_embeds # Positive
|
| 642 |
-
], dim=0)
|
| 643 |
-
|
| 644 |
-
# Concatenate: [batch, text_tokens, 2048] + [batch, 16, 2048]
|
| 645 |
-
combined_embeds = torch.cat([original_embeds, face_proj_embeds], dim=1)
|
| 646 |
-
pipe_kwargs['prompt_embeds'] = combined_embeds
|
| 647 |
-
|
| 648 |
-
print(f" - Text embeds: {original_embeds.shape}")
|
| 649 |
-
print(f" - Combined embeds: {combined_embeds.shape}")
|
| 650 |
-
print(f" [OK] Face embeddings concatenated successfully!")
|
| 651 |
-
|
| 652 |
-
else:
|
| 653 |
-
print(f" [WARNING] Can't concatenate - no prompt_embeds (use Compel)")
|
| 654 |
|
| 655 |
elif has_detected_faces and self.models_loaded.get('ip_adapter', False):
|
| 656 |
# Face detected but embeddings unavailable
|
|
|
|
| 628 |
print(f" - Resampler output: {face_proj_embeds.shape}")
|
| 629 |
print(f" - Scale: {boosted_scale:.2f}")
|
| 630 |
|
| 631 |
+
# Pass face embeddings through image_embeds parameter (works without Compel)
|
| 632 |
+
pipe_kwargs['image_embeds'] = face_proj_embeds
|
| 633 |
+
print(f" [OK] Face embeddings set for IP-Adapter!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 634 |
|
| 635 |
elif has_detected_faces and self.models_loaded.get('ip_adapter', False):
|
| 636 |
# Face detected but embeddings unavailable
|