Spaces:
Runtime error
Runtime error
Update models.py
Browse files
models.py
CHANGED
|
@@ -18,8 +18,8 @@ from insightface.app import FaceAnalysis
|
|
| 18 |
from controlnet_aux import ZoeDetector, OpenposeDetector, LeresDetector, MidasDetector, MediapipeFaceDetector
|
| 19 |
from huggingface_hub import hf_hub_download, snapshot_download
|
| 20 |
|
| 21 |
-
# --- START FIX: Import
|
| 22 |
-
from
|
| 23 |
# --- END FIX ---
|
| 24 |
|
| 25 |
# Use reference implementation's attention processor
|
|
@@ -385,17 +385,16 @@ def setup_ip_adapter(pipe, image_encoder):
|
|
| 385 |
return None, False
|
| 386 |
|
| 387 |
|
| 388 |
-
# --- START FIX: Use
|
| 389 |
-
def
|
| 390 |
-
"""Setup
|
| 391 |
-
print("Setting up
|
| 392 |
try:
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
return compel, True
|
| 397 |
except Exception as e:
|
| 398 |
-
print(f" [WARNING]
|
| 399 |
return None, False
|
| 400 |
# --- END FIX ---
|
| 401 |
|
|
@@ -469,4 +468,4 @@ def set_clip_skip(pipe):
|
|
| 469 |
print(f" [OK] CLIP skip set to {CLIP_SKIP}")
|
| 470 |
|
| 471 |
|
| 472 |
-
print("[OK] Model loading functions ready")
|
|
|
|
| 18 |
from controlnet_aux import ZoeDetector, OpenposeDetector, LeresDetector, MidasDetector, MediapipeFaceDetector
|
| 19 |
from huggingface_hub import hf_hub_download, snapshot_download
|
| 20 |
|
| 21 |
+
# --- START FIX: Import our new Cappella module ---
|
| 22 |
+
from cappella import Cappella
|
| 23 |
# --- END FIX ---
|
| 24 |
|
| 25 |
# Use reference implementation's attention processor
|
|
|
|
| 385 |
return None, False
|
| 386 |
|
| 387 |
|
| 388 |
+
# --- START FIX: Use our new Cappella module ---
|
| 389 |
+
def setup_cappella(pipe):
|
| 390 |
+
"""Setup Cappella for our custom prompt encoding."""
|
| 391 |
+
print("Setting up Cappella (custom prompt encoder)...")
|
| 392 |
try:
|
| 393 |
+
cappella = Cappella(pipe, device)
|
| 394 |
+
print(" [OK] Cappella loaded successfully.")
|
| 395 |
+
return cappella, True
|
|
|
|
| 396 |
except Exception as e:
|
| 397 |
+
print(f" [WARNING] Cappella not available: {e}")
|
| 398 |
return None, False
|
| 399 |
# --- END FIX ---
|
| 400 |
|
|
|
|
| 468 |
print(f" [OK] CLIP skip set to {CLIP_SKIP}")
|
| 469 |
|
| 470 |
|
| 471 |
+
print("[OK] Model loading functions ready")
|