Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions bitsandbytes/nn/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,9 +660,9 @@ def cpu(self):
self.SCB = SCB
return self

def xpu(self):
def xpu(self, device):
# we store the 8-bit rows-major weight
B = self.data.contiguous().to(torch.float16).xpu()
B = self.data.contiguous().to(torch.float16).xpu(device)
CB, CBt, SCB, SCBt, coo_tensorB = bnb.functional.double_quant(B)
if CBt is not None:
del CBt
Expand Down Expand Up @@ -700,11 +700,11 @@ def to(self, *args, **kwargs):
return self.cpu()
elif device.type == "xpu":
if self.data.dtype == torch.int8:
self.data = self.data.contiguous().xpu()
self.data = self.data.contiguous().xpu(device)
self.CB = self.data
return self
else:
return self.xpu()
return self.xpu(device)
else:
new_param = Int8Params(
super().to(device=device, dtype=dtype, non_blocking=non_blocking),
Expand Down