From 4454fc0f94b938a348f0ae4bff8d09c4fc4d7cdc Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Thu, 22 Feb 2024 20:58:24 -0500 Subject: [PATCH 01/19] Migrate from setup.py to pyproject.toml for PEP 660 editable install --- docs/source/contributing.mdx | 4 ++ docs/source/installation.mdx | 3 +- pyproject.toml | 73 +++++++++++++++++++++++++++++++++++- requirements-ci.txt | 7 ---- requirements-dev.txt | 9 ----- setup.py | 34 +---------------- 6 files changed, 78 insertions(+), 52 deletions(-) delete mode 100644 requirements-ci.txt delete mode 100644 requirements-dev.txt diff --git a/docs/source/contributing.mdx b/docs/source/contributing.mdx index 4fe6b7541..103c38209 100644 --- a/docs/source/contributing.mdx +++ b/docs/source/contributing.mdx @@ -3,6 +3,10 @@ ## Setup +### Editable install +- Create an editable installation for development with `pip install -e ".[dev]"` +- Optional extras: `benchmark`, `docs` + ### Setup pre-commit hooks - Install pre-commit hooks with `pip install pre-commit`. - Run `pre-commit autoupdate` once to configure the hooks. diff --git a/docs/source/installation.mdx b/docs/source/installation.mdx index f055e44f0..c38006481 100644 --- a/docs/source/installation.mdx +++ b/docs/source/installation.mdx @@ -51,10 +51,9 @@ You'll need to build bitsandbytes from source. To compile from source, you need ```bash git clone https://github.com/TimDettmers/bitsandbytes.git && cd bitsandbytes/ -pip install -r requirements-dev.txt cmake -DCOMPUTE_BACKEND=cuda -S . cmake --build . --config Release -python -m build --wheel +pip install . ``` Big thanks to [wkpark](https://github.com/wkpark), [Jamezo97](https://github.com/Jamezo97), [rickardp](https://github.com/rickardp), [akx](https://github.com/akx) for their amazing contributions to make bitsandbytes compatible with Windows. diff --git a/pyproject.toml b/pyproject.toml index f74750720..78b22a6f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,78 @@ [build-system] -requires = [ "setuptools", "wheel" ] +requires = ["setuptools >= 63.0.0"] build-backend = "setuptools.build_meta" +[project] +name = "bitsandbytes" +dynamic = ["version"] +description = "k-bit optimizers and matrix multiplication routines." +authors = [{name="Tim Dettmers", email="dettmers@cs.washington.edu"}] +requires-python = ">=3.8" +readme = "README.md" +license = {file="LICENSE"} +keywords = [ + "gpu", + "optimizers", + "optimization", + "8-bit", + "quantization", + "compression" +] +classifiers = [ + "Development Status :: 4 - Beta", + "License :: OSI Approved :: MIT License", + "Environment :: GPU :: NVIDIA CUDA :: 11", + "Environment :: GPU :: NVIDIA CUDA :: 12", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "Operating System :: POSIX :: Linux", + "Operating System :: MacOS", + "Operating System :: Microsoft :: Windows", + "Programming Language :: C++", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering :: Artificial Intelligence" +] +dependencies = [ + "torch", + "numpy" +] + +[project.optional-dependencies] +benchmark = ["pandas", "matplotlib"] +docs = ["hf-doc-builder"] +dev = [ + "bitsandbytes[test]", + "build", + "ruff", + "pre-commit", + "wheel" +] +test = [ + "einops~=0.6.0", + "lion-pytorch==0.0.6", + "pytest<8", + "pytest-cases", + "pytest-sugar", + "scipy", + "transformers" +] +triton = ["triton; sys_platform=='linux' and platform_machine=='x86_64'"] + +[project.urls] +homepage = "https://github.com/TimDettmers/bitsandbytes" +changelog = "https://github.com/TimDettmers/bitsandbytes/blob/main/CHANGELOG.md" +docs = "https://huggingface.co/docs/bitsandbytes/main" +issues = "https://github.com/TimDettmers/bitsandbytes/issues" + +[tool.setuptools] +packages = ["bitsandbytes"] +package-data = { "*" = ["libbitsandbytes*.*"] } + [tool.ruff] src = [ "bitsandbytes", diff --git a/requirements-ci.txt b/requirements-ci.txt deleted file mode 100644 index 46bd5b9cd..000000000 --- a/requirements-ci.txt +++ /dev/null @@ -1,7 +0,0 @@ -# Requirements used for GitHub actions -pytest==7.2.2 -einops==0.6.0 -wheel==0.40.0 -lion-pytorch==0.0.6 -scipy==1.11.4 -pandas==2.2.0 diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index 7ede5b061..000000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Requirements used for local development -setuptools>=63 -pytest~=7.2.2 -einops~=0.6.0 -wheel~=0.40.0 -lion-pytorch~=0.0.6 -scipy~=1.11.4 -pandas~=2.2.0 -matplotlib~=3.8.2 diff --git a/setup.py b/setup.py index 13af2a39b..994a078ef 100644 --- a/setup.py +++ b/setup.py @@ -2,48 +2,16 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -import glob -import os - -from setuptools import find_packages, setup +from setuptools import setup from setuptools.dist import Distribution -libs = list(glob.glob("./bitsandbytes/libbitsandbytes*.*")) -libs = [os.path.basename(p) for p in libs] -print("libs:", libs) - - -def read(fname): - return open(os.path.join(os.path.dirname(__file__), fname)).read() - # Tested with wheel v0.29.0 class BinaryDistribution(Distribution): def has_ext_modules(self): return True - setup( - name="bitsandbytes", version="0.43.0.dev0", - author="Tim Dettmers", - author_email="dettmers@cs.washington.edu", - description="k-bit optimizers and matrix multiplication routines.", - license="MIT", - keywords="gpu optimizers optimization 8-bit quantization compression", - url="https://github.com/TimDettmers/bitsandbytes", - packages=find_packages(), - package_data={"": libs}, - install_requires=["torch", "numpy"], - extras_require={ - "benchmark": ["pandas", "matplotlib"], - "test": ["scipy"], - }, - long_description=read("README.md"), - long_description_content_type="text/markdown", - classifiers=[ - "Development Status :: 4 - Beta", - "Topic :: Scientific/Engineering :: Artificial Intelligence", - ], distclass=BinaryDistribution, ) From 7bdc6e5cf00480c9fc8349fae35a51b68f80d899 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Thu, 22 Feb 2024 21:19:39 -0500 Subject: [PATCH 02/19] Update workflow to use pyproject.toml for build requirements --- .github/workflows/python-package.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index e48c25cc5..2baad85ce 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -177,9 +177,9 @@ jobs: - name: Install build package shell: bash run: pip install build - - name: Install Python test dependencies - shell: bash - run: pip install -r requirements-ci.txt + #- name: Install Python test dependencies + # shell: bash + # run: pip install -r requirements-ci.txt # TODO: How to run CUDA tests on GitHub actions? #- name: Run unit tests # if: ${{ matrix.arch == 'x86_64' }} # Tests are too slow to run in emulation. Wait for real aarch64 agents From 11142a37837e84cd99d5e2bbb87d0ba335040a76 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Fri, 23 Feb 2024 13:32:13 -0500 Subject: [PATCH 03/19] Fix setup for doc build --- pyproject.toml | 6 ++++-- setup.py | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 78b22a6f4..0eaad9891 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,7 @@ dependencies = [ [project.optional-dependencies] benchmark = ["pandas", "matplotlib"] -docs = ["hf-doc-builder"] +docs = ["hf-doc-builder", "black"] dev = [ "bitsandbytes[test]", "build", @@ -70,9 +70,11 @@ docs = "https://huggingface.co/docs/bitsandbytes/main" issues = "https://github.com/TimDettmers/bitsandbytes/issues" [tool.setuptools] -packages = ["bitsandbytes"] package-data = { "*" = ["libbitsandbytes*.*"] } +[tool.setuptools.dynamic] +version = {attr = "bitsandbytes.__version__"} + [tool.ruff] src = [ "bitsandbytes", diff --git a/setup.py b/setup.py index 994a078ef..164ea9c19 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -from setuptools import setup +from setuptools import find_packages, setup from setuptools.dist import Distribution @@ -13,5 +13,6 @@ def has_ext_modules(self): setup( version="0.43.0.dev0", - distclass=BinaryDistribution, + packages=find_packages(), + distclass=BinaryDistribution ) From 636c62d61d4665d0aa82cf81e45265a8695214d2 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Mon, 26 Feb 2024 10:16:00 -0500 Subject: [PATCH 04/19] cleanup workflow --- .github/workflows/python-package.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 2baad85ce..fc45cf45d 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -177,9 +177,6 @@ jobs: - name: Install build package shell: bash run: pip install build - #- name: Install Python test dependencies - # shell: bash - # run: pip install -r requirements-ci.txt # TODO: How to run CUDA tests on GitHub actions? #- name: Run unit tests # if: ${{ matrix.arch == 'x86_64' }} # Tests are too slow to run in emulation. Wait for real aarch64 agents From 699f5057feea33bad78ef1fc9bbbf3da1459f31a Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Wed, 28 Feb 2024 11:06:01 -0500 Subject: [PATCH 05/19] Add dependency constraints --- pyproject.toml | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0eaad9891..58c08059e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,30 +38,32 @@ classifiers = [ "Topic :: Scientific/Engineering :: Artificial Intelligence" ] dependencies = [ - "torch", - "numpy" + "torch>=1.11,!=1.12.0", + "numpy>=1.17" ] [project.optional-dependencies] benchmark = ["pandas", "matplotlib"] -docs = ["hf-doc-builder", "black"] +docs = [ + "hf-doc-builder @ git+https://github.com/huggingface/doc-builder.git@main" +] dev = [ "bitsandbytes[test]", - "build", - "ruff", - "pre-commit", - "wheel" + "build>=1.0.0,<2", + "ruff~=0.2.0", + "pre-commit>=3.5.0,<4", + "wheel>=0.42,<1" ] test = [ "einops~=0.6.0", "lion-pytorch==0.0.6", - "pytest<8", - "pytest-cases", - "pytest-sugar", - "scipy", - "transformers" + "pytest==7.4.4", + "pytest-cases>=3.7.0,<4", + "pytest-sugar>=1.0.0,<1.1.0", + "scipy>=1.10,<2", + "transformers>=4.30.1,<5" ] -triton = ["triton; sys_platform=='linux' and platform_machine=='x86_64'"] +triton = ["triton~=2.0.0; sys_platform=='linux' and platform_machine=='x86_64'"] [project.urls] homepage = "https://github.com/TimDettmers/bitsandbytes" From 00497ab4d6e744c26825f6238e394d49548d2be1 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Mon, 4 Mar 2024 10:46:42 -0500 Subject: [PATCH 06/19] Update pyproject.toml Co-authored-by: Aarni Koskela --- pyproject.toml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 58c08059e..6833d578c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,9 +57,7 @@ dev = [ test = [ "einops~=0.6.0", "lion-pytorch==0.0.6", - "pytest==7.4.4", - "pytest-cases>=3.7.0,<4", - "pytest-sugar>=1.0.0,<1.1.0", + "pytest~=7.4", "scipy>=1.10,<2", "transformers>=4.30.1,<5" ] From d23be94a5a20eed244a1ee12c199df967a3e42bf Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Mon, 4 Mar 2024 10:50:03 -0500 Subject: [PATCH 07/19] Update pyproject.toml Co-authored-by: Aarni Koskela --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6833d578c..955d9f8c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ description = "k-bit optimizers and matrix multiplication routines." authors = [{name="Tim Dettmers", email="dettmers@cs.washington.edu"}] requires-python = ">=3.8" readme = "README.md" -license = {file="LICENSE"} +license = "MIT" keywords = [ "gpu", "optimizers", From 48ede4abe0cad2373476006b603f7c3bfaf09c1b Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Mon, 4 Mar 2024 15:05:04 -0500 Subject: [PATCH 08/19] Revert "Update pyproject.toml" This reverts commit d23be94a5a20eed244a1ee12c199df967a3e42bf. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 955d9f8c9..6833d578c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ description = "k-bit optimizers and matrix multiplication routines." authors = [{name="Tim Dettmers", email="dettmers@cs.washington.edu"}] requires-python = ">=3.8" readme = "README.md" -license = "MIT" +license = {file="LICENSE"} keywords = [ "gpu", "optimizers", From 9a6794bd55d4b88fcc8eded47755a1e2ff6c2c65 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Mon, 18 Mar 2024 14:29:44 -0400 Subject: [PATCH 09/19] Update dependencies in pyproject.toml --- pyproject.toml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b3346fb2a..9eae7c00b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,13 +44,11 @@ dependencies = [ [project.optional-dependencies] benchmark = ["pandas", "matplotlib"] -docs = [ - "hf-doc-builder @ git+https://github.com/huggingface/doc-builder.git@main" -] +docs = ["hf-doc-builder==0.5.0"] dev = [ "bitsandbytes[test]", "build>=1.0.0,<2", - "ruff~=0.2.0", + "ruff==0.3.2", "pre-commit>=3.5.0,<4", "wheel>=0.42,<1" ] @@ -58,7 +56,8 @@ test = [ "einops~=0.6.0", "lion-pytorch==0.0.6", "pytest~=7.4", - "scipy>=1.10,<2", + "scipy>=1.10.1,<2; python_version < '3.9'", + "scipy>=1.11.4,<2; python_version >= '3.9'", "transformers>=4.30.1,<5" ] triton = ["triton~=2.0.0; sys_platform=='linux' and platform_machine=='x86_64'"] From 399a49471ffc2b68f03e22cb5359365f49dd16f3 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Mon, 8 Apr 2024 19:36:34 -0400 Subject: [PATCH 10/19] Rebase on main --- docs/source/contributing.mdx | 4 ++ docs/source/installation.mdx | 3 +- pyproject.toml | 73 +++++++++++++++++++++++++++++++++++- setup.py | 35 +---------------- 4 files changed, 79 insertions(+), 36 deletions(-) diff --git a/docs/source/contributing.mdx b/docs/source/contributing.mdx index 4fe6b7541..103c38209 100644 --- a/docs/source/contributing.mdx +++ b/docs/source/contributing.mdx @@ -3,6 +3,10 @@ ## Setup +### Editable install +- Create an editable installation for development with `pip install -e ".[dev]"` +- Optional extras: `benchmark`, `docs` + ### Setup pre-commit hooks - Install pre-commit hooks with `pip install pre-commit`. - Run `pre-commit autoupdate` once to configure the hooks. diff --git a/docs/source/installation.mdx b/docs/source/installation.mdx index d0dd7ba76..958a02d26 100644 --- a/docs/source/installation.mdx +++ b/docs/source/installation.mdx @@ -53,10 +53,9 @@ You'll need to build bitsandbytes from source. To compile from source, you need ```bash git clone https://github.com/TimDettmers/bitsandbytes.git && cd bitsandbytes/ -pip install -r requirements-dev.txt cmake -DCOMPUTE_BACKEND=cuda -S . cmake --build . --config Release -python -m build --wheel +pip install . ``` Big thanks to [wkpark](https://github.com/wkpark), [Jamezo97](https://github.com/Jamezo97), [rickardp](https://github.com/rickardp), [akx](https://github.com/akx) for their amazing contributions to make bitsandbytes compatible with Windows. diff --git a/pyproject.toml b/pyproject.toml index 609ff84fa..bddbbfccd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,78 @@ [build-system] -requires = [ "setuptools", "wheel" ] +requires = ["setuptools >= 63.0.0"] build-backend = "setuptools.build_meta" +[project] +name = "bitsandbytes" +dynamic = ["version"] +description = "k-bit optimizers and matrix multiplication routines." +authors = [{name="Tim Dettmers", email="dettmers@cs.washington.edu"}] +requires-python = ">=3.8" +readme = "README.md" +license = {file="LICENSE"} +keywords = [ + "gpu", + "optimizers", + "optimization", + "8-bit", + "quantization", + "compression" +] +classifiers = [ + "Development Status :: 4 - Beta", + "License :: OSI Approved :: MIT License", + "Environment :: GPU :: NVIDIA CUDA :: 11", + "Environment :: GPU :: NVIDIA CUDA :: 12", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "Operating System :: POSIX :: Linux", + "Operating System :: MacOS", + "Operating System :: Microsoft :: Windows", + "Programming Language :: C++", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering :: Artificial Intelligence" +] +dependencies = [ + "torch", + "numpy" +] + +[project.optional-dependencies] +benchmark = ["pandas", "matplotlib"] +docs = ["hf-doc-builder"] +dev = [ + "bitsandbytes[test]", + "build", + "ruff", + "pre-commit", + "wheel" +] +test = [ + "einops~=0.6.0", + "lion-pytorch==0.0.6", + "pytest<8", + "pytest-cases", + "pytest-sugar", + "scipy", + "transformers" +] +triton = ["triton; sys_platform=='linux' and platform_machine=='x86_64'"] + +[project.urls] +homepage = "https://github.com/TimDettmers/bitsandbytes" +changelog = "https://github.com/TimDettmers/bitsandbytes/blob/main/CHANGELOG.md" +docs = "https://huggingface.co/docs/bitsandbytes/main" +issues = "https://github.com/TimDettmers/bitsandbytes/issues" + +[tool.setuptools] +packages = ["bitsandbytes"] +package-data = { "*" = ["libbitsandbytes*.*"] } + [tool.ruff] src = [ "bitsandbytes", diff --git a/setup.py b/setup.py index a51b3867c..3b38a795d 100644 --- a/setup.py +++ b/setup.py @@ -2,20 +2,9 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -import glob -import os - -from setuptools import find_packages, setup +from setuptools import setup from setuptools.dist import Distribution -libs = list(glob.glob("./bitsandbytes/libbitsandbytes*.*")) -libs = [os.path.basename(p) for p in libs] -print("libs:", libs) - - -def read(fname): - return open(os.path.join(os.path.dirname(__file__), fname)).read() - # Tested with wheel v0.29.0 class BinaryDistribution(Distribution): @@ -24,26 +13,6 @@ def has_ext_modules(self): setup( - name="bitsandbytes", - version="0.44.0.dev", - author="Tim Dettmers", - author_email="dettmers@cs.washington.edu", - description="k-bit optimizers and matrix multiplication routines.", - license="MIT", - keywords="gpu optimizers optimization 8-bit quantization compression", - url="https://github.com/TimDettmers/bitsandbytes", - packages=find_packages(), - package_data={"": libs}, - install_requires=["torch", "numpy"], - extras_require={ - "benchmark": ["pandas", "matplotlib"], - "test": ["scipy"], - }, - long_description=read("README.md"), - long_description_content_type="text/markdown", - classifiers=[ - "Development Status :: 4 - Beta", - "Topic :: Scientific/Engineering :: Artificial Intelligence", - ], + version="0.44.0.dev0", distclass=BinaryDistribution, ) From 0101f2fd0cd6d2b04aa1b59fb0d9bb080e92afd7 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Mon, 8 Apr 2024 19:48:36 -0400 Subject: [PATCH 11/19] Resolve conflict --- .github/workflows/python-package.yml | 69 +++++++++++++++------------- 1 file changed, 38 insertions(+), 31 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index ba5961f72..ef7bdfb40 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -120,37 +120,44 @@ jobs: arch: aarch64 runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 - - name: Download build artifact - uses: actions/download-artifact@v4 - with: - merge-multiple: true - pattern: "shared_library*_${{ matrix.os }}_${{ matrix.arch }}*" - path: output/ - - name: Copy correct platform shared library - shell: bash - run: | - ls -lR output/ - cp output/${{ matrix.os }}/${{ matrix.arch }}/* bitsandbytes/ - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - cache: pip - - run: pip install build wheel - - run: python -m build . - - name: Determine and Set Platform Tag, then Tag Wheel - shell: bash - run: | - PLATFORM_TAG=$(python .github/scripts/set_platform_tag.py "${{ matrix.arch }}") - echo "PLATFORM_TAG=$PLATFORM_TAG" - wheel tags --remove --abi-tag=none --python-tag=py3 --platform-tag=$PLATFORM_TAG dist/bitsandbytes-*.whl - - name: Upload build artifact - uses: actions/upload-artifact@v4 - with: - name: bdist_wheel_${{ matrix.os }}_${{ matrix.arch }} - path: dist/bitsandbytes-*.whl - retention-days: 7 + # Check out code + - uses: actions/checkout@v4 + # Download shared libraries + - name: Download build artifact + uses: actions/download-artifact@v4 + with: + merge-multiple: true + pattern: "shared_library*_${{ matrix.os }}_${{ matrix.arch }}*" + path: output/ + - name: Copy correct platform shared library + shell: bash + run: | + ls -lR output/ + cp output/${{ matrix.os }}/${{ matrix.arch }}/* bitsandbytes/ + # Set up the Python version needed + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: pip + - name: Install build package + shell: bash + run: pip install build wheel + - name: Build wheel + shell: bash + run: python -m build . + - name: Determine and Set Platform Tag, then Tag Wheel + shell: bash + run: | + PLATFORM_TAG=$(python .github/scripts/set_platform_tag.py "${{ matrix.arch }}") + echo "PLATFORM_TAG=$PLATFORM_TAG" + wheel tags --remove --abi-tag=none --python-tag=py3 --platform-tag=$PLATFORM_TAG dist/bitsandbytes-*.whl + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: bdist_wheel_${{ matrix.os }}_${{ matrix.arch }}_${{ matrix.python-version }} + path: dist/bitsandbytes-*.whl + retention-days: 7 audit-wheels: needs: build-wheels From 72342b55f033f83adb4d5a840450212efac7eb15 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Mon, 8 Apr 2024 19:49:29 -0400 Subject: [PATCH 12/19] Resolve conflict --- pyproject.toml | 6 ++++-- setup.py | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bddbbfccd..4d4cbeee8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,7 @@ dependencies = [ [project.optional-dependencies] benchmark = ["pandas", "matplotlib"] -docs = ["hf-doc-builder"] +docs = ["hf-doc-builder", "black"] dev = [ "bitsandbytes[test]", "build", @@ -70,9 +70,11 @@ docs = "https://huggingface.co/docs/bitsandbytes/main" issues = "https://github.com/TimDettmers/bitsandbytes/issues" [tool.setuptools] -packages = ["bitsandbytes"] package-data = { "*" = ["libbitsandbytes*.*"] } +[tool.setuptools.dynamic] +version = {attr = "bitsandbytes.__version__"} + [tool.ruff] src = [ "bitsandbytes", diff --git a/setup.py b/setup.py index 3b38a795d..1534abb75 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -from setuptools import setup +from setuptools import find_packages, setup from setuptools.dist import Distribution @@ -14,5 +14,6 @@ def has_ext_modules(self): setup( version="0.44.0.dev0", + packages=find_packages(), distclass=BinaryDistribution, ) From 11165f8bc1f4c6428fe278c0f50b1ebac7491ef6 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Wed, 28 Feb 2024 11:06:01 -0500 Subject: [PATCH 13/19] Add dependency constraints --- pyproject.toml | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4d4cbeee8..ad5a1c69e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,30 +38,32 @@ classifiers = [ "Topic :: Scientific/Engineering :: Artificial Intelligence" ] dependencies = [ - "torch", - "numpy" + "torch>=1.11,!=1.12.0", + "numpy>=1.17" ] [project.optional-dependencies] benchmark = ["pandas", "matplotlib"] -docs = ["hf-doc-builder", "black"] +docs = [ + "hf-doc-builder @ git+https://github.com/huggingface/doc-builder.git@main" +] dev = [ "bitsandbytes[test]", - "build", - "ruff", - "pre-commit", - "wheel" + "build>=1.0.0,<2", + "ruff~=0.2.0", + "pre-commit>=3.5.0,<4", + "wheel>=0.42,<1" ] test = [ "einops~=0.6.0", "lion-pytorch==0.0.6", - "pytest<8", - "pytest-cases", - "pytest-sugar", - "scipy", - "transformers" + "pytest==7.4.4", + "pytest-cases>=3.7.0,<4", + "pytest-sugar>=1.0.0,<1.1.0", + "scipy>=1.10,<2", + "transformers>=4.30.1,<5" ] -triton = ["triton; sys_platform=='linux' and platform_machine=='x86_64'"] +triton = ["triton~=2.0.0; sys_platform=='linux' and platform_machine=='x86_64'"] [project.urls] homepage = "https://github.com/TimDettmers/bitsandbytes" From 646a86a04c6708ac6b7d6616b51b85fece44c323 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Mon, 4 Mar 2024 10:46:42 -0500 Subject: [PATCH 14/19] Update pyproject.toml Co-authored-by: Aarni Koskela --- pyproject.toml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ad5a1c69e..b3346fb2a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,9 +57,7 @@ dev = [ test = [ "einops~=0.6.0", "lion-pytorch==0.0.6", - "pytest==7.4.4", - "pytest-cases>=3.7.0,<4", - "pytest-sugar>=1.0.0,<1.1.0", + "pytest~=7.4", "scipy>=1.10,<2", "transformers>=4.30.1,<5" ] From 5d6ce68940e61de99c6c8e0719ad866dbdc8284c Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Mon, 4 Mar 2024 10:50:03 -0500 Subject: [PATCH 15/19] Update pyproject.toml Co-authored-by: Aarni Koskela --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b3346fb2a..d72617912 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ description = "k-bit optimizers and matrix multiplication routines." authors = [{name="Tim Dettmers", email="dettmers@cs.washington.edu"}] requires-python = ">=3.8" readme = "README.md" -license = {file="LICENSE"} +license = "MIT" keywords = [ "gpu", "optimizers", From c5fcfb89df875885175d8827e462125973a33034 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Mon, 4 Mar 2024 15:05:04 -0500 Subject: [PATCH 16/19] Revert "Update pyproject.toml" This reverts commit d23be94a5a20eed244a1ee12c199df967a3e42bf. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d72617912..b3346fb2a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ description = "k-bit optimizers and matrix multiplication routines." authors = [{name="Tim Dettmers", email="dettmers@cs.washington.edu"}] requires-python = ">=3.8" readme = "README.md" -license = "MIT" +license = {file="LICENSE"} keywords = [ "gpu", "optimizers", From 19dcbd721ef05c386580b5bc20587e8892824097 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Mon, 18 Mar 2024 14:29:44 -0400 Subject: [PATCH 17/19] Update dependencies in pyproject.toml --- pyproject.toml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b3346fb2a..9eae7c00b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,13 +44,11 @@ dependencies = [ [project.optional-dependencies] benchmark = ["pandas", "matplotlib"] -docs = [ - "hf-doc-builder @ git+https://github.com/huggingface/doc-builder.git@main" -] +docs = ["hf-doc-builder==0.5.0"] dev = [ "bitsandbytes[test]", "build>=1.0.0,<2", - "ruff~=0.2.0", + "ruff==0.3.2", "pre-commit>=3.5.0,<4", "wheel>=0.42,<1" ] @@ -58,7 +56,8 @@ test = [ "einops~=0.6.0", "lion-pytorch==0.0.6", "pytest~=7.4", - "scipy>=1.10,<2", + "scipy>=1.10.1,<2; python_version < '3.9'", + "scipy>=1.11.4,<2; python_version >= '3.9'", "transformers>=4.30.1,<5" ] triton = ["triton~=2.0.0; sys_platform=='linux' and platform_machine=='x86_64'"] From a04cd4da763193ddcaef5dba171e3c7cf18a7679 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Wed, 10 Apr 2024 10:55:53 -0400 Subject: [PATCH 18/19] Make wheel artifact name agnostic to python version --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 271835156..b2227a8d8 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -157,7 +157,7 @@ jobs: - name: Upload build artifact uses: actions/upload-artifact@v4 with: - name: bdist_wheel_${{ matrix.os }}_${{ matrix.arch }}_${{ matrix.python-version }} + name: bdist_wheel_${{ matrix.os }}_${{ matrix.arch }} path: dist/bitsandbytes-*.whl retention-days: 7 From da2dc6945aa882dfe718c94b61ac331001b88ac4 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Wed, 10 Apr 2024 10:56:08 -0400 Subject: [PATCH 19/19] Remove requirements-*.txt --- requirements-ci.txt | 6 ------ requirements-dev.txt | 9 --------- 2 files changed, 15 deletions(-) delete mode 100644 requirements-ci.txt delete mode 100644 requirements-dev.txt diff --git a/requirements-ci.txt b/requirements-ci.txt deleted file mode 100644 index 906c6643e..000000000 --- a/requirements-ci.txt +++ /dev/null @@ -1,6 +0,0 @@ -# Requirements used for GitHub actions -pytest==8.1.1 -einops==0.7.0 -lion-pytorch==0.1.4 -scipy==1.10.1; python_version < "3.9" -scipy==1.13.0; python_version >= "3.9" diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index 4ee8bf543..000000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Requirements used for local development -setuptools>=63 -pytest~=8.1.1 -einops~=0.7.0 -wheel~=0.43.0 -lion-pytorch~=0.1.4 -scipy~=1.13.0 -pandas~=2.2.1 -matplotlib~=3.8.4