From 6383ec358cd26ae5f70fd1d11adc39074273aadb Mon Sep 17 00:00:00 2001 From: Mr-Neutr0n <64578610+Mr-Neutr0n@users.noreply.github.com> Date: Sat, 7 Feb 2026 05:23:11 +0530 Subject: [PATCH] Fix AttributeError when pipe.dit is None When using split training with 'sft:data_process' task, the DiT model is not loaded but the attribute 'dit' exists with value None. The existing hasattr check returns True but then accessing siglip_embedder fails. Add an explicit None check before accessing pipe.dit.siglip_embedder. Fixes #1246 --- diffsynth/pipelines/z_image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diffsynth/pipelines/z_image.py b/diffsynth/pipelines/z_image.py index 2c5b6873..32089b13 100644 --- a/diffsynth/pipelines/z_image.py +++ b/diffsynth/pipelines/z_image.py @@ -296,7 +296,7 @@ def encode_prompt_omni( def process(self, pipe: ZImagePipeline, prompt, edit_image): pipe.load_models_to_device(self.onload_model_names) - if hasattr(pipe, "dit") and pipe.dit.siglip_embedder is not None: + if hasattr(pipe, "dit") and pipe.dit is not None and pipe.dit.siglip_embedder is not None: # Z-Image-Turbo and Z-Image-Omni-Base use different prompt encoding methods. # We determine which encoding method to use based on the model architecture. # If you are using two-stage split training,