Spaces:
Runtime error
Runtime error
Update models.py
Browse files
models.py
CHANGED
|
@@ -243,7 +243,23 @@ def set_clip_skip(pipe):
|
|
| 243 |
if hasattr(pipe, 'text_encoder'):
|
| 244 |
print(f" [OK] CLIP skip {CLIP_SKIP}")
|
| 245 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 246 |
|
| 247 |
-
__all__ = ['draw_kps', 'fuse_lora_with_scale']
|
| 248 |
|
| 249 |
print("[OK] models.py ready - NO MultiControlNetModel, following examplewithface.py")
|
|
|
|
| 243 |
if hasattr(pipe, 'text_encoder'):
|
| 244 |
print(f" [OK] CLIP skip {CLIP_SKIP}")
|
| 245 |
|
| 246 |
+
|
| 247 |
+
def load_image_encoder():
|
| 248 |
+
"""Load CLIP Image Encoder for IP-Adapter."""
|
| 249 |
+
print("Loading CLIP Image Encoder for IP-Adapter...")
|
| 250 |
+
try:
|
| 251 |
+
image_encoder = CLIPVisionModelWithProjection.from_pretrained(
|
| 252 |
+
"h94/IP-Adapter",
|
| 253 |
+
subfolder="models/image_encoder",
|
| 254 |
+
torch_dtype=dtype
|
| 255 |
+
).to(device)
|
| 256 |
+
print(" [OK] CLIP Image Encoder loaded successfully")
|
| 257 |
+
return image_encoder
|
| 258 |
+
except Exception as e:
|
| 259 |
+
print(f" [ERROR] Could not load image encoder: {e}")
|
| 260 |
+
return None
|
| 261 |
+
|
| 262 |
|
| 263 |
+
__all__ = ['draw_kps', 'fuse_lora_with_scale', 'load_image_encoder']
|
| 264 |
|
| 265 |
print("[OK] models.py ready - NO MultiControlNetModel, following examplewithface.py")
|