Skip to content

Commit

Permalink
Remove torch.compile for double_quant
Browse files Browse the repository at this point in the history
  • Loading branch information
Xia-Weiwen committed Apr 18, 2024
1 parent 67d8661 commit 92900f6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion bitsandbytes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from .optim import adam

register_backend("cuda", CUDABackend())

__pdoc__ = {
"libbitsandbytes": False,
"optim.optimizer.Optimizer8bit": False,
Expand Down
2 changes: 1 addition & 1 deletion bitsandbytes/backends/cpu_xpu_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def _maybe_torch_compile(func):
return func


@_maybe_torch_compile
# Don't use torch.compile for now due to PyTorch issue https://github.com/pytorch/pytorch/issues/124382
def double_quant_impl(
A, col_stats=None, row_stats=None, out_col=None, out_row=None, threshold=0.0
):
Expand Down
5 changes: 2 additions & 3 deletions bitsandbytes/nn/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,11 +611,10 @@ def to(self: T, tensor: Tensor, non_blocking: bool = ...) -> T: ...
def to(self, *args, **kwargs):
device, dtype, non_blocking, convert_to_format = torch._C._nn._parse_to(*args, **kwargs)

if device is not None and device.type == "cuda" and self.data.device.type == "cpu":
if device.type == "cuda" and self.data.device.type == "cpu":
return self.cuda(device)
elif (
device is not None
and device.type == "cpu"
device.type == "cpu"
and self.data.dtype != torch.int8
):
return self.cpu()
Expand Down

0 comments on commit 92900f6

Please sign in to comment.