Fix fp8 model training

This commit is contained in:
Kohaku-Blueleaf 2025-09-14 11:29:39 +08:00
parent eea608e48f
commit 4a976adcd7

View File

@ -336,12 +336,13 @@ class fp8_ops(manual_cast):
return None return None
def forward_comfy_cast_weights(self, input): def forward_comfy_cast_weights(self, input):
try: if not self.training:
out = fp8_linear(self, input) try:
if out is not None: out = fp8_linear(self, input)
return out if out is not None:
except Exception as e: return out
logging.info("Exception during fp8 op: {}".format(e)) except Exception as e:
logging.info("Exception during fp8 op: {}".format(e))
weight, bias = cast_bias_weight(self, input) weight, bias = cast_bias_weight(self, input)
return torch.nn.functional.linear(input, weight, bias) return torch.nn.functional.linear(input, weight, bias)