Skip to content

Commit 123a787

Browse files
authored
ops: Fix vanilla-fp8 loaded lora quality (#12390)
This was missing the stochastic rounding required for fp8 downcast to be consistent with model_patcher.patch_weight_to_device. Missed in testing as I spend too much time with quantized tensors and overlooked the simpler ones.
1 parent f719f9c commit 123a787

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

comfy/ops.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ def to_dequant(tensor, dtype):
169169
if orig.dtype == dtype and len(fns) == 0:
170170
#The layer actually wants our freshly saved QT
171171
x = y
172-
else:
173-
y = x
172+
elif update_weight:
173+
y = comfy.float.stochastic_rounding(x, orig.dtype, seed = comfy.utils.string_to_seed(s.seed_key))
174174
if update_weight:
175175
orig.copy_(y)
176176
for f in fns:

0 commit comments

Comments
 (0)