Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

releasing minor 1.6.2 [rebase & merge] #2981

Merged
merged 62 commits into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
61ef479
build(deps): bump mypy from 1.14.0 to 1.14.1 in /requirements (#2889)
dependabot[bot] Dec 31, 2024
c196688
build(deps): bump pypa/gh-action-pypi-publish from 1.12.2 to 1.12.3 (…
dependabot[bot] Jan 2, 2025
89bc874
docs: inject version selector to HTML docs (#2886)
Borda Jan 6, 2025
e58e5a9
ci: fix determine PR's diff (#2894)
Borda Jan 6, 2025
99dd70d
ci: update caching to resolve concurrency (#2869)
Borda Jan 6, 2025
0ca5253
tests/ci: limit waved failed model loading (#2895)
Borda Jan 7, 2025
c4eb9b8
[pre-commit.ci] pre-commit suggestions (#2902)
pre-commit-ci[bot] Jan 7, 2025
0ddc445
build(deps): update scipy requirement from <1.15.0,>1.0.0 to >1.0.0,<…
dependabot[bot] Jan 7, 2025
8e069c5
build(deps): update sacrebleu requirement from <2.5.0,>=2.3.0 to >=2.…
dependabot[bot] Jan 7, 2025
19df82b
build(deps): update dython requirement from ~=0.7.8 to ~=0.7.9 in /re…
dependabot[bot] Jan 7, 2025
6a0cec0
ci: update `torch` URL
Borda Jan 7, 2025
24edb0c
docs: fix build for RTFD (#2903)
Borda Jan 13, 2025
35a517d
Make `num_classes` optional, in case of micro averaging (#2841)
baskrahmer Jan 13, 2025
c3b4a32
build(deps): update cloudpickle requirement from <=3.1.0,>1.3 to >1.3…
dependabot[bot] Jan 21, 2025
bbd0a17
Enhance `Clip_Score` to calculate similarities between same modalitie…
rittik9 Jan 25, 2025
e1737dc
build(deps): bump pytest-doctestplus from 1.3.0 to 1.4.0 in /requirem…
dependabot[bot] Jan 31, 2025
e294519
ci: resolve building docs (#2928)
Borda Jan 31, 2025
abe81c4
Fix typo in FID description: Replace "access" with "assess" (#2919)
isztldav Jan 31, 2025
43a5a18
ci: bump `utilities @0.12.0` as compatibility fix (#2929)
Borda Jan 31, 2025
4a49c75
tests: skip if HTTP Error 504: Gateway Time-out (#2927)
Borda Jan 31, 2025
53c7911
build(deps): update kornia requirement from <0.8.0,>=0.6.7 to >=0.6.7…
dependabot[bot] Jan 31, 2025
23ef119
build(deps): bump actions/cache from 3 to 4 (#2933)
dependabot[bot] Feb 3, 2025
7893f5e
build(deps): bump pypa/gh-action-pypi-publish from 1.12.3 to 1.12.4 (…
dependabot[bot] Feb 3, 2025
69cc494
docs: typo in greeting template (#2936)
MostHumble Feb 3, 2025
9b2b616
tests: correct skipif sense (#2931)
martin-kokos Feb 3, 2025
5906e80
tests: skip if `pytest.pool` not used (#2930)
martin-kokos Feb 3, 2025
e4cf31b
req: remove void requirements after bump to py3.9+ (#2917)
Borda Feb 3, 2025
a26a6b2
build(deps): update transformers requirement from <4.47.0,>=4.42.3 to…
dependabot[bot] Feb 3, 2025
19a15b4
tests: switch away from deprecated `jiwer` methods (#2937)
nikvaessen Feb 3, 2025
98fb2c1
build(deps): update numpy requirement from <2.0 to <3.0 in /requireme…
dependabot[bot] Feb 3, 2025
94128c3
build(deps): update huggingface-hub requirement from <0.28 to <0.29 i…
dependabot[bot] Feb 4, 2025
42a94bd
build(deps): update jiwer requirement from <3.1.0,>=2.3.0 to >=2.3.0,…
dependabot[bot] Feb 4, 2025
e3bd13e
build(deps): bump lightning-utilities from 0.11.9 to 0.12.0 in /requi…
dependabot[bot] Feb 4, 2025
bf6cd74
chlog: update after `1.6.1`
Borda Feb 6, 2025
21be651
build(deps): bump mypy from 1.14.1 to 1.15.0 in /requirements (#2950)
dependabot[bot] Feb 13, 2025
51918eb
ci: update with `Torch` released 2.6 (#2922)
Borda Feb 13, 2025
faec851
build(deps): update mir-eval requirement from <=0.7,>=0.6 to >=0.6,<=…
dependabot[bot] Feb 14, 2025
4b860c0
build(deps): update scikit-image requirement from ~=0.22 to ~=0.24 in…
dependabot[bot] Feb 14, 2025
e67257b
build(deps): bump sphinx-gallery from 0.18.0 to 0.19.0 in /requiremen…
dependabot[bot] Feb 18, 2025
729a2d7
build(deps): update transformers requirement from <4.49.0,>=4.42.3 to…
dependabot[bot] Feb 18, 2025
2bf3ef8
build(deps): update pygithub requirement from <2.6.0,>2.0.0 to >2.0.0…
dependabot[bot] Feb 18, 2025
cc42a36
ci: fix cache if there is no update (#2959)
Borda Feb 18, 2025
987da3c
Fix incorrect CLIP-IQA type hints (#2952)
wooseopkim Feb 24, 2025
41385af
chore: upgrade torch to 2.6.0 and resolve typing issues (#2960)
rittik9 Feb 24, 2025
d9dbbc1
iou_type: correct type hints (#2966)
adamjstewart Feb 24, 2025
a371f86
fix for `MetricCollection.update` gives identical results (#2944)
rbedyakin Feb 24, 2025
a661400
torchmetric optimizations (#2943)
czmrand Feb 24, 2025
5e3e481
build(deps): update huggingface-hub requirement from <0.29 to <0.30 i…
dependabot[bot] Feb 25, 2025
1dd0bfa
build(deps): update mir-eval requirement from <=0.8.0,>=0.6 to >=0.6,…
dependabot[bot] Feb 25, 2025
9e72aa6
build(deps): update psutil requirement from ==6.* to ==7.* in /requir…
dependabot[bot] Feb 25, 2025
a63fc07
build(deps): update scikit-image requirement from ~=0.22 to ~=0.19 in…
dependabot[bot] Feb 25, 2025
527ee88
Small fix to docs (#2973)
SkafteNicki Feb 26, 2025
9d459c9
ci: fix focusing diff (#2976)
Borda Feb 26, 2025
01d27a8
Fix corner case in pearson correlation (#2975)
SkafteNicki Feb 26, 2025
598bb01
Fix `MeanAveragePrecision` for `average="micro"` when 0 label is not …
SkafteNicki Feb 27, 2025
a758d63
Fix missing `kwargs` in `PIT` metric for permutation wise mode (#2977)
SkafteNicki Feb 27, 2025
2edaa31
Fix cache in DNSMOS metric (#2974)
SkafteNicki Feb 27, 2025
87b39df
Fix dice score when zero overlap between preds and target (#2860)
SkafteNicki Feb 28, 2025
71bdf2b
Fix multiple errors in the `_final_aggregation` function for `Pearson…
SkafteNicki Feb 28, 2025
2b12132
tests: skip connection issue (#2982)
Borda Feb 28, 2025
969a98d
Fix corner case in manually specifying `compute_groups` in `MetricCol…
SkafteNicki Feb 28, 2025
9f4ca0f
releasing `1.6.2`
Borda Feb 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .azure/gpu-integrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
torch-ver: "2.0"
requires: "oldest"
"torch | 2.x":
docker-image: "pytorch/pytorch:2.5.0-cuda12.1-cudnn9-runtime"
torch-ver: "2.5"
docker-image: "pytorch/pytorch:2.6.0-cuda12.4-cudnn9-runtime"
torch-ver: "2.6"
# how long to run the job before automatically cancelling
timeoutInMinutes: "40"
# how much time to give 'run always even if cancelled tasks' before stopping them
Expand Down
3 changes: 0 additions & 3 deletions .azure/gpu-unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ jobs:
docker-image: "ubuntu22.04-cuda11.8.0-py3.10-torch2.0"
torch-ver: "2.0"
"PyTorch | 2.X stable":
docker-image: "ubuntu22.04-cuda12.1.1-py3.11-torch2.5"
torch-ver: "2.5"
"PyTorch | 2.X future":
docker-image: "ubuntu22.04-cuda12.4.1-py3.11-torch2.6"
torch-ver: "2.6"
# how long to run the job before automatically cancelling
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RUN \
pip3 --disable-pip-version-check --no-cache-dir install \
-r /tmp/pip-tmp/requirements/_devel.txt \
-r /tmp/pip-tmp/requirements/_docs.txt \
--find-links="https://download.pytorch.org/whl/cpu/torch_stable.html" \
--extra-index-url="https://download.pytorch.org/whl/cpu/" \
--find-links="dist/" && \
rm -rf /tmp/pip-tmp

Expand Down
13 changes: 12 additions & 1 deletion .github/actions/pull-caches/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ inputs:
description: cache restore/dump key
required: false
default: "pypi-packages"
cache-torch-HF:
description: "cache torch and HF"
required: false
default: "true"
cache-references:
description: "cache metrics references"
required: false
default: "false"

runs:
using: "composite"
Expand Down Expand Up @@ -67,6 +75,7 @@ runs:
shell: bash

- name: Cache Torch & HF
if: inputs.cache-torch-HF == 'true' # since the input is string
continue-on-error: true
uses: actions/cache/restore@v3
with:
Expand All @@ -75,6 +84,7 @@ runs:
key: ci-caches

- name: Restored Torch & HF
if: inputs.cache-torch-HF == 'true' # since the input is string
run: |
mkdir -p $CACHES_DIR
pip install -q py-tree
Expand All @@ -83,14 +93,15 @@ runs:

- name: Cache References
# do not use this cache for dispatch and crone, to enable rebuild caches if needed
if: github.event_name != 'workflow_dispatch' && github.event_name != 'schedule'
if: github.event_name != 'workflow_dispatch' && github.event_name != 'schedule' && inputs.cache-references == 'true'
continue-on-error: true
uses: actions/cache/restore@v3
with:
path: tests/_cache-references
key: cache-references

- name: Restored References
if: inputs.cache-references == 'true' # since the input is string
continue-on-error: true
working-directory: tests/
run: |
Expand Down
83 changes: 41 additions & 42 deletions .github/actions/push-caches/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ inputs:
description: location to pull PyTorch from
required: false
default: "https://download.pytorch.org/whl/cpu/torch_stable.html"
cache-artifact-appendix:
description: "unique name or running index"
required: false
default: ""
cache-torch-HF:
description: "cache torch and HF"
required: false
default: "true"
cache-references:
description: "cache metrics references"
required: false
default: "false"

runs:
using: "composite"
Expand All @@ -23,66 +35,50 @@ runs:
shell: bash

- name: Freeze local emv.
if: inputs.cache-artifact-appendix != ''
run: |
pip freeze > requirements.dump
cat requirements.dump
shell: bash

#- name: Filter self pkg
# run: |
# import os
# fp = 'requirements.dump'
# with open(fp) as fopen:
# lines = [ln.strip() for ln in fopen.readlines()]
# lines = [ln.split('+')[0] for ln in lines if '-e ' not in ln]
# with open(fp, 'w') as fwrite:
# fwrite.writelines([ln + os.linesep for ln in lines])
# shell: python

- name: Dump wheels
if: inputs.cache-artifact-appendix != ''
run: |
pip wheel -r requirements/_devel.txt --prefer-binary \
--wheel-dir=.pip-wheels \
--wheel-dir=_pip-wheels \
-f ${{ inputs.torch-url }} -f ${{ inputs.pypi-dir }}
ls -lh .pip-wheels
ls -lh _pip-wheels
shell: bash

- name: Cache pull packages
uses: actions/cache/restore@v3
with:
enableCrossOsArchive: true
path: ${{ inputs.pypi-dir }}
key: ${{ inputs.pypi-key }}

- name: Find diff
id: wheels-diff
- name: Move new packages to staging
if: inputs.cache-artifact-appendix != ''
run: |
import os, glob
wheels = [os.path.basename(p) for p in glob.glob(".pip-wheels/*")]
pkgs = [os.path.basename(p) for p in glob.glob("${{ inputs.pypi-dir }}/*")]
diff = [w for w in wheels if w not in pkgs]
print(diff)
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
print(f'count-new={len(diff)}', file=fh)
shell: python

- run: cp .pip-wheels/* ${{ inputs.pypi-dir }}
if: ${{ steps.wheels-diff.outputs.count-new != 0 }}
mkdir -p _pip-staging
python .github/assistant.py move_new_packages \
--dir-cache="${{ inputs.pypi-dir }}" \
--dir_local="_pip-wheels" \
--dir_staging="_pip-staging"
ls -lh _pip-staging/
# count files in the staging dir
file_count=$(ls -1 "_pip-staging/" | wc -l)
echo "NUM_PACKAGES=$file_count" >> $GITHUB_ENV
shell: bash

- name: Cache push packages
if: ${{ steps.wheels-diff.outputs.count-new != 0 }}
uses: actions/cache/save@v3
- name: Upload new packages
if: inputs.cache-artifact-appendix != '' && env.NUM_PACKAGES != 0
uses: actions/upload-artifact@v4
with:
enableCrossOsArchive: true
path: ${{ inputs.pypi-dir }}
key: ${{ inputs.pypi-key }}
name: ${{ inputs.pypi-key }}-run-${{ inputs.cache-artifact-appendix }}
path: _pip-staging
retention-days: 1

- name: Post Torch & HF
if: inputs.cache-torch-HF == 'true' # since the input is string
run: py-tree $CACHES_DIR
shell: bash

- name: Cache Torch & HF
if: inputs.cache-torch-HF == 'true' # since the input is string
continue-on-error: true
uses: actions/cache/save@v3
with:
Expand All @@ -91,13 +87,16 @@ runs:
key: ci-caches

- name: Cache references
if: inputs.cache-references == 'true' # since the input is string
continue-on-error: true
uses: actions/cache/save@v3
with:
#enableCrossOsArchive: true
path: tests/_cache-references
key: cache-references

- name: Post References
run: py-tree tests/_cache-references/ --show_hidden
shell: bash
#- name: Post References
# # This print taken soo many lines, so it is commented out
# if: inputs.cache-references == 'true' # since the input is string
# run: py-tree tests/_cache-references/ --show_hidden
# shell: bash
90 changes: 71 additions & 19 deletions .github/assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import fire
from packaging.version import parse
from pkg_resources import parse_requirements

_REQUEST_TIMEOUT = 10
_PATH_ROOT = os.path.dirname(os.path.dirname(__file__))
Expand Down Expand Up @@ -58,6 +57,9 @@ def set_min_torch_by_python(fpath: str = "requirements/base.txt") -> None:
>>> AssistantCLI.set_min_torch_by_python("../requirements/base.txt")

"""
# ToDo: `pkg_resources` is deprecates and shall be updated
from pkg_resources import parse_requirements

py_ver = f"{sys.version_info.major}.{sys.version_info.minor}"
if py_ver not in LUT_PYTHON_TORCH:
return
Expand Down Expand Up @@ -114,52 +116,102 @@ def changed_domains(
"""Determine what domains were changed in particular PR."""
import github

# define some edge case return cases
_return_all = "unittests" if not as_list else ["torchmetrics"]
_return_empty = [] if as_list else ""

# early return if no PR number
if not pr:
return "unittests"
gh = github.Github()
return _return_all
gh = github.Github(login_or_token=auth_token)
pr = gh.get_repo("Lightning-AI/torchmetrics").get_pull(pr)
files = [f.filename for f in pr.get_files()]

# filter out all integrations as they run in separate suit
files = [fn for fn in files if not fn.startswith("tests/integrations")]
if not files:
logging.debug("Only integrations was changed so not reason for deep testing...")
return ""
return _return_empty

# filter only docs files
files_ = [fn for fn in files if fn.startswith("docs")]
if len(files) == len(files_):
files_docs = [fn for fn in files if fn.startswith("docs")]
if len(files) == len(files_docs):
logging.debug("Only docs was changed so not reason for deep testing...")
return ""
return _return_empty

files_markdown = [fn for fn in files if fn.endswith(".md")]
if len(files) == len(files_markdown):
logging.debug("Only markdown files was changed so not reason for deep testing...")
return _return_empty
# filter out markdown files
files = [fn for fn in files if fn not in files_markdown]

# filter only testing files which are not specific tests so for example configurations or helper tools
files_testing = [fn for fn in files if fn.startswith("tests") and not fn.endswith(".md") and "test_" not in fn]
if files_testing:
logging.debug("Some testing files was changed -> rather test everything...")
return _return_all

# files in requirements folder
files_req = [fn for fn in files if fn.startswith("requirements")]
req_domains = [fn.split("/")[1] for fn in files_req]
# cleaning up determining domains
req_domains = [req.replace(".txt", "").replace("_test", "") for req in req_domains if not req.endswith("_")]
# if you touch base, you need to run everything
if "base" in req_domains:
return _return_all

# filter only package files and skip inits
_is_in_test = lambda fn: fn.startswith("tests")
_filter_pkg = lambda fn: _is_in_test(fn) or (fn.startswith("src/torchmetrics") and "__init__.py" not in fn)
_is_in_test = lambda fname: fname.startswith("tests")
_filter_pkg = lambda fname: _is_in_test(fname) or (
fname.startswith("src/torchmetrics") and "__init__.py" not in fname
)
files_pkg = [fn for fn in files if _filter_pkg(fn)]
if not files_pkg:
return "unittests"
return _return_all

# parse domains
def _crop_path(fname: str, paths: list[str]) -> str:
def _crop_path(fname: str, paths: tuple[str] = ("src/torchmetrics/", "tests/unittests/", "functional/")) -> str:
for p in paths:
fname = fname.replace(p, "")
return fname

files_pkg = [_crop_path(fn, ["src/torchmetrics/", "tests/unittests/", "functional/"]) for fn in files_pkg]
files_pkg = [_crop_path(fn) for fn in files_pkg]
# filter domain names
tm_modules = [fn.split("/")[0] for fn in files_pkg if "/" in fn]
# filter general (used everywhere) sub-packages
tm_modules = [md for md in tm_modules if md not in general_sub_pkgs]
if len(files_pkg) > len(tm_modules):
logging.debug("Some more files was changed -> rather test everything...")
return "unittests"
# keep only unique
if as_list:
return list(tm_modules)
tm_modules = [f"unittests/{md}" for md in set(tm_modules)]
not_exists = [p for p in tm_modules if os.path.exists(p)]
return _return_all

# compose the final list with requirements and touched modules
test_modules = set(tm_modules + list(req_domains))
if as_list: # keep only unique
return list(test_modules)

test_modules = [f"unittests/{md}" for md in set(test_modules)]
not_exists = [p for p in test_modules if os.path.exists(p)]
if not_exists:
raise ValueError(f"Missing following paths: {not_exists}")
return " ".join(tm_modules)
return " ".join(test_modules)

@staticmethod
def move_new_packages(dir_cache: str, dir_local: str, dir_staging: str) -> None:
"""Move unique packages from local folder to staging."""
assert os.path.isdir(dir_cache), f"Missing folder with saved packages: '{dir_cache}'" # noqa: S101
assert os.path.isdir(dir_local), f"Missing folder with local packages: '{dir_local}'" # noqa: S101
assert os.path.isdir(dir_staging), f"Missing folder for staging: '{dir_staging}'" # noqa: S101

import shutil

for pkg in os.listdir(dir_local):
if not os.path.isfile(pkg):
continue
if pkg in os.listdir(dir_cache):
continue
logging.info(f"Moving '{pkg}' to staging...")
shutil.move(os.path.join(dir_cache, pkg), os.path.join(dir_staging, pkg))


if __name__ == "__main__":
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/_focus-diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ jobs:
set -e
echo $PR_NUMBER
pip install -q -U packaging fire pyGithub pyopenssl
# python .github/assistant.py changed-domains $PR_NUMBER
echo "focus=$(python .github/assistant.py changed-domains $PR_NUMBER)" >> $GITHUB_OUTPUT

- run: echo "${{ steps.diff-domains.outputs.focus }}"
Loading
Loading