Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion diffsynth/pipelines/z_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The added pipe.dit is not None check is correct and fixes the bug. However, since dit is always an attribute of the ZImagePipeline instance (initialized to None in __init__), the hasattr(pipe, "dit") check is redundant. You can simplify this condition for better readability.

Suggested change
if hasattr(pipe, "dit") and pipe.dit is not None and pipe.dit.siglip_embedder is not None:
if 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,
Expand Down