From 4089af7c032fe06d98fbc5b3801ccd5fc7d5396b Mon Sep 17 00:00:00 2001 From: Disty0 Date: Sun, 1 Dec 2024 03:52:57 +0300 Subject: [PATCH] Fix NaNs on Intel with Lora + Offloading --- modules/lora/networks.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/lora/networks.py b/modules/lora/networks.py index 69db5fce3..4312f3405 100644 --- a/modules/lora/networks.py +++ b/modules/lora/networks.py @@ -412,6 +412,9 @@ def network_apply_weights(self: Union[torch.nn.Conv2d, torch.nn.Linear, torch.nn batch_updown = batch_updown.to(devices.cpu, non_blocking=True) if batch_ex_bias is not None: batch_ex_bias = batch_ex_bias.to(devices.cpu, non_blocking=True) + if devices.backend == "ipex": + # using non_blocking=True here causes NaNs on Intel + torch.xpu.synchronize(devices.device) t1 = time.time() timer['move'] += t1 - t0 except RuntimeError as e: