diff --git a/.github/assistant.py b/.github/assistant.py index abe3d1136c4..168c090928c 100644 --- a/.github/assistant.py +++ b/.github/assistant.py @@ -32,6 +32,7 @@ "3.8": "1.4", "3.9": "1.7.1", "3.10": "1.11", + "3.11": "1.13", } _path = lambda *ds: os.path.join(_PATH_ROOT, *ds) REQUIREMENTS_FILES = tuple(glob.glob(_path("requirements", "*.txt")) + [_path("requirements.txt")]) diff --git a/.github/workflows/ci-tests-full.yml b/.github/workflows/ci-tests-full.yml index 64fb1be814c..bdd393c8919 100644 --- a/.github/workflows/ci-tests-full.yml +++ b/.github/workflows/ci-tests-full.yml @@ -37,12 +37,15 @@ jobs: - {os: 'ubuntu-22.04', python-version: '3.8', pytorch-version: '1.13.1'} - {os: 'ubuntu-22.04', python-version: '3.10', pytorch-version: '1.13.1'} - {os: 'ubuntu-22.04', python-version: '3.10', pytorch-version: '2.0.0'} + - {os: 'ubuntu-22.04', python-version: '3.11', pytorch-version: '2.0.0'} - {os: 'macOS-11', python-version: '3.8', pytorch-version: '1.13.1'} - {os: 'macOS-11', python-version: '3.9', pytorch-version: '1.13.1'} - {os: 'macOS-11', python-version: '3.10', pytorch-version: '2.0.0'} + - {os: 'macOS-11', python-version: '3.11', pytorch-version: '2.0.0'} - {os: 'windows-2022', python-version: '3.8', pytorch-version: '1.13.1'} - {os: 'windows-2022', python-version: '3.9', pytorch-version: '1.13.1'} - {os: 'windows-2022', python-version: '3.10', pytorch-version: '2.0.0'} + - {os: 'windows-2022', python-version: '3.11', pytorch-version: '2.0.0'} # the oldest configurations - {os: 'ubuntu-20.04', python-version: '3.8', pytorch-version: '1.8.1', requires: 'oldest'} - {os: 'macOS-11', python-version: '3.8', pytorch-version: '1.8.1', requires: 'oldest'} @@ -78,8 +81,7 @@ jobs: sudo apt install -y ffmpeg dvipng texlive-latex-extra texlive-fonts-recommended cm-super - name: Setup Windows if: ${{ runner.os == 'windows' }} - run: | - choco install ffmpeg + run: choco install ffmpeg - name: source cashing uses: ./.github/actions/pull-caches @@ -88,6 +90,11 @@ jobs: pytorch-version: ${{ matrix.pytorch-version }} pypi-dir: ${{ env.PYPI_CACHE }} + - name: Temp numba bump (for py3.11) + if: ${{ matrix.python-version == '3.11' }} + # ToDo: remove after full 0.57.0 release + run: pip install "numba~=0.57.0rc1" + - name: Install pkg timeout-minutes: 25 run: | @@ -106,6 +113,7 @@ jobs: run: python -m pytest torchmetrics --reruns 3 --reruns-delay 2 - name: Freeze PIL (hotfix) + if: ${{ matrix.python-version != '3.11' }} # import of PILLOW_VERSION which they recently removed in v9.0 in favor of __version__ run: pip install "Pillow<9.0" # It messes with torchvision diff --git a/CHANGELOG.md b/CHANGELOG.md index 7dc76dc46cd..09ea7465d5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,6 +79,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added support for plotting of aggregation metrics through `.plot()` method ([#1485](https://github.com/Lightning-AI/metrics/pull/1485)) +- Added support for python 3.11 ([#1612](https://github.com/Lightning-AI/metrics/pull/1612)) + + - Added support for auto clamping of input for metrics that uses the `data_range` ([#1606](argument https://github.com/Lightning-AI/metrics/pull/1606)) diff --git a/setup.py b/setup.py index 01174cbac94..2b2bd5c042d 100755 --- a/setup.py +++ b/setup.py @@ -230,5 +230,6 @@ def _prepare_extras(skip_files: Tuple[str] = ("devel.txt", "doctest.txt", "integ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", ], ) diff --git a/src/torchmetrics/functional/text/infolm.py b/src/torchmetrics/functional/text/infolm.py index 74c16bfdb54..e85e2d37591 100644 --- a/src/torchmetrics/functional/text/infolm.py +++ b/src/torchmetrics/functional/text/infolm.py @@ -137,7 +137,7 @@ def __init__( self.beta = beta or 0 def __call__(self, preds_distribution: Tensor, target_distribtuion: Tensor) -> Tensor: - information_measure_function = getattr(self, f"_calculate_{self.information_measure}") + information_measure_function = getattr(self, f"_calculate_{self.information_measure.value}") return torch.nan_to_num(information_measure_function(preds_distribution, target_distribtuion)) @staticmethod