Spaces:
Running
on
Zero
Running
on
Zero
Update model.py
Browse files
model.py
CHANGED
|
@@ -118,8 +118,13 @@ class ModelHandler:
|
|
| 118 |
|
| 119 |
# 4. Set TCD Scheduler
|
| 120 |
print("Configuring TCDScheduler...")
|
| 121 |
-
|
| 122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
|
| 124 |
# 5. Load Adapters (IP-Adapter, TCD-LoRA & Style LoRA)
|
| 125 |
print("Loading Adapters...")
|
|
@@ -140,9 +145,9 @@ class ModelHandler:
|
|
| 140 |
print(f"Loading IP-Adapter from local file: {ip_adapter_local_path}")
|
| 141 |
self.pipeline.load_ip_adapter_instantid(ip_adapter_local_path)
|
| 142 |
|
| 143 |
-
# 5b. Load TCD LoRA
|
| 144 |
print("Loading TCD-SDXL-LoRA...")
|
| 145 |
-
tcd_lora_filename = "pytorch_lora_weights.safetensors"
|
| 146 |
tcd_lora_path = os.path.join("./models", tcd_lora_filename)
|
| 147 |
|
| 148 |
if not os.path.exists(tcd_lora_path):
|
|
@@ -156,7 +161,7 @@ class ModelHandler:
|
|
| 156 |
self.pipeline.fuse_lora(lora_scale=1.0)
|
| 157 |
print(" [OK] TCD LoRA fused.")
|
| 158 |
|
| 159 |
-
# 5c. Load Style LoRA
|
| 160 |
print("Loading Style LoRA weights...")
|
| 161 |
self.pipeline.load_lora_weights(Config.REPO_ID, weight_name=Config.LORA_FILENAME)
|
| 162 |
|
|
|
|
| 118 |
|
| 119 |
# 4. Set TCD Scheduler
|
| 120 |
print("Configuring TCDScheduler...")
|
| 121 |
+
# --- FIX: Enable Karras Sigmas for cleaner TCD generation ---
|
| 122 |
+
self.pipeline.scheduler = TCDScheduler.from_config(
|
| 123 |
+
self.pipeline.scheduler.config,
|
| 124 |
+
use_karras_sigmas=True
|
| 125 |
+
)
|
| 126 |
+
# --- END FIX ---
|
| 127 |
+
print(" [OK] TCDScheduler loaded (Karras enabled).")
|
| 128 |
|
| 129 |
# 5. Load Adapters (IP-Adapter, TCD-LoRA & Style LoRA)
|
| 130 |
print("Loading Adapters...")
|
|
|
|
| 145 |
print(f"Loading IP-Adapter from local file: {ip_adapter_local_path}")
|
| 146 |
self.pipeline.load_ip_adapter_instantid(ip_adapter_local_path)
|
| 147 |
|
| 148 |
+
# 5b. Load TCD LoRA
|
| 149 |
print("Loading TCD-SDXL-LoRA...")
|
| 150 |
+
tcd_lora_filename = "pytorch_lora_weights.safetensors"
|
| 151 |
tcd_lora_path = os.path.join("./models", tcd_lora_filename)
|
| 152 |
|
| 153 |
if not os.path.exists(tcd_lora_path):
|
|
|
|
| 161 |
self.pipeline.fuse_lora(lora_scale=1.0)
|
| 162 |
print(" [OK] TCD LoRA fused.")
|
| 163 |
|
| 164 |
+
# 5c. Load Style LoRA
|
| 165 |
print("Loading Style LoRA weights...")
|
| 166 |
self.pipeline.load_lora_weights(Config.REPO_ID, weight_name=Config.LORA_FILENAME)
|
| 167 |
|