From db4e3e321954ae71e4573f8479ee7171fbe21e3e Mon Sep 17 00:00:00 2001 From: Lilith Date: Sat, 24 Jan 2026 22:49:18 -0800 Subject: [PATCH] =?UTF-8?q?chore(image=5Fpipeline):=20=F0=9F=94=A7=20Fix?= =?UTF-8?q?=20ControlNet=20model=20initialization=20edge=20cases=20to=20pr?= =?UTF-8?q?event=20instability=20during=20image=20generation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/image_pipeline/utils/controlnet_manager.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/orchestrators/imajin-pipeline/src/image_pipeline/utils/controlnet_manager.py b/orchestrators/imajin-pipeline/src/image_pipeline/utils/controlnet_manager.py index 69e019ca..a82269a1 100644 --- a/orchestrators/imajin-pipeline/src/image_pipeline/utils/controlnet_manager.py +++ b/orchestrators/imajin-pipeline/src/image_pipeline/utils/controlnet_manager.py @@ -45,6 +45,11 @@ class ControlNetManager: "instantid_sdxl": "ControlNetModel", } + # Models that only have fp16 weights (require variant="fp16") + CONTROLNET_VARIANTS = { + "recolor_sdxl": "fp16", # OzzyGT only provides fp16 weights + } + # VRAM estimates per model (MB) VRAM_ESTIMATES = { "openpose_sdxl": 2000, # ~2GB @@ -104,6 +109,7 @@ class ControlNetManager: model_id = cls.CONTROLNET_MODELS[model_key] subfolder = cls.CONTROLNET_SUBFOLDERS.get(model_key) + variant = cls.CONTROLNET_VARIANTS.get(model_key) # Set dtype if dtype is None: @@ -113,9 +119,10 @@ class ControlNetManager: if "cuda" in device: cls._check_vram_availability(model_key, device) + variant_info = f", variant={variant}" if variant else "" subfolder_info = f", subfolder={subfolder}" if subfolder else "" logger.info( - f"Loading ControlNet: {model_key} from {model_id}{subfolder_info} (device={device}, dtype={dtype})" + f"Loading ControlNet: {model_key} from {model_id}{subfolder_info}{variant_info} (device={device}, dtype={dtype})" ) try: @@ -125,6 +132,8 @@ class ControlNetManager: } if subfolder: load_kwargs["subfolder"] = subfolder + if variant: + load_kwargs["variant"] = variant # Try loading with safetensors first (faster), fallback to .bin if not available try: