Spaces:
Running
on
Zero
Running
on
Zero
Update model.py
Browse files
model.py
CHANGED
|
@@ -8,10 +8,7 @@ from diffusers import (
|
|
| 8 |
ControlNetModel,
|
| 9 |
LCMScheduler
|
| 10 |
)
|
| 11 |
-
# --- START FIX ---
|
| 12 |
-
# Import MultiControlNetModel from its new, correct location
|
| 13 |
from diffusers.models.controlnets.multicontrolnet import MultiControlNetModel
|
| 14 |
-
# --- END FIX ---
|
| 15 |
|
| 16 |
# Import the custom pipeline from your local file
|
| 17 |
from pipeline_stable_diffusion_xl_instantid_img2img import StableDiffusionXLInstantIDImg2ImgPipeline
|
|
@@ -137,13 +134,15 @@ class ModelHandler:
|
|
| 137 |
local_dir_use_symlinks=False
|
| 138 |
)
|
| 139 |
|
| 140 |
-
# The custom pipeline has this method, now pass the LOCAL FILE PATH
|
| 141 |
print(f"Loading IP-Adapter from local file: {ip_adapter_local_path}")
|
| 142 |
self.pipeline.load_ip_adapter_instantid(ip_adapter_local_path) # Pass local path
|
| 143 |
|
|
|
|
| 144 |
self.pipeline.load_lora_weights(Config.REPO_ID, weight_name=Config.LORA_FILENAME)
|
| 145 |
-
|
| 146 |
-
|
|
|
|
|
|
|
| 147 |
# 6. Load Preprocessors
|
| 148 |
print("Loading Preprocessors (Zoe, LineArt)...")
|
| 149 |
self.zoe_detector = ZoeDetector.from_pretrained(Config.ANNOTATOR_REPO)
|
|
|
|
| 8 |
ControlNetModel,
|
| 9 |
LCMScheduler
|
| 10 |
)
|
|
|
|
|
|
|
| 11 |
from diffusers.models.controlnets.multicontrolnet import MultiControlNetModel
|
|
|
|
| 12 |
|
| 13 |
# Import the custom pipeline from your local file
|
| 14 |
from pipeline_stable_diffusion_xl_instantid_img2img import StableDiffusionXLInstantIDImg2ImgPipeline
|
|
|
|
| 134 |
local_dir_use_symlinks=False
|
| 135 |
)
|
| 136 |
|
|
|
|
| 137 |
print(f"Loading IP-Adapter from local file: {ip_adapter_local_path}")
|
| 138 |
self.pipeline.load_ip_adapter_instantid(ip_adapter_local_path) # Pass local path
|
| 139 |
|
| 140 |
+
print("Loading LoRA weights...")
|
| 141 |
self.pipeline.load_lora_weights(Config.REPO_ID, weight_name=Config.LORA_FILENAME)
|
| 142 |
+
|
| 143 |
+
# --- FIX: REMOVED self.pipeline.fuse_lora() ---
|
| 144 |
+
# We do not fuse, so we can set the scale at runtime.
|
| 145 |
+
|
| 146 |
# 6. Load Preprocessors
|
| 147 |
print("Loading Preprocessors (Zoe, LineArt)...")
|
| 148 |
self.zoe_detector = ZoeDetector.from_pretrained(Config.ANNOTATOR_REPO)
|