We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent af1eb58 commit 8a4ff74Copy full SHA for 8a4ff74
comfy/ldm/flux/model.py
@@ -159,6 +159,9 @@ def block_wrap(args):
159
if add is not None:
160
img += add
161
162
+ if img.dtype == torch.float16:
163
+ img = torch.nan_to_num(img, nan=0.0, posinf=65504, neginf=-65504)
164
+
165
img = torch.cat((txt, img), 1)
166
167
for i, block in enumerate(self.single_blocks):
@@ -187,9 +190,6 @@ def block_wrap(args):
187
190
188
191
img[:, txt.shape[1] :, ...] += add
189
192
- if img.dtype == torch.float16:
- img = torch.nan_to_num(img, nan=0.0, posinf=65504, neginf=-65504)
-
193
img = img[:, txt.shape[1] :, ...]
194
195
img = self.final_layer(img, vec) # (N, T, patch_size ** 2 * out_channels)
0 commit comments