Spaces:
Runtime error
Runtime error
Upload 2 files
Browse files- generator.py +0 -2
- models.py +15 -14
generator.py
CHANGED
|
@@ -82,10 +82,8 @@ class RetroArtConverter:
|
|
| 82 |
self.image_proj_model = None
|
| 83 |
|
| 84 |
# Setup Compel
|
| 85 |
-
# TEMPORARILY DISABLED - SDXL token mismatch issue
|
| 86 |
# Setup Compel
|
| 87 |
self.compel, self.use_compel = setup_compel(self.pipe)
|
| 88 |
-
print(" [INFO] Compel temporarily disabled - using standard prompts")
|
| 89 |
|
| 90 |
# Setup LCM scheduler
|
| 91 |
setup_scheduler(self.pipe)
|
|
|
|
| 82 |
self.image_proj_model = None
|
| 83 |
|
| 84 |
# Setup Compel
|
|
|
|
| 85 |
# Setup Compel
|
| 86 |
self.compel, self.use_compel = setup_compel(self.pipe)
|
|
|
|
| 87 |
|
| 88 |
# Setup LCM scheduler
|
| 89 |
setup_scheduler(self.pipe)
|
models.py
CHANGED
|
@@ -241,21 +241,22 @@ def setup_ip_adapter(pipe, image_encoder):
|
|
| 241 |
# Load image_proj weights
|
| 242 |
if image_proj_state_dict:
|
| 243 |
try:
|
| 244 |
-
#
|
| 245 |
-
|
| 246 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
except Exception as e:
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
missing, unexpected = image_proj_model.load_state_dict(image_proj_state_dict, strict=False)
|
| 251 |
-
print(f" [OK] Resampler loaded with pretrained weights (non-strict)")
|
| 252 |
-
if missing:
|
| 253 |
-
print(f" Missing keys: {missing[:5]}...") # Show first 5
|
| 254 |
-
if unexpected:
|
| 255 |
-
print(f" Unexpected keys: {unexpected[:5]}...") # Show first 5
|
| 256 |
-
except Exception as e2:
|
| 257 |
-
print(f" [WARNING] Could not load Resampler weights: {e2}")
|
| 258 |
-
print(" Using randomly initialized Resampler")
|
| 259 |
else:
|
| 260 |
print(" [WARNING] No image_proj weights found in state dict")
|
| 261 |
print(" Using randomly initialized Resampler")
|
|
|
|
| 241 |
# Load image_proj weights
|
| 242 |
if image_proj_state_dict:
|
| 243 |
try:
|
| 244 |
+
# Check if weights are nested under 'image_proj' key
|
| 245 |
+
if 'image_proj' in image_proj_state_dict and isinstance(image_proj_state_dict['image_proj'], dict):
|
| 246 |
+
actual_weights = image_proj_state_dict['image_proj']
|
| 247 |
+
else:
|
| 248 |
+
actual_weights = image_proj_state_dict
|
| 249 |
+
|
| 250 |
+
# Try loading the weights
|
| 251 |
+
missing, unexpected = image_proj_model.load_state_dict(actual_weights, strict=False)
|
| 252 |
+
print(" [OK] Resampler loaded with pretrained weights")
|
| 253 |
+
if missing:
|
| 254 |
+
print(f" Missing keys: {missing[:5]}...")
|
| 255 |
+
if unexpected:
|
| 256 |
+
print(f" Unexpected keys: {unexpected[:5]}...")
|
| 257 |
except Exception as e:
|
| 258 |
+
print(f" [WARNING] Could not load Resampler weights: {e}")
|
| 259 |
+
print(" Using randomly initialized Resampler")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 260 |
else:
|
| 261 |
print(" [WARNING] No image_proj weights found in state dict")
|
| 262 |
print(" Using randomly initialized Resampler")
|