Unverified Commit c9bce2b4 authored by Matthew Douglas's avatar Matthew Douglas Committed by GitHub
Browse files

Bump minimum PyTorch to 2.3 (#1754)

* Bump minimum PyTorch to 2.3

* Tests: Fix Windows numpy<2 compatibility for torch<2.4.1
parent dd1929ba
......@@ -102,7 +102,7 @@ jobs:
matrix:
os: [ubuntu-22.04, ubuntu-22.04-arm, windows-2025, macos-15]
# Test with the oldest supported torch version, the newest two stable/RC.
torch_version: ["2.2.2", "2.7.1", "2.8.0"]
torch_version: ["2.3.1", "2.7.1", "2.8.0"]
include:
- os: ubuntu-22.04
arch: x86_64
......@@ -118,7 +118,7 @@ jobs:
arch: arm64
exclude:
- os: ubuntu-22.04-arm
torch_version: "2.2.2"
torch_version: "2.3.1"
runs-on: ${{ matrix.runner || matrix.os }}
env:
......@@ -144,13 +144,14 @@ jobs:
- name: Install dependencies
run: |
pip install torch==${{ matrix.torch_version }} --index-url https://download.pytorch.org/whl/${{ (matrix.torch_version == '2.8.0' && 'test/cpu') || 'cpu' }}
pip install torch==${{ matrix.torch_version }} --index-url https://download.pytorch.org/whl/cpu
pip install -e ".[test]"
pip install pytest-cov
# We need to downgrade to numpy<2 for torch<2.3 compatibility.
# We need to downgrade to numpy<2 for torch<2.4.1 compatibility on Windows
# See: https://github.com/pytorch/pytorch/issues/131668
- name: Downgrade NumPy
if: startsWith(matrix.torch_version, '2.2.')
if: startsWith(matrix.os, 'windows') && startsWith(matrix.torch_version, '2.3.')
run: pip install "numpy<2"
- name: Show installed packages
......@@ -345,7 +346,7 @@ jobs:
cuda_version: ["11.8.0", "12.6.3", "12.8.1", "12.9.1"]
include:
- cuda_version: "11.8.0"
torch_version: "2.2.2"
torch_version: "2.3.1"
pypi_index: "https://download.pytorch.org/whl/cu118"
- cuda_version: "12.6.3"
torch_version: "2.6.0"
......@@ -374,7 +375,7 @@ jobs:
gpu: T4
runner: CUDA-Windows-x64
cuda_version: "11.8.0"
torch_version: "2.2.0"
torch_version: "2.3.1"
pypi_index: "https://download.pytorch.org/whl/cu118"
- os: windows-2025
arch: x86_64
......@@ -430,12 +431,6 @@ jobs:
pip install --pre torch~=${{ matrix.torch_version }}.dev0 --index-url ${{ matrix.pypi_index }}
pip install -e ".[test]"
pip install pytest-cov
# We need to downgrade to numpy<2 for torch<2.3 compatibility.
- name: Downgrade NumPy
if: startsWith(matrix.torch_version, '2.2.')
run: pip install "numpy<2"
- name: Show installed packages
run: pip list
......
......@@ -20,7 +20,7 @@ The library includes quantization primitives for 8-bit & 4-bit operations, throu
bitsandbytes has the following minimum requirements for all platforms:
* Python 3.9+
* [PyTorch](https://pytorch.org/get-started/locally/) 2.2+
* [PyTorch](https://pytorch.org/get-started/locally/) 2.3+
* _Note: While we aim to provide wide backwards compatibility, we recommend using the latest version of PyTorch for the best experience._
#### Accelerator support:
......
......@@ -84,11 +84,7 @@ def get_inverse_transform_indices(
return permuted_tile_indices
# torch.compiler.is_compiling() is available only in torch >= 2.3
if hasattr(torch.compiler, "is_compiling"):
_is_compiling = torch.compiler.is_compiling
else:
_is_compiling = torch._dynamo.is_compiling
_is_compiling = torch.compiler.is_compiling
@deprecated(
......
......@@ -4,11 +4,8 @@ import functools
@functools.lru_cache(None)
def is_triton_available():
try:
# torch>=2.2.0
from torch.utils._triton import has_triton, has_triton_package
return has_triton_package() and has_triton()
except ImportError:
from torch._inductor.utils import has_triton
return has_triton()
except Exception:
return False
......@@ -42,7 +42,7 @@ classifiers = [
"Topic :: Scientific/Engineering :: Artificial Intelligence"
]
dependencies = [
"torch>=2.2,<3",
"torch>=2.3,<3",
"numpy>=1.17",
"packaging>=20.9"
]
......
......@@ -1413,9 +1413,6 @@ class TestQuantize4BitFunctional:
reason="this test is not supported on ROCm with gfx90a architecture yet",
)
def test_gemv_eye_4bit(self, device, storage_type, dtype):
if device == "cpu" and dtype == torch.bfloat16 and torch.__version__ < (2, 3):
pytest.skip("eye doe not support bfloat16 on CPU in torch < 2.3")
if device == "hpu" and not is_supported_on_hpu(storage_type, dtype):
pytest.skip("This configuration is not supported on HPU.")
......
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