mirror of
https://github.com/lllyasviel/stable-diffusion-webui-forge.git
synced 2026-04-21 23:09:19 +00:00
fix possible oom
This commit is contained in:
@@ -273,15 +273,15 @@ class ModelPatcher:
|
|||||||
else:
|
else:
|
||||||
weight = weight.data
|
weight = weight.data
|
||||||
|
|
||||||
|
weight_original_dtype = weight.dtype
|
||||||
to_args = dict(dtype=torch.float32)
|
to_args = dict(dtype=torch.float32)
|
||||||
|
|
||||||
if device_to is not None:
|
if device_to is not None:
|
||||||
to_args['device'] = device_to
|
to_args['device'] = device_to
|
||||||
to_args['non_blocking'] = memory_management.device_supports_non_blocking(device_to)
|
to_args['non_blocking'] = memory_management.device_supports_non_blocking(device_to)
|
||||||
|
|
||||||
temp_weight = weight.to(**to_args)
|
weight = weight.to(**to_args)
|
||||||
|
out_weight = merge_lora_to_model_weight(current_patches, weight, key).to(dtype=weight_original_dtype)
|
||||||
out_weight = merge_lora_to_model_weight(current_patches, temp_weight, key).to(weight.dtype)
|
|
||||||
|
|
||||||
if bnb_layer is not None:
|
if bnb_layer is not None:
|
||||||
bnb_layer.reload_weight(out_weight)
|
bnb_layer.reload_weight(out_weight)
|
||||||
|
|||||||
Reference in New Issue
Block a user