Skip to content

Commit 5560594

Browse files
authored
Merge branch 'master' into docs/pesq-gallery-2
2 parents 0d59ec8 + d6a1ad2 commit 5560594

File tree

92 files changed

+2632
-760
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+2632
-760
lines changed

.azure/gpu-integrations.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
torch-ver: "2.0"
2323
requires: "oldest"
2424
"torch | 2.x":
25-
docker-image: "pytorch/pytorch:2.5.0-cuda12.1-cudnn9-runtime"
26-
torch-ver: "2.5"
25+
docker-image: "pytorch/pytorch:2.6.0-cuda12.4-cudnn9-runtime"
26+
torch-ver: "2.6"
2727
# how long to run the job before automatically cancelling
2828
timeoutInMinutes: "40"
2929
# how much time to give 'run always even if cancelled tasks' before stopping them

.azure/gpu-unittests.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ jobs:
2929
docker-image: "ubuntu22.04-cuda11.8.0-py3.10-torch2.0"
3030
torch-ver: "2.0"
3131
"PyTorch | 2.X stable":
32-
docker-image: "ubuntu22.04-cuda12.1.1-py3.11-torch2.5"
33-
torch-ver: "2.5"
34-
"PyTorch | 2.X future":
3532
docker-image: "ubuntu22.04-cuda12.4.1-py3.11-torch2.6"
3633
torch-ver: "2.6"
3734
# how long to run the job before automatically cancelling
@@ -185,7 +182,7 @@ jobs:
185182
- bash: |
186183
du -h --max-depth=1 .
187184
python -m pytest $(TEST_DIRS) \
188-
-m "not DDP" --numprocesses=5 --dist=loadfile \
185+
-m "not DDP" --numprocesses=9 --dist=loadfile \
189186
--cov=torchmetrics --timeout=240 --durations=100 \
190187
--reruns 3 --reruns-delay 1
191188
workingDirectory: "tests/"

.devcontainer/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ RUN \
1919
pip3 --disable-pip-version-check --no-cache-dir install \
2020
-r /tmp/pip-tmp/requirements/_devel.txt \
2121
-r /tmp/pip-tmp/requirements/_docs.txt \
22-
--find-links="https://download.pytorch.org/whl/cpu/torch_stable.html" \
22+
--extra-index-url="https://download.pytorch.org/whl/cpu/" \
2323
--find-links="dist/" && \
2424
rm -rf /tmp/pip-tmp
2525

.github/assistant.py

+16-5
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,23 @@
1616
import os
1717
import re
1818
import sys
19+
from pathlib import Path
1920
from typing import Optional, Union
2021

2122
import fire
2223
from packaging.version import parse
2324

2425
_REQUEST_TIMEOUT = 10
25-
_PATH_ROOT = os.path.dirname(os.path.dirname(__file__))
26+
_PATH_REPO_ROOT = Path(__file__).resolve().parent.parent
27+
_PATH_DIR_TESTS = _PATH_REPO_ROOT / "tests"
2628
_PKG_WIDE_SUBPACKAGES = ("utilities", "helpers")
2729
LUT_PYTHON_TORCH = {
2830
"3.8": "1.4",
2931
"3.9": "1.7.1",
3032
"3.10": "1.11",
3133
"3.11": "1.13",
3234
}
33-
_path_root = lambda *ds: os.path.join(_PATH_ROOT, *ds)
35+
_path_root = lambda *ds: os.path.join(_PATH_REPO_ROOT, *ds)
3436
REQUIREMENTS_FILES = (*glob.glob(_path_root("requirements", "*.txt")), _path_root("requirements.txt"))
3537

3638

@@ -143,6 +145,8 @@ def changed_domains(
143145
if len(files) == len(files_markdown):
144146
logging.debug("Only markdown files was changed so not reason for deep testing...")
145147
return _return_empty
148+
# filter out markdown files
149+
files = [fn for fn in files if fn not in files_markdown]
146150

147151
# filter only testing files which are not specific tests so for example configurations or helper tools
148152
files_testing = [fn for fn in files if fn.startswith("tests") and not fn.endswith(".md") and "test_" not in fn]
@@ -188,10 +192,17 @@ def _crop_path(fname: str, paths: tuple[str] = ("src/torchmetrics/", "tests/unit
188192
if as_list: # keep only unique
189193
return list(test_modules)
190194

191-
test_modules = [f"unittests/{md}" for md in set(test_modules)]
192-
not_exists = [p for p in test_modules if os.path.exists(p)]
195+
test_modules = [os.path.join("unittests", fp) for fp in set(test_modules)]
196+
# filter only existing modules
197+
not_exists = [fp for fp in test_modules if not (_PATH_DIR_TESTS / fp).exists()]
193198
if not_exists:
194-
raise ValueError(f"Missing following paths: {not_exists}")
199+
logging.debug(f"Missing following paths: {not_exists}")
200+
# filter only existing path in repo
201+
test_modules = [fp for fp in test_modules if (_PATH_DIR_TESTS / fp).exists()]
202+
if not test_modules:
203+
logging.debug("No tests were changed -> rather test everything...")
204+
return _return_all
205+
195206
return " ".join(test_modules)
196207

197208
@staticmethod

.github/workflows/_merge_cache.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,22 @@ jobs:
2929
merge-multiple: true
3030
path: _local-packages
3131
- name: Cache pull packages
32-
uses: actions/cache/restore@v3
32+
uses: actions/cache/restore@v4
3333
with:
3434
enableCrossOsArchive: true
3535
path: ${{ inputs.pypi-dir }}
3636
key: ${{ inputs.pypi-key }}
3737

38+
- name: show pulled caches
39+
continue-on-error: true
40+
run: ls -lh ${{ inputs.pypi-dir }}
41+
3842
- name: show 📦
3943
run: |
4044
# create the directory if it doesn't exist - no artifact were found
4145
mkdir -p _local-packages
4246
ls -lh _local-packages
43-
ls -lh ${{ inputs.pypi-dir }}
47+
mkdir -p ${{ inputs.pypi-dir }}
4448
# count files in the staging dir
4549
file_count=$(ls -1 "_local-packages/" | wc -l)
4650
echo "NUM_PACKAGES=$file_count" >> $GITHUB_ENV
@@ -50,7 +54,7 @@ jobs:
5054

5155
- name: Cache push packages
5256
if: env.NUM_PACKAGES != 0
53-
uses: actions/cache/save@v3
57+
uses: actions/cache/save@v4
5458
with:
5559
enableCrossOsArchive: true
5660
path: ${{ inputs.pypi-dir }}

.github/workflows/ci-checks.yml

+9-6
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,22 @@ concurrency:
1313

1414
jobs:
1515
check-code:
16-
uses: Lightning-AI/utilities/.github/workflows/check-typing.yml@v0.11.9
16+
uses: Lightning-AI/utilities/.github/workflows/check-typing.yml@v0.13.1
1717
with:
18-
actions-ref: v0.11.9
18+
actions-ref: v0.13.1
1919
extra-typing: "typing"
2020

2121
check-schema:
22-
uses: Lightning-AI/utilities/.github/workflows/check-schema.yml@v0.11.9
22+
uses: Lightning-AI/utilities/.github/workflows/check-schema.yml@v0.13.1
23+
with:
24+
actions-ref: v0.13.1
25+
azure-schema-version: "v1.208.0"
2326

2427
check-package:
2528
if: github.event.pull_request.draft == false
26-
uses: Lightning-AI/utilities/.github/workflows/check-package.yml@v0.11.9
29+
uses: Lightning-AI/utilities/.github/workflows/check-package.yml@v0.13.1
2730
with:
28-
actions-ref: v0.11.9
31+
actions-ref: v0.13.1
2932
artifact-name: dist-packages-${{ github.sha }}
3033
import-name: "torchmetrics"
3134
testing-matrix: |
@@ -35,7 +38,7 @@ jobs:
3538
}
3639
3740
check-md-links:
38-
uses: Lightning-AI/utilities/.github/workflows/check-md-links.yml@v0.11.9
41+
uses: Lightning-AI/utilities/.github/workflows/check-md-links.yml@v0.13.1
3942
with:
4043
base-branch: master
4144
config-file: ".github/markdown-links-config.json"

.github/workflows/ci-tests.yml

+8-6
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ jobs:
5252
- { os: "macOS-13", python-version: "3.10", pytorch-version: "2.0.1" }
5353
# using the ARM based M1 machine
5454
- { os: "macOS-14", python-version: "3.10", pytorch-version: "2.0.1" }
55-
- { os: "macOS-14", python-version: "3.12", pytorch-version: "2.5.0" }
55+
- { os: "macOS-14", python-version: "3.12", pytorch-version: "2.6.0" }
5656
# some windows
5757
- { os: "windows-2022", python-version: "3.10", pytorch-version: "2.0.1" }
58-
- { os: "windows-2022", python-version: "3.12", pytorch-version: "2.5.0" }
58+
- { os: "windows-2022", python-version: "3.12", pytorch-version: "2.6.0" }
5959
# Future released version
60-
- { os: "ubuntu-22.04", python-version: "3.11", pytorch-version: "2.6.0" }
61-
- { os: "macOS-14", python-version: "3.11", pytorch-version: "2.6.0" }
62-
- { os: "windows-2022", python-version: "3.11", pytorch-version: "2.6.0" }
60+
#- { os: "ubuntu-22.04", python-version: "3.11", pytorch-version: "2.7.0" }
61+
#- { os: "macOS-14", python-version: "3.11", pytorch-version: "2.7.0" }
62+
#- { os: "windows-2022", python-version: "3.11", pytorch-version: "2.7.0" }
6363
env:
6464
FREEZE_REQUIREMENTS: ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }}
6565
TOKENIZERS_PARALLELISM: false
@@ -104,7 +104,7 @@ jobs:
104104
cache-references: true
105105

106106
- name: Switch to PT test URL
107-
if: ${{ matrix.pytorch-version == '2.6.0' }}
107+
if: ${{ matrix.pytorch-version == '2.7.0' }}
108108
run: echo 'PIP_EXTRA_INDEX_URL=--extra-index-url https://download.pytorch.org/whl/test/cpu/' >> $GITHUB_ENV
109109
- name: Install pkg
110110
timeout-minutes: 25
@@ -131,6 +131,8 @@ jobs:
131131
done
132132
pip install --requirement requirements/_devel.txt -U \
133133
$PIP_EXTRA_INDEX_URL --find-links="$PYPI_CACHE_DIR"
134+
pip install --requirement requirements/clustering.txt -U \
135+
$PIP_EXTRA_INDEX_URL --find-links="$PYPI_CACHE_DIR" || true # separate install to avoid conflicts and ignore failures
134136
pip list
135137
136138
- name: set special vars for PR

.github/workflows/clear-cache.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@ on:
2323
jobs:
2424
cron-clear:
2525
if: github.event_name == 'schedule' || github.event_name == 'pull_request'
26-
uses: Lightning-AI/utilities/.github/workflows/cleanup-caches.yml@v0.11.9
26+
uses: Lightning-AI/utilities/.github/workflows/cleanup-caches.yml@v0.13.1
2727
with:
28-
scripts-ref: v0.11.9
28+
scripts-ref: v0.13.1
2929
dry-run: ${{ github.event_name == 'pull_request' }}
3030
pattern: "pip-latest"
3131
age-days: 7
3232

3333
direct-clear:
3434
if: github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request'
35-
uses: Lightning-AI/utilities/.github/workflows/cleanup-caches.yml@v0.11.9
35+
uses: Lightning-AI/utilities/.github/workflows/cleanup-caches.yml@v0.13.1
3636
with:
37-
scripts-ref: v0.11.9
37+
scripts-ref: v0.13.1
3838
dry-run: ${{ github.event_name == 'pull_request' }}
3939
pattern: ${{ inputs.pattern || 'pypi_wheels' }} # setting str in case of PR / debugging
4040
age-days: ${{ fromJSON(inputs.age-days) || 0 }} # setting 0 in case of PR / debugging

.github/workflows/docker-build.yml

-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ jobs:
7272
- { python: "3.11", pytorch: "2.3.1", cuda: "12.1.1", ubuntu: "22.04" }
7373
- { python: "3.11", pytorch: "2.4.1", cuda: "12.1.1", ubuntu: "22.04" }
7474
- { python: "3.11", pytorch: "2.5.0", cuda: "12.1.1", ubuntu: "22.04" }
75-
# the future version - test or RC version
7675
- { python: "3.11", pytorch: "2.6.0", cuda: "12.4.1", ubuntu: "22.04" }
7776
steps:
7877
- uses: actions/checkout@v4

.github/workflows/docs-build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
- uses: actions/checkout@v4
4040
- uses: actions/setup-python@v5
4141
with:
42-
python-version: "3.x"
42+
python-version: "3.10"
4343

4444
- name: source cashing
4545
uses: ./.github/actions/pull-caches

.github/workflows/greetings.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ jobs:
1010
- uses: actions/first-interaction@v1
1111
with:
1212
repo-token: ${{ secrets.GITHUB_TOKEN }}
13-
issue-message: "Hi! thanks for your contribution!, great first issue!"
13+
issue-message: "Hi! Thanks for your contribution! Great first issue!"
1414
pr-message: "Hey thanks for the input! Please give us a bit of time to review it!"

.github/workflows/publish-pkg.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
- run: ls -lh dist/
6868
# We do this, since failures on test.pypi aren't that bad
6969
- name: Publish to Test PyPI
70-
uses: pypa/gh-action-pypi-publish@v1.12.3
70+
uses: pypa/gh-action-pypi-publish@v1.12.4
7171
with:
7272
user: __token__
7373
password: ${{ secrets.test_pypi_password }}
@@ -94,7 +94,7 @@ jobs:
9494
path: dist
9595
- run: ls -lh dist/
9696
- name: Publish distribution 📦 to PyPI
97-
uses: pypa/gh-action-pypi-publish@v1.12.3
97+
uses: pypa/gh-action-pypi-publish@v1.12.4
9898
with:
9999
user: __token__
100100
password: ${{ secrets.pypi_password }}

0 commit comments

Comments
 (0)