From 9b2b1303b718683b9709e8f2ae0a1e8c45f01962 Mon Sep 17 00:00:00 2001 From: Jedrzej Kosinski Date: Mon, 18 Nov 2024 20:42:51 -0600 Subject: [PATCH] Removed a .to call on results of calculate_weight in patch_hook_weight_to_device that was screwing up the intermediate results for fp8 prior to being passed into stochastic_rounding call --- comfy/model_patcher.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/comfy/model_patcher.py b/comfy/model_patcher.py index 1723e281c..afe36eff6 100644 --- a/comfy/model_patcher.py +++ b/comfy/model_patcher.py @@ -1036,8 +1036,8 @@ class ModelPatcher: self.hook_backup[key] = (weight.to(device=target_device, copy=True), weight.device) # TODO: properly handle lowvram situations for cached hook patches out_weight = comfy.lora.calculate_weight(combined_patches[key], - comfy.model_management.cast_to_device(weight, weight.device, torch.float32, copy=True), - key, original_weights=original_weights).to(weight.dtype) + comfy.model_management.cast_to_device(weight, weight.device, torch.float32, copy=True), + key, original_weights=original_weights) del original_weights[key] out_weight = comfy.float.stochastic_rounding(out_weight, weight.dtype, seed=string_to_seed(key)) if self.hook_mode == comfy.hooks.EnumHookMode.MaxSpeed: