diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index b6675068974..26ce322d691 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -14,6 +14,8 @@ COPY requirements/ /tmp/pip-tmp/requirements/ RUN \ pip3 install awscli && \ aws s3 sync --no-sign-request s3://sphinx-packages/ dist/ && \ + # trying to resolve pesq installation issue + pip3 install -q "numpy<1.24" && \ pip3 --disable-pip-version-check --no-cache-dir install \ -r /tmp/pip-tmp/requirements/devel.txt \ -r /tmp/pip-tmp/requirements/docs.txt \ diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 6716d422f47..a6ff994f985 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -27,7 +27,7 @@ jobs: strategy: fail-fast: false matrix: - python: ["3.9", "3.10"] + python: ["3.9", "3.10", "3.11"] steps: - name: Checkout uses: actions/checkout@v4 @@ -58,12 +58,13 @@ jobs: matrix: include: # These are the base images for PL release docker images, - # so include at least all of the combinations in release-dockers.yml. + # so include at least all of the combinations in release-dockers.yml. - { python: "3.8", pytorch: "1.8.1", cuda: "11.1.1", ubuntu: "20.04" } - { python: "3.9", pytorch: "1.10", cuda: "11.8.0", ubuntu: "22.04" } - { python: "3.9", pytorch: "1.11", cuda: "11.8.0", ubuntu: "22.04" } - { python: "3.9", pytorch: "1.13", cuda: "11.8.0", ubuntu: "22.04" } - { python: "3.10", pytorch: "2.0", cuda: "11.8.0", ubuntu: "22.04" } + - { python: "3.11", pytorch: "2.0", cuda: "12.1.0", ubuntu: "22.04" } steps: - uses: actions/checkout@v4 @@ -74,7 +75,7 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Build (and Push) Devcontainer + - name: Build (and Push) runner uses: docker/build-push-action@v5 with: build-args: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bcf3e90631..50e9482bb51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Fixed numerical stability bug in `LearnedPerceptualImagePatchSimilarity` metric ([#2144](https://github.com/Lightning-AI/torchmetrics/pull/2144)) ## [1.2.0] - 2023-09-22 diff --git a/dockers/ubuntu-cuda/Dockerfile b/dockers/ubuntu-cuda/Dockerfile index b382279a869..ea8ab92ac45 100644 --- a/dockers/ubuntu-cuda/Dockerfile +++ b/dockers/ubuntu-cuda/Dockerfile @@ -82,8 +82,6 @@ RUN \ done && \ # trying to resolve pesq installation issue pip install -q "numpy<1.24" && \ - # needed for the gpu multiprocessing - pip install "mkl-service==2.4.0" && \ CUDA_VERSION_MM=${CUDA_VERSION%.*} && \ CU_VERSION_MM=${CUDA_VERSION_MM//'.'/''} && \ pip install --no-cache-dir -r requirements/devel.txt \ diff --git a/docs/source/conf.py b/docs/source/conf.py index 3f116bd77d3..31ba5d1b81a 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -428,6 +428,9 @@ def _get_version_str(): # skip false positive linkcheck errors from anchors linkcheck_anchors = False +# A timeout value, in seconds, for the linkcheck builder. +linkcheck_timeout = 10 + # ignore all links in any CHANGELOG file linkcheck_exclude_documents = [r"^(.*\/)*CHANGELOG.*$"] diff --git a/docs/source/links.rst b/docs/source/links.rst index 8c8dc593fe3..b2ffc6768c7 100644 --- a/docs/source/links.rst +++ b/docs/source/links.rst @@ -43,7 +43,7 @@ .. _Mean-Average-Precision (mAP) and Mean-Average-Recall (mAR): https://jonathan-hui.medium.com/map-mean-average-precision-for-object-detection-45c121a31173 .. _Tweedie Deviance Score: https://en.wikipedia.org/wiki/Tweedie_distribution#The_Tweedie_deviance .. _Permutation Invariant Training of Deep Models: https://ieeexplore.ieee.org/abstract/document/7952154 -.. _Top-label Calibration Error: https://arxiv.org/pdf/1909.10155.pdf +.. _Top-label Calibration Error: https://arxiv.org/abs/1909.10155 .. _Gradient Computation of Image: https://en.wikipedia.org/wiki/Image_gradient .. _R2 Score_Coefficient Determination: https://en.wikipedia.org/wiki/Coefficient_of_determination .. _Rank of element tensor: https://github.com/scipy/scipy/blob/v1.6.2/scipy/stats/stats.py#L4140-L4303 @@ -76,7 +76,7 @@ .. _Python ROUGE Implementation: https://pypi.org/project/rouge-score/ .. _Scikit_Learn-Ranking.py: https: //github.com/scikit-learn/scikit-learn/blob/master/sklearn/metrics/_ranking.py .. _Verified Uncertainty Calibration: https://arxiv.org/abs/1909.10155 -.. _SQuAD Metric: https://arxiv.org/pdf/1606.05250.pdf +.. _SQuAD Metric: https://arxiv.org/abs/1606.05250 .. _chrF score: https://aclanthology.org/W15-3049.pdf .. _chrF++ score: https://aclanthology.org/W17-4770.pdf .. _TER: https://aclanthology.org/2006.amta-papers.25.pdf @@ -91,19 +91,19 @@ .. _WIL: https://www.isca-speech.org/archive/interspeech_2004/morris04_interspeech.html .. _WIP: https://infoscience.epfl.ch/record/82766 .. _TV: https://en.wikipedia.org/wiki/Total_variation_denoising -.. _InfoLM: https://arxiv.org/pdf/2112.01589.pdf +.. _InfoLM: https://arxiv.org/abs/2112.01589 .. _alpha divergence: https://static.renyi.hu/renyi_cikkek/1961_on_measures_of_entropy_and_information.pdf .. _beta divergence: https://www.sciencedirect.com/science/article/pii/S0047259X08000456 .. _AB divergence: https://pdfs.semanticscholar.org/744b/1166de34cb099100f151f3b1459f141ae25b.pdf .. _Rényi divergence: https://static.renyi.hu/renyi_cikkek/1961_on_measures_of_entropy_and_information.pdf -.. _Fisher-Rao distance: https://arxiv.org/pdf/1711.01530.pdf +.. _Fisher-Rao distance: https://arxiv.org/abs/1711.01530 .. _Cramer's V: https://en.wikipedia.org/wiki/Cram%C3%A9r%27s_V .. _Kendall Rank Correlation Coefficient: https://en.wikipedia.org/wiki/Kendall_rank_correlation_coefficient .. _The Treatment of Ties in Ranking Problems: https://www.jstor.org/stable/2332303 -.. _LogCosh Error: https://arxiv.org/pdf/2101.10427.pdf +.. _LogCosh Error: https://arxiv.org/abs/2101.10427 .. _Tschuprow's T: https://en.wikipedia.org/wiki/Tschuprow%27s_T .. _Pearson's Contingency Coefficient: https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/pearcont.htm -.. _CLIP score: https://arxiv.org/pdf/2104.08718.pdf +.. _CLIP score: https://arxiv.org/abs/2104.08718 .. _Huggingface OpenAI: https://huggingface.co/openai .. _Theils Uncertainty coefficient: https://en.wikipedia.org/wiki/Uncertainty_coefficient .. _Perceptual Evaluation of Speech Quality: https://en.wikipedia.org/wiki/Perceptual_Evaluation_of_Speech_Quality @@ -146,7 +146,7 @@ .. _VIF: https://ieeexplore.ieee.org/abstract/document/1576816 .. _CLIP-IQA: https://arxiv.org/abs/2207.12396 .. _CLIP: https://arxiv.org/abs/2103.00020 -.. _PPL : https://arxiv.org/pdf/1812.04948 +.. _PPL : https://arxiv.org/abs/1812.04948 .. _CIOU: https://arxiv.org/abs/2005.03572 .. _DIOU: https://arxiv.org/abs/1911.08287v1 .. _GIOU: https://arxiv.org/abs/1902.09630 diff --git a/requirements/typing.txt b/requirements/typing.txt index 1ae2204f06b..5cf974f592c 100644 --- a/requirements/typing.txt +++ b/requirements/typing.txt @@ -1,4 +1,5 @@ -mypy==1.5.1 +mypy ==1.5.1 +torch ==2.0.0 types-PyYAML types-emoji diff --git a/src/torchmetrics/functional/image/lpips.py b/src/torchmetrics/functional/image/lpips.py index d6480b4eea3..e6fa726f2ec 100644 --- a/src/torchmetrics/functional/image/lpips.py +++ b/src/torchmetrics/functional/image/lpips.py @@ -191,10 +191,10 @@ def _upsample(in_tens: Tensor, out_hw: Tuple[int, ...] = (64, 64)) -> Tensor: return nn.Upsample(size=out_hw, mode="bilinear", align_corners=False)(in_tens) -def _normalize_tensor(in_feat: Tensor, eps: float = 1e-10) -> Tensor: - """Normalize tensors.""" - norm_factor = torch.sqrt(torch.sum(in_feat**2, dim=1, keepdim=True)) - return in_feat / (norm_factor + eps) +def _normalize_tensor(in_feat: Tensor, eps: float = 1e-8) -> Tensor: + """Normalize input tensor.""" + norm_factor = torch.sqrt(eps + torch.sum(in_feat**2, dim=1, keepdim=True)) + return in_feat / norm_factor def _resize_tensor(x: Tensor, size: int = 64) -> Tensor: