This commit is contained in:
Soulreaver90 2026-03-28 04:39:45 +00:00 committed by GitHub
commit aa736fefc2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -122,6 +122,11 @@ class LowVramPatch:
self.set_func = set_func
def __call__(self, weight):
if weight.dtype == torch.float8_e4m3fn or weight.dtype == torch.float8_e5m2:
temp_weight = weight.to(torch.bfloat16)
patched_weight = comfy.lora.calculate_weight(self.patches[self.key], temp_weight, self.key, intermediate_dtype=torch.bfloat16)
return patched_weight.to(weight.dtype)
return comfy.lora.calculate_weight(self.patches[self.key], weight, self.key, intermediate_dtype=weight.dtype)
LOWVRAM_PATCH_ESTIMATE_MATH_FACTOR = 2