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

[release] Weekly Patch Release v.1.2.3 [full merge, no squash] #6431

Merged
merged 19 commits into from
Mar 9, 2021
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
cf9e408
Fix ModelPruning(make_pruning_permanent=True) buffers getting removed…
carmocca Mar 3, 2021
de0efa9
Update docs on arg train_dataloader in fit (#6076)
SkafteNicki Mar 4, 2021
5f9bb9d
Fix when _stable_1d_sort to work when n >= N (#6177)
frankier Mar 4, 2021
317043d
Fix AttributeError: 'NoneType' object has no attribute 'finalize' on…
chizuchizu Mar 8, 2021
f2a913a
[bug] Fix Pytorch profiler with emit_nvtx (#6260)
tchaton Mar 5, 2021
96c7f4b
[bugfix] TPU test hangs to barrier on 1 process (#6272)
tchaton Mar 2, 2021
92c545b
resolve tests & update
tchaton Mar 9, 2021
8578ffa
[bugfix] TPU + all_gather + SingleTPU shouldn't call xm.all_gather (#…
tchaton Mar 3, 2021
3c99bfd
[fix] Ensure we check deepspeed/sharded in multinode DDP (#6297)
SeanNaren Mar 2, 2021
5be327d
[bugfix] Check LightningOptimizer doesn't delete optimizer hooks (#6305)
tchaton Mar 4, 2021
23e12ed
hotfix for PT1.6 and torchtext (#6323)
Borda Mar 4, 2021
22348ef
[bugfix] Resolve memory leak for evaluation (#6326)
tchaton Mar 5, 2021
d0e7ca3
[Fix] Call clip gradients if clip val greater than 0 (#6330)
SeanNaren Mar 4, 2021
48482da
CI: fix examples - patch download MNIST (#6357)
Borda Mar 5, 2021
87c86ce
require: adjust versions (#6363)
Borda Mar 6, 2021
fa99157
fix importing torchtext batch (#6365)
Borda Mar 5, 2021
cccf7de
Fix trainer not resetting lightning_optimizers (#6372)
awaelchli Mar 8, 2021
a57a606
update python version (#6399)
awaelchli Mar 8, 2021
cdbb898
v1.2.3 & test past ckpts
Borda Mar 9, 2021
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
10 changes: 3 additions & 7 deletions .github/workflows/ci_test-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,20 @@ jobs:
run: |
conda info
conda list
# adjust versions according installed Torch version
python ./requirements/adjust_versions.py requirements/extra.txt
python ./requirements/adjust_versions.py requirements/examples.txt
pip install --requirement requirements/devel.txt --upgrade-strategy only-if-needed
pip list

- name: Pull checkpoints from S3
# todo: consider adding coma caching, but ATM all models have less then 100KB
run: |
# enter legacy and update checkpoints from S3
cd legacy
curl https://pl-public-data.s3.amazonaws.com/legacy/checkpoints.zip --output checkpoints.zip
unzip -o checkpoints.zip
ls -l checkpoints/

# todo: require proper fix in docker image
- name: Hotfix dependency
run: |
pip install torchtext==0.6.0 -U
shell: bash

- name: Tests
run: |
# NOTE: run coverage on tests does not propagare faler status for Win, https://github.com/nedbat/coveragepy/issues/1003
Expand Down
22 changes: 9 additions & 13 deletions .github/workflows/ci_test-full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,17 @@ jobs:
HOROVOD_WITHOUT_MXNET: 1
HOROVOD_WITHOUT_TENSORFLOW: 1
run: |
# python -m pip install --upgrade --user pip
pip install --requirement requirements.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --quiet --upgrade
pip install --requirement ./requirements/devel.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --quiet --upgrade
python --version
pip --version
# python -m pip install --upgrade --user pip
pip install --requirement requirements.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --upgrade
# adjust versions according installed Torch version
python ./requirements/adjust_versions.py requirements/extra.txt
python ./requirements/adjust_versions.py requirements/examples.txt
pip install --requirement ./requirements/devel.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --upgrade
pip list
shell: bash

# todo: require proper fix in docker image
- name: Hotfix dependency
run: |
pip install torchtext==0.6.0 -U
shell: bash

- name: Reinstall Horovod if necessary
if: runner.os != 'windows'
env:
Expand All @@ -143,10 +140,9 @@ jobs:
# NOTE: do not include coverage report here, see: https://github.com/nedbat/coveragepy/issues/1003
coverage run --source pytorch_lightning -m pytest pytorch_lightning tests -v --durations=50 --junitxml=junit/test-results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}.xml

# todo: put this back just when TorchVision can download datasets
#- name: Examples
# run: |
# python -m pytest pl_examples -v --durations=10
- name: Examples
run: |
python -m pytest pl_examples -v --durations=10

- name: Upload pytest test results
uses: actions/upload-artifact@v2
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/docs-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ jobs:

- name: Install dependencies
run: |
python --version
pip --version
# remove Horovod from requirements
python -c "fname = 'requirements/extra.txt' ; lines = [line for line in open(fname).readlines() if not line.startswith('horovod')] ; open(fname, 'w').writelines(lines)"
# python -m pip install --upgrade --user pip
pip install --requirement requirements.txt --upgrade-strategy only-if-needed --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --quiet
pip install --requirement requirements/extra.txt
pip install --requirement requirements/loggers.txt
pip install --requirement requirements/docs.txt
python --version
pip --version
pip list
shell: bash

Expand Down Expand Up @@ -84,12 +84,12 @@ jobs:

- name: Install dependencies
run: |
pip install --requirement requirements.txt --upgrade-strategy only-if-needed --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --quiet
python --version
pip --version
# pip install --requirement requirements.txt --upgrade-strategy only-if-needed --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --quiet
pip install --requirement requirements/docs.txt
# 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
python --version
pip --version
pip list
shell: bash

Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/events-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ jobs:
id: extend

- name: Publish CUDA to Docker Hub
# ToDo: extend also building for Nightly from pip
if: matrix.pytorch_version < 1.8
# publish master/release
uses: docker/build-push-action@v2
with:
Expand Down
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,49 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).


## [1.2.3] - 2021-03-09

### Added


### Changed


### Fixed

- Fixed `ModelPruning(make_pruning_permanent=True)` pruning buffers getting removed when saved during training ([#6073](https://github.com/PyTorchLightning/pytorch-lightning/pull/6073))

Borda marked this conversation as resolved.
Show resolved Hide resolved

- Fixed when `_stable_1d_sort` to work when `n >= N` ([#6177](https://github.com/PyTorchLightning/pytorch-lightning/pull/6177))


- Fixed `AttributeError` when `logger=None` on TPU ([#6221](https://github.com/PyTorchLightning/pytorch-lightning/pull/6221))


- Fixed PyTorch Profiler with `emit_nvtx` ([#6260](https://github.com/PyTorchLightning/pytorch-lightning/pull/6260))


- Fixed `trainer.test` from `best_path` hangs after calling `trainer.fit` ([#6272](https://github.com/PyTorchLightning/pytorch-lightning/pull/6272))


- Fixed `SingleTPU` calling `all_gather` ([#6296](https://github.com/PyTorchLightning/pytorch-lightning/pull/6296))


- Ensure we check deepspeed/sharded in multinode DDP ([#6297](https://github.com/PyTorchLightning/pytorch-lightning/pull/6297)


- Check `LightningOptimizer` doesn't delete optimizer hooks ([#6305](https://github.com/PyTorchLightning/pytorch-lightning/pull/6305)


- Resolve memory leak for evaluation ([#6326](https://github.com/PyTorchLightning/pytorch-lightning/pull/6326)


- Ensure that clip gradients is only called if the value is greater than 0 ([#6330](https://github.com/PyTorchLightning/pytorch-lightning/pull/6330)


- Fixed `Trainer` not resetting `lightning_optimizers` when calling `Trainer.fit()` multiple times ([#6372](https://github.com/PyTorchLightning/pytorch-lightning/pull/6372))
Borda marked this conversation as resolved.
Show resolved Hide resolved


## [1.2.2] - 2021-03-02

### Added
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ recursive-include docs/source/_static/images/general/ pl_overview* tf_* tutorial

# Include the Requirements
recursive-include requirements *.txt
recursive-exclude requirements *.sh
recursive-exclude requirements *.sh *.py
include requirements.txt
include pyproject.toml

Expand Down
21 changes: 9 additions & 12 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@ jobs:
python -c "import torch ; mgpu = torch.cuda.device_count() ; assert mgpu >= 2, f'GPU: {mgpu}'"
displayName: 'Env details'

# todo: require proper fix in docker image
- bash: |
pip install torchtext==0.7 -U
displayName: 'HotFix'

- bash: |
wget https://pl-public-data.s3.amazonaws.com/legacy/checkpoints.zip -P legacy/
unzip -o legacy/checkpoints.zip -d legacy/
Expand All @@ -100,10 +95,12 @@ jobs:
python -m pytest benchmarks -v --maxfail=2 --durations=0
displayName: 'Testing: benchmarks'

# todo: put this back just when TorchVision can download datasets
#- bash: |
# python -m pytest pl_examples -v --maxfail=2 --durations=0
# python setup.py install --user --quiet
# bash pl_examples/run_ddp-example.sh
# pip uninstall -y pytorch-lightning
# displayName: 'Examples'
- bash: |
python -m pytest pl_examples -v --maxfail=2 --durations=0
python setup.py install --user --quiet
bash pl_examples/run_ddp-example.sh
cd pl_examples/basic_examples
bash submit_ddp_job.sh
bash submit_ddp2_job.sh
pip uninstall -y pytorch-lightning
displayName: 'Examples'
2 changes: 2 additions & 0 deletions dockers/base-conda/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,12 @@ ENV \

COPY ./requirements/extra.txt requirements-extra.txt
COPY ./requirements/test.txt requirements-test.txt
COPY ./requirements/adjust_versions.py requirements_adjust_versions.py

RUN \
pip list | grep torch && \
python -c "import torch; print(torch.__version__)" && \
python requirements_adjust_versions.py requirements-extra.txt && \
# Install remaining requirements
pip install -r requirements-extra.txt --no-cache-dir && \
pip install -r requirements-test.txt --no-cache-dir && \
Expand Down
8 changes: 5 additions & 3 deletions dockers/base-cuda/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,14 @@ RUN \
# eventualy use pre-release
#pip install "torch==${PYTORCH_VERSION}.*" --pre && \
# set particular PyTorch version
python -c "import re ; fname = 'requirements.txt' ; req = re.sub(r'torch[>=]+[\d\.]+', 'torch==${PYTORCH_VERSION}.*', open(fname).read()) ; open(fname, 'w').write(req)" && \
python ./requirements/adjust_versions.py requirements.txt ${PYTORCH_VERSION} && \
python ./requirements/adjust_versions.py requirements/extra.txt ${PYTORCH_VERSION} && \
python ./requirements/adjust_versions.py requirements/examples.txt ${PYTORCH_VERSION} && \
# Install all requirements
# todo: find a way how to install nightly PT version
# --pre --extra-index-url https://download.pytorch.org/whl/nightly/cu${cuda_ver[0]}${cuda_ver[1]}/torch_nightly.html
pip install -r requirements/devel.txt --no-cache-dir && \
rm -rf requirements*
rm -rf requirements.* requirements/

RUN \
# install DALI, needed for examples
Expand All @@ -113,7 +115,7 @@ RUN \

RUN \
# install DeepSpeed from source.
# todo: swap to pypi release once DeepSpeed releases a new version.
# todo: swap to pypi release once DeepSpeed releases a new version >= 0.3.10
pip install deepspeed@git+https://github.com/microsoft/DeepSpeed@ec8b1cb

RUN \
Expand Down
1 change: 1 addition & 0 deletions dockers/base-xla/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ RUN \
python -c "fname = 'requirements/extra.txt' ; lines = [line for line in open(fname).readlines() if 'fairscale' not in line] ; open(fname, 'w').writelines(lines)" && \
# drop TorchVision as it was installed with XLA
python -c "fname = 'requirements/examples.txt' ; lines = [line for line in open(fname).readlines() if not line.startswith('torchvision')] ; open(fname, 'w').writelines(lines)" && \
python ./requirements/adjust_versions.py ./requirements/extra.txt && \
pip install --requirement ./requirements/devel.txt --no-cache-dir && \
cd .. && \
rm -rf pytorch-lightning && \
Expand Down
15 changes: 8 additions & 7 deletions dockers/release/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ COPY ./ ./pytorch-lightning/
RUN \
# Disable cache
#conda install "pip>20.1" && \
#pip config set global.cache-dir false && \
if [ -z $LIGHTNING_VERSION ] ; then \
pip install ./pytorch-lightning --no-cache-dir ; \
if [ ! -z "$LIGHTNING_VERSION" ] ; then \
rm -rf pytorch-lightning ; \
else \
rm -rf pytorch-lightning ; \
pip install https://github.com/PyTorchLightning/pytorch-lightning/archive/${LIGHTNING_VERSION}.zip --no-cache-dir ; \
fi
wget https://github.com/PyTorchLightning/pytorch-lightning/archive/${LIGHTNING_VERSION}.zip --progress=bar:force:noscroll ; \
unzip ${LIGHTNING_VERSION}.zip ; \
mv pytorch-lightning-*/ pytorch-lightning ; \
rm *.zip ; \
fi && \
pip install ./pytorch-lightning["extra"] --no-cache-dir && \
rm -rf pytorch-lightning

RUN python --version && \
pip --version && \
Expand Down
23 changes: 23 additions & 0 deletions docs/source/advanced/multiple_loaders.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Lightning supports multiple dataloaders in a few ways.

----------

.. _multiple-training-dataloaders:

Multiple training dataloaders
-----------------------------
For training, the usual way to use multiple dataloaders is to create a ``DataLoader`` class
Expand Down Expand Up @@ -86,6 +88,27 @@ For more details please have a look at :attr:`~pytorch_lightning.trainer.trainer

return loaders

Furthermore, Lightning also supports that nested lists and dicts (or a combination) can
be returned

.. testcode::

class LitModel(LightningModule):

def train_dataloader(self):

loader_a = torch.utils.data.DataLoader(range(8), batch_size=4)
loader_b = torch.utils.data.DataLoader(range(16), batch_size=4)
loader_c = torch.utils.data.DataLoader(range(32), batch_size=4)
loader_c = torch.utils.data.DataLoader(range(64), batch_size=4)

# pass loaders as a nested dict. This will create batches like this:
# {'loader_a_b': {'a': batch from loader a, 'b': batch from loader b},
# 'loader_c_d': {'c': batch from loader c, 'd': batch from loader d}}
loaders = {'loaders_a_b': {'a': loader_a, 'b': loader_b},
'loaders_c_d': {'c': loader_c, 'd': loader_d}}
return loaders

----------

Test/Val dataloaders
Expand Down
2 changes: 1 addition & 1 deletion notebooks/06-mnist-tpu-training.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"id": "AYGWh10lRaF1"
},
"source": [
"! pip install cloud-tpu-client==0.10 https://storage.googleapis.com/tpu-pytorch/wheels/torch_xla-1.7-cp36-cp36m-linux_x86_64.whl"
"! pip install cloud-tpu-client==0.10 https://storage.googleapis.com/tpu-pytorch/wheels/torch_xla-1.7-cp37-cp37m-linux_x86_64.whl"
],
"execution_count": null,
"outputs": []
Expand Down
16 changes: 16 additions & 0 deletions pl_examples/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
import os
from urllib.error import HTTPError

from six.moves import urllib

from pytorch_lightning.utilities import _module_available

# TorchVision hotfix https://github.com/pytorch/vision/issues/1938
opener = urllib.request.build_opener()
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
urllib.request.install_opener(opener)

_EXAMPLES_ROOT = os.path.dirname(__file__)
_PACKAGE_ROOT = os.path.dirname(_EXAMPLES_ROOT)
_DATASETS_PATH = os.path.join(_PACKAGE_ROOT, 'Datasets')

_TORCHVISION_AVAILABLE = _module_available("torchvision")
_TORCHVISION_MNIST_AVAILABLE = True
_DALI_AVAILABLE = _module_available("nvidia.dali")

if _TORCHVISION_AVAILABLE:
try:
from torchvision.datasets.mnist import MNIST
MNIST(_DATASETS_PATH, download=True)
except HTTPError:
_TORCHVISION_MNIST_AVAILABLE = False

LIGHTNING_LOGO = """
####
###########
Expand Down
4 changes: 2 additions & 2 deletions pl_examples/basic_examples/autoencoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
from torch.utils.data import DataLoader, random_split

import pytorch_lightning as pl
from pl_examples import _DATASETS_PATH, _TORCHVISION_AVAILABLE, cli_lightning_logo
from pl_examples import _DATASETS_PATH, _TORCHVISION_AVAILABLE, _TORCHVISION_MNIST_AVAILABLE, cli_lightning_logo

if _TORCHVISION_AVAILABLE:
if _TORCHVISION_AVAILABLE and _TORCHVISION_MNIST_AVAILABLE:
from torchvision import transforms
from torchvision.datasets.mnist import MNIST
else:
Expand Down
4 changes: 2 additions & 2 deletions pl_examples/basic_examples/backbone_image_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
from torch.utils.data import DataLoader, random_split

import pytorch_lightning as pl
from pl_examples import _DATASETS_PATH, _TORCHVISION_AVAILABLE, cli_lightning_logo
from pl_examples import _DATASETS_PATH, _TORCHVISION_AVAILABLE, _TORCHVISION_MNIST_AVAILABLE, cli_lightning_logo

if _TORCHVISION_AVAILABLE:
if _TORCHVISION_AVAILABLE and _TORCHVISION_MNIST_AVAILABLE:
from torchvision import transforms
from torchvision.datasets.mnist import MNIST
else:
Expand Down
12 changes: 9 additions & 3 deletions pl_examples/basic_examples/dali_image_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@
from torch.utils.data import random_split

import pytorch_lightning as pl
from pl_examples import _DALI_AVAILABLE, _DATASETS_PATH, _TORCHVISION_AVAILABLE, cli_lightning_logo

if _TORCHVISION_AVAILABLE:
from pl_examples import (
_DALI_AVAILABLE,
_DATASETS_PATH,
_TORCHVISION_AVAILABLE,
_TORCHVISION_MNIST_AVAILABLE,
cli_lightning_logo,
)

if _TORCHVISION_AVAILABLE and _TORCHVISION_MNIST_AVAILABLE:
from torchvision import transforms
from torchvision.datasets.mnist import MNIST
else:
Expand Down
Loading