From cbcadb3e6193ce57ac82c583bd398ca453279e62 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 14 May 2026 13:36:08 +0530 Subject: [PATCH 1/3] Add validation for invalid HiDream input dimensions --- comfy/ldm/hidream_o1/model.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/comfy/ldm/hidream_o1/model.py b/comfy/ldm/hidream_o1/model.py index a223e706f..6f8c77482 100644 --- a/comfy/ldm/hidream_o1/model.py +++ b/comfy/ldm/hidream_o1/model.py @@ -148,6 +148,12 @@ class HiDreamO1Transformer(nn.Module): raise ValueError("HiDreamO1Transformer requires input_ids and position_ids in conditioning") B, _, H, W = x.shape + + if H % self.patch_size!=0 or w% self.patch_size!=0: + raise ValueError( + f"Input dimensions ({H},{W}) must be divisible" + f"by patch size{self.patch_size}" + ) h_p, w_p = H // self.patch_size, W // self.patch_size tgt_image_len = h_p * w_p From fcfd235548350267c0e030f33b9c2e3b2d670a99 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 14 May 2026 15:58:08 +0530 Subject: [PATCH 2/3] Address review feedback for input dimension validation --- comfy/ldm/hidream_o1/model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/ldm/hidream_o1/model.py b/comfy/ldm/hidream_o1/model.py index 6f8c77482..80352da59 100644 --- a/comfy/ldm/hidream_o1/model.py +++ b/comfy/ldm/hidream_o1/model.py @@ -149,7 +149,7 @@ class HiDreamO1Transformer(nn.Module): B, _, H, W = x.shape - if H % self.patch_size!=0 or w% self.patch_size!=0: + if H % self.patch_size!=0 or W% self.patch_size!=0: raise ValueError( f"Input dimensions ({H},{W}) must be divisible" f"by patch size{self.patch_size}" From 2adb1df5c4d8098601ee4a1d8a7513afd956e7c6 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 14 May 2026 16:01:51 +0530 Subject: [PATCH 3/3] Fix validation variable name and formatting --- comfy/ldm/hidream_o1/model.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/comfy/ldm/hidream_o1/model.py b/comfy/ldm/hidream_o1/model.py index 80352da59..f1f892c80 100644 --- a/comfy/ldm/hidream_o1/model.py +++ b/comfy/ldm/hidream_o1/model.py @@ -148,12 +148,13 @@ class HiDreamO1Transformer(nn.Module): raise ValueError("HiDreamO1Transformer requires input_ids and position_ids in conditioning") B, _, H, W = x.shape - - if H % self.patch_size!=0 or W% self.patch_size!=0: + + if H % self.patch_size != 0 or W % self.patch_size != 0: raise ValueError( - f"Input dimensions ({H},{W}) must be divisible" - f"by patch size{self.patch_size}" - ) + f"Input dimensions ({H}, {W}) must be divisible " + f"by patch size {self.patch_size}" + ) + h_p, w_p = H // self.patch_size, W // self.patch_size tgt_image_len = h_p * w_p