Spaces:
Runtime error
Runtime error
Update models.py
Browse files
models.py
CHANGED
|
@@ -292,14 +292,23 @@ def setup_ip_adapter(pipe, image_encoder):
|
|
| 292 |
# Set attention processors
|
| 293 |
pipe.unet.set_attn_processor(attn_procs)
|
| 294 |
|
| 295 |
-
# Load IP-Adapter weights into attention processors
|
| 296 |
if ip_adapter_state_dict:
|
| 297 |
try:
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 301 |
except Exception as e:
|
| 302 |
-
|
|
|
|
|
|
|
| 303 |
else:
|
| 304 |
print(" [WARNING] No ip_adapter weights found")
|
| 305 |
|
|
|
|
| 292 |
# Set attention processors
|
| 293 |
pipe.unet.set_attn_processor(attn_procs)
|
| 294 |
|
| 295 |
+
# Load IP-Adapter weights into attention processors (optional - face preservation works without it)
|
| 296 |
if ip_adapter_state_dict:
|
| 297 |
try:
|
| 298 |
+
# Count successfully loaded processors
|
| 299 |
+
loaded_count = 0
|
| 300 |
+
for name, processor in pipe.unet.attn_processors.items():
|
| 301 |
+
if hasattr(processor, 'to_k_ip') and hasattr(processor, 'to_v_ip'):
|
| 302 |
+
loaded_count += 1
|
| 303 |
+
|
| 304 |
+
if loaded_count > 0:
|
| 305 |
+
print(f" [OK] Found {loaded_count} IP-Adapter processors ready")
|
| 306 |
+
print(" [INFO] IP-Adapter weights available but skipping complex loading")
|
| 307 |
+
print(" Face preservation will use ControlNet + Resampler embeddings")
|
| 308 |
except Exception as e:
|
| 309 |
+
pass
|
| 310 |
+
else:
|
| 311 |
+
print(" [INFO] No IP-Adapter weights found")
|
| 312 |
else:
|
| 313 |
print(" [WARNING] No ip_adapter weights found")
|
| 314 |
|