Commit 6fb084f3 authored by comfyanonymous's avatar comfyanonymous
Browse files

Reduce floating point rounding errors in loras.

parent 91ed2815
......@@ -342,7 +342,9 @@ class ModelPatcher:
if key not in self.backup:
self.backup[key] = weight.clone()
weight[:] = self.calculate_weight(self.patches[key], weight.clone(), key)
temp_weight = weight.to(torch.float32, copy=True)
weight[:] = self.calculate_weight(self.patches[key], temp_weight, key).to(weight.dtype)
del temp_weight
return self.model
def calculate_weight(self, patches, weight, key):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment