Update apply_smart_model_patches() so that layer restore matches the behavior of non-smart mode.

This commit is contained in:
Ryan Dick 2024-12-17 17:13:45 +00:00
parent 61253b91f1
commit 6f926f05b0

View File

@ -48,7 +48,8 @@ class LayerPatcher:
finally:
# Restore directly patched layers.
for param_key, weight in original_weights.get_changed_weights():
model.get_parameter(param_key).copy_(weight)
cur_param = model.get_parameter(param_key)
cur_param.data = weight.to(dtype=cur_param.dtype, device=cur_param.device, copy=True)
# Restore LoRASidecarWrapper modules.
# Note: This logic assumes no nested modules in original_modules.