Skip to content

Commit

Permalink
add support for newer pip and CUDA computation versions (#151)
Browse files Browse the repository at this point in the history
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
jamesobutler and dependabot[bot] authored Dec 15, 2024
1 parent 19e77b7 commit 33397cb
Show file tree
Hide file tree
Showing 16 changed files with 73 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .github/actions/setup-dev-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: "Setup development environment"

inputs:
python-version:
default: "3.7"
default: "3.9"

runs:
using: composite
Expand Down
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
4 changes: 3 additions & 1 deletion .github/workflows/check-pytorch-package-indices.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
- .github/workflows/check-available-pytorch-dists.yml
- scripts/check_pytorch_package_indices.py

workflow_dispatch:

schedule:
- cron: "20 4 * * *"

Expand All @@ -16,7 +18,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
25 changes: 15 additions & 10 deletions .github/workflows/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: install
on:
pull_request:

workflow_dispatch:

jobs:
channel:
strategy:
Expand All @@ -12,10 +14,10 @@ jobs:
- windows-latest
- macos-latest
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
pytorch-channel:
- stable
- test
Expand All @@ -26,7 +28,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -65,29 +67,32 @@ jobs:
- windows-latest
- macos-latest
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
pytorch-computation-backend:
- cpu
- cu117
- cu118
- cu121
- cu124
exclude:
- os: macos-latest
pytorch-computation-backend: cu117
- os: macos-latest
pytorch-computation-backend: cu118
- os: macos-latest
pytorch-computation-backend: cu121
- os: macos-latest
pytorch-computation-backend: cu124
# TODO: find a way to test this
# - os: ubuntu-latest
# pytorch-computation-backend: rocm5.4.2
# pytorch-computation-backend: rocm6.2
fail-fast: false

runs-on: ${{ matrix.os }}

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -102,7 +107,7 @@ jobs:
- name: Install torch
run:
ltt install --pytorch-computation-backend=${{
matrix.pytorch-computation-backend }} torch==2.0.0
matrix.pytorch-computation-backend }} torch==2.5.1

- name: Check computation backend
shell: python
Expand Down Expand Up @@ -140,7 +145,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup development environment
uses: ./.github/actions/setup-dev-env

- name: Restore pre-commit cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/linux-nightly-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
- .github/issue-templates/linux-nightly-uninstallable.md
- .github/workflows/linux-nightly-install.yml

workflow_dispatch:

schedule:
- cron: "40 4 * * *"

Expand All @@ -14,17 +16,17 @@ jobs:
strategy:
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
max-parallel: 1

runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/publishable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ on:
- "README.rst"
- "requirements-dev.txt"

workflow_dispatch:

jobs:
pypi:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/tests-pip-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
- .github/issue-templates/pip-latest-success.md
- .github/workflows/tests-pip-latest.yml

workflow_dispatch:

schedule:
- cron: "0 4 * * *"

Expand All @@ -23,7 +25,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ on:
- "pytest.ini"
- "requirements-dev.txt"

workflow_dispatch:

schedule:
- cron: "0 4 * * *"

Expand All @@ -31,10 +33,10 @@ jobs:
- windows-latest
- macos-latest
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"

runs-on: ${{ matrix.os }}
env:
Expand All @@ -43,7 +45,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -56,7 +58,7 @@ jobs:
run: doit test

- name: Upload coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v5
with:
flags: unit
env_vars: OS,PYTHON_VERSION
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: mixed-line-ending
Expand All @@ -9,7 +9,7 @@ repos:
- id: end-of-file-fixer

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.5.1
rev: v3.1.0
hooks:
- id: prettier
types_or:
Expand All @@ -18,9 +18,9 @@ repos:
- yaml

- repo: https://github.com/omnilib/ufmt
rev: v1.3.2
rev: v2.8.0
hooks:
- id: ufmt
additional_dependencies:
- black == 22.1.0
- usort == 1.0.2
- black == 24.10.0
- usort == 1.0.8
14 changes: 13 additions & 1 deletion light_the_torch/_cb.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ def _detect_nvidia_driver_version() -> Optional[Version]:
"Linux": {
# Table 2 from
# https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html
Version("12.6"): Version("525.60.13"),
Version("12.5"): Version("525.60.13"),
Version("12.4"): Version("525.60.13"),
Version("12.3"): Version("525.60.13"),
Version("12.2"): Version("525.60.13"),
Version("12.1"): Version("525.60.13"),
Version("12.0"): Version("525.60.13"),
# Table 2 from
# https://docs.nvidia.com/cuda/archive/11.8.0/cuda-toolkit-release-notes/index.html
Expand All @@ -176,7 +182,13 @@ def _detect_nvidia_driver_version() -> Optional[Version]:
"Windows": {
# Table 2 from
# https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html
Version("12.0"): Version("527.41"),
Version("12.6"): Version("528.33"),
Version("12.5"): Version("528.33"),
Version("12.4"): Version("528.33"),
Version("12.3"): Version("528.33"),
Version("12.2"): Version("528.33"),
Version("12.1"): Version("528.33"),
Version("12.0"): Version("528.33"),
# Table 2 from
# https://docs.nvidia.com/cuda/archive/11.8.0/cuda-toolkit-release-notes/index.html
Version("11.8"): Version("452.39"),
Expand Down
8 changes: 0 additions & 8 deletions light_the_torch/_compat.py

This file was deleted.

4 changes: 2 additions & 2 deletions light_the_torch/_utils.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import contextlib
import functools
import importlib

import importlib.metadata as importlib_metadata
import inspect
import itertools

from unittest import mock

from pip._vendor.packaging.requirements import Requirement

from ._compat import importlib_metadata


class UnexpectedInternalError(Exception):
def __init__(self, msg) -> None:
Expand Down
10 changes: 4 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,16 @@ classifiers = [
"Environment :: GPU :: NVIDIA CUDA",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3.7",
"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 :: System :: Installation/Setup",
"Topic :: Utilities",
]
requires-python = ">= 3.7"
requires-python = ">= 3.9"
dependencies = [
"pip >=22.3, <23.3",
"importlib_metadata ; python_version < '3.8'",
"pip >=22.3, <24.4",
]
dynamic = ["version"]

Expand Down Expand Up @@ -66,7 +64,7 @@ local_scheme = "node-and-timestamp"
# https://github.com/psf/black#configuration-format

line-length = 88
target-version = ['py37']
target-version = ['py39']
exclude = '''
/(
\.git
Expand Down
8 changes: 5 additions & 3 deletions scripts/collect_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,11 @@ def detect_pytorch_or_dependent_packages():
name in PYTORCH_DISTRIBUTIONS
for name in itertools.chain(
[dist.name],
[Requirement(req_str).name for req_str in dist.requires]
if dist.requires
else [],
(
[Requirement(req_str).name for req_str in dist.requires]
if dist.requires
else []
),
)
)
}
Expand Down

0 comments on commit 33397cb

Please sign in to comment.