Skip to content

Commit 7e84bf5

Browse files
This doesn't seem to be needed on chroma. (Comfy-Org#8209)
1 parent 4f3b50b commit 7e84bf5

1 file changed

Lines changed: 0 additions & 5 deletions

File tree

comfy/ldm/chroma/layers.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,6 @@ def forward(self, img: Tensor, txt: Tensor, pe: Tensor, vec: Tensor, attn_mask=N
109109
txt += txt_mod1.gate * self.txt_attn.proj(txt_attn)
110110
txt += txt_mod2.gate * self.txt_mlp((1 + txt_mod2.scale) * self.txt_norm2(txt) + txt_mod2.shift)
111111

112-
if txt.dtype == torch.float16:
113-
txt = torch.nan_to_num(txt, nan=0.0, posinf=65504, neginf=-65504)
114-
115112
return img, txt
116113

117114

@@ -163,8 +160,6 @@ def forward(self, x: Tensor, pe: Tensor, vec: Tensor, attn_mask=None) -> Tensor:
163160
# compute activation in mlp stream, cat again and run second linear layer
164161
output = self.linear2(torch.cat((attn, self.mlp_act(mlp)), 2))
165162
x += mod.gate * output
166-
if x.dtype == torch.float16:
167-
x = torch.nan_to_num(x, nan=0.0, posinf=65504, neginf=-65504)
168163
return x
169164

170165

0 commit comments

Comments
 (0)