Spaces:
Running
on
Zero
Running
on
Zero
Update model.py
Browse files
model.py
CHANGED
|
@@ -116,15 +116,18 @@ class ModelHandler:
|
|
| 116 |
except Exception as e:
|
| 117 |
print(f" [WARNING] Failed to enable xFormers: {e}")
|
| 118 |
|
| 119 |
-
# 4. Set Scheduler
|
| 120 |
-
# --- MODIFIED: Disable clipping to prevent NaN artifacts ---
|
| 121 |
print("Configuring LCMScheduler...")
|
| 122 |
scheduler_config = self.pipeline.scheduler.config
|
| 123 |
scheduler_config['clip_sample'] = False
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
# 5. Load Adapters (IP-Adapter & LoRA)
|
| 129 |
print("Loading Adapters (IP-Adapter & LoRA)...")
|
| 130 |
|
|
|
|
| 116 |
except Exception as e:
|
| 117 |
print(f" [WARNING] Failed to enable xFormers: {e}")
|
| 118 |
|
|
|
|
|
|
|
| 119 |
print("Configuring LCMScheduler...")
|
| 120 |
scheduler_config = self.pipeline.scheduler.config
|
| 121 |
scheduler_config['clip_sample'] = False
|
| 122 |
+
|
| 123 |
+
# --- MODIFIED: optimize for sharp pixel art style ---
|
| 124 |
+
self.pipeline.scheduler = LCMScheduler.from_config(
|
| 125 |
+
scheduler_config,
|
| 126 |
+
timestep_spacing="trailing", # "trailing" is generally sharper for LCM
|
| 127 |
+
rescale_betas_zero_snr=True # Helps prevent washed out colors in style transfer
|
| 128 |
+
)
|
| 129 |
+
print(" [OK] LCMScheduler loaded (clip_sample=False, trailing spacing).")
|
| 130 |
+
|
| 131 |
# 5. Load Adapters (IP-Adapter & LoRA)
|
| 132 |
print("Loading Adapters (IP-Adapter & LoRA)...")
|
| 133 |
|