Skip to content

Commit

Permalink
Merge branch 'master' into plot/13
Browse files Browse the repository at this point in the history
  • Loading branch information
SkafteNicki authored Mar 17, 2023
2 parents 9a72a60 + 95599c9 commit 5a5ea53
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 28 deletions.
7 changes: 6 additions & 1 deletion .azure/gpu-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,15 @@ jobs:
docker-image: 'pytorch/pytorch:1.9.0-cuda11.1-cudnn8-runtime'
agent-pool: 'lit-rtx-3090'
torch-ver: '1.9.0'
'PyTorch - stable':
'PyTorch - LTS':
docker-image: 'pytorch/pytorch:1.13.1-cuda11.6-cudnn8-runtime'
agent-pool: 'lit-rtx-3090'
torch-ver: '1.13.1'
# todo: when docker are live
#'PyTorch - stable':
# docker-image: 'pytorch/pytorch:2.0.0-cuda11.6-cudnn8-runtime'
# agent-pool: 'lit-rtx-3090'
# torch-ver: '2.0.0'
# how long to run the job before automatically cancelling
timeoutInMinutes: "120"
# how much time to give 'run always even if cancelled tasks' before stopping them
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/ci-tests-full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,18 @@ jobs:
fail-fast: false
matrix:
os: ['ubuntu-20.04']
python-version: ['3.8']
pytorch-version: ['1.9.1', '1.10.2', '1.11.0', '1.12.1']
python-version: ['3.9']
pytorch-version: ['1.9.1', '1.10.2', '1.11.0', '1.12.1', '1.13.1', '2.0.0']
include:
- {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: '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: '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'}
# the oldest configurations
- {os: 'ubuntu-20.04', python-version: '3.7', pytorch-version: '1.8.1', requires: 'oldest'}
- {os: 'ubuntu-20.04', python-version: '3.8', pytorch-version: '1.8.1', requires: 'oldest'}
Expand Down
49 changes: 31 additions & 18 deletions .github/workflows/docs-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ name: "Docs check"
on:
- pull_request

env:
PYTORCH_URL: "https://download.pytorch.org/whl/cpu/torch_stable.html"
FREEZE_REQUIREMENTS: 1
PYPI_CACHE: "_ci-cache_PyPI"

jobs:

test-docs:
Expand All @@ -15,19 +20,18 @@ jobs:
with:
python-version: 3.8

# Note: This uses an internal pip API and may not always work
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
- name: Cache pip
uses: actions/cache@v3
- name: source cashing
uses: ./.github/actions/pull-caches
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-
requires: ${{ matrix.requires }}
pytorch-version: ${{ matrix.pytorch-version }}
pypi-dir: ${{ env.PYPI_CACHE }}

- name: Install dependencies
- name: Install package & dependencies
run: |
pip install -e . -U -q -r requirements/docs.txt -f https://download.pytorch.org/whl/cpu/torch_stable.html
python --version ; pip --version ; pip list
pip --version
pip install -e . -U -q -r requirements/docs.txt --find-links $PYTORCH_URL -f $PYPI_CACHE
pip list
shell: bash

- name: Test Documentation
Expand All @@ -44,13 +48,20 @@ jobs:

make-docs:
runs-on: ubuntu-20.04
timeout-minutes: 15
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.8

- name: source cashing
uses: ./.github/actions/pull-caches
with:
requires: ${{ matrix.requires }}
pytorch-version: ${{ matrix.pytorch-version }}
pypi-dir: ${{ env.PYPI_CACHE }}

# Note: This uses an internal pip API and may not always work
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
- name: Cache pip
Expand All @@ -60,23 +71,25 @@ jobs:
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements/docs.txt') }}
restore-keys: ${{ runner.os }}-pip-

- name: Install dependencies
- name: Install dependencies & package
run: |
pip install -e . -U -q -r requirements/docs.txt -f https://download.pytorch.org/whl/torch_stable.html
# install Texlive, see https://linuxconfig.org/how-to-install-latex-on-ubuntu-20-04-focal-fossa-linux
sudo apt-get update
sudo apt-get install -y texlive-latex-extra dvipng texlive-pictures texlive-fonts-recommended cm-super
python --version
pip --version
pip install -e . -U -q -r requirements/docs.txt --find-links $PYTORCH_URL -f $PYPI_CACHE
pip list
shell: bash

- name: Make Documentation
# First run the same pipeline as Read-The-Docs
working-directory: ./docs
run: |
make clean
make html --debug SPHINXOPTS="-W --keep-going" -b linkcheck
run: make html --debug SPHINXOPTS="-W --keep-going"

- name: Check External Links (Optional)
working-directory: ./docs
run: make --jobs $(nproc) linkcheck
# ToDO: comment on PR if any link failed
continue-on-error: true

- name: Upload built docs
uses: actions/upload-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# in case you want to preserve/enforce restrictions on the latest compatible version, add "strict" as an in-line comment

numpy >=1.17.2
torch >=1.8.1, <=1.13.1
torch >=1.8.1, <=2.0.0
typing-extensions; python_version < '3.9'
packaging # hotfix for utils, can be dropped with lit-utils >=0.5
lightning-utilities >=0.7.0, <0.9.0
2 changes: 1 addition & 1 deletion requirements/adjust-versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from packaging.version import Version

VERSIONS = [
{"torch": "2.0.0", "torchvision": "0.15.0", "torchtext": "0.15.0"}, # stable
{"torch": "2.0.0", "torchvision": "0.15.1", "torchtext": "0.15.1"}, # stable
{"torch": "1.14.0", "torchvision": "0.15.0", "torchtext": "0.15.0"}, # nightly
{"torch": "1.13.1", "torchvision": "0.14.1", "torchtext": "0.14.1"}, # stable
{"torch": "1.13.0", "torchvision": "0.14.0", "torchtext": "0.14.0"},
Expand Down
2 changes: 1 addition & 1 deletion requirements/detection.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# NOTE: the upper bound for the package version is only set for CI stability, and it is dropped while installing this package
# in case you want to preserve/enforce restrictions on the latest compatible version, add "strict" as an in-line comment

torchvision >=0.8, <=0.14.1
torchvision >=0.8, <=0.15.1
pycocotools >2.0.0, <=2.0.6
2 changes: 1 addition & 1 deletion requirements/image.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# in case you want to preserve/enforce restrictions on the latest compatible version, add "strict" as an in-line comment

scipy >1.0.0, <1.11.0
torchvision >=0.8, <=0.14.1
torchvision >=0.8, <=0.15.1
torch-fidelity <=0.3.0
lpips <=0.1.4
2 changes: 1 addition & 1 deletion requirements/image_test.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# NOTE: the upper bound for the package version is only set for CI stability, and it is dropped while installing this package
# in case you want to preserve/enforce restrictions on the latest compatible version, add "strict" as an in-line comment

scikit-image >0.17.1, <=0.19.3
scikit-image >=0.19.0, <=0.20.0
kornia >=0.6.7, <0.6.11
pytorch-msssim ==0.2.1
sewar >=0.4.4, <=0.4.5
4 changes: 2 additions & 2 deletions src/torchmetrics/wrappers/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def best_metric(
if return_step:
return value.item(), idx.item()
return value.item()
except ValueError as error:
except (ValueError, RuntimeError) as error:
rank_zero_warn(
f"Encountered the following error when trying to get the best metric: {error}"
"this is probably due to the 'best' not being defined for this metric."
Expand All @@ -242,7 +242,7 @@ def best_metric(
fn = torch.max if maximize[i] else torch.min
out = fn(v, 0)
value[k], idx[k] = out[0].item(), out[1].item()
except ValueError as error:
except (ValueError, RuntimeError) as error:
rank_zero_warn(
f"Encountered the following error when trying to get the best metric for metric {k}:"
f"{error} this is probably due to the 'best' not being defined for this metric."
Expand Down
1 change: 1 addition & 0 deletions tests/unittests/image/test_ssim.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def _skimage_ssim(
sigma=sigma,
use_sample_covariance=False,
full=return_ssim_image,
channel_axis=-1,
)
results[i] = torch.from_numpy(np.asarray(res)).type(preds.dtype)
return results if reduction_arg != "sum" else results.sum()
Expand Down
1 change: 1 addition & 0 deletions tests/unittests/image/test_uqi.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def _skimage_uqi(preds, target, data_range, multichannel, kernel_size):
win_size=kernel_size,
sigma=1.5,
use_sample_covariance=False,
channel_axis=-1,
)


Expand Down

0 comments on commit 5a5ea53

Please sign in to comment.