Commit 2db86b46 authored by comfyanonymous's avatar comfyanonymous
Browse files

Slightly faster lora applying.

parent e1345473
...@@ -550,12 +550,12 @@ def cast_to_device(tensor, device, dtype, copy=False): ...@@ -550,12 +550,12 @@ def cast_to_device(tensor, device, dtype, copy=False):
if device_supports_cast: if device_supports_cast:
if copy: if copy:
if tensor.device == device: if tensor.device == device:
return tensor.to(dtype, copy=copy) return tensor.to(dtype, copy=copy, non_blocking=True)
return tensor.to(device, copy=copy).to(dtype) return tensor.to(device, copy=copy, non_blocking=True).to(dtype, non_blocking=True)
else: else:
return tensor.to(device).to(dtype) return tensor.to(device, non_blocking=True).to(dtype, non_blocking=True)
else: else:
return tensor.to(dtype).to(device, copy=copy) return tensor.to(device, dtype, copy=copy, non_blocking=True)
def xformers_enabled(): def xformers_enabled():
global directml_enabled global directml_enabled
......
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