Skip to content

Commit 8a4ff74

Browse files
Fix mistake in last commit. (Comfy-Org#8496)
* Move to right place.
1 parent af1eb58 commit 8a4ff74

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

comfy/ldm/flux/model.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ def block_wrap(args):
159159
if add is not None:
160160
img += add
161161

162+
if img.dtype == torch.float16:
163+
img = torch.nan_to_num(img, nan=0.0, posinf=65504, neginf=-65504)
164+
162165
img = torch.cat((txt, img), 1)
163166

164167
for i, block in enumerate(self.single_blocks):
@@ -187,9 +190,6 @@ def block_wrap(args):
187190
if add is not None:
188191
img[:, txt.shape[1] :, ...] += add
189192

190-
if img.dtype == torch.float16:
191-
img = torch.nan_to_num(img, nan=0.0, posinf=65504, neginf=-65504)
192-
193193
img = img[:, txt.shape[1] :, ...]
194194

195195
img = self.final_layer(img, vec) # (N, T, patch_size ** 2 * out_channels)

0 commit comments

Comments
 (0)