Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…lightning

pull latest code
  • Loading branch information
Shuying Sun committed Mar 23, 2021
2 parents 89f284d + 51b10f7 commit 80cfbff
Show file tree
Hide file tree
Showing 118 changed files with 1,907 additions and 5,159 deletions.
18 changes: 2 additions & 16 deletions .github/workflows/ci_dockers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

# https://github.com/docker/setup-buildx-action
# Set up Docker Buildx - to use cache-from and cache-to argument of buildx command
- uses: docker/setup-buildx-action@v1
- name: Build PL Docker
# publish master/release
uses: docker/build-push-action@v2
Expand All @@ -54,9 +51,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

# https://github.com/docker/setup-buildx-action
# Set up Docker Buildx - to use cache-from and cache-to argument of buildx command
- uses: docker/setup-buildx-action@v1
- name: Build XLA Docker
# publish master/release
uses: docker/build-push-action@v2
Expand Down Expand Up @@ -93,9 +87,6 @@ jobs:
echo "::set-output name=CUDA::$cuda"
id: extend
# https://github.com/docker/setup-buildx-action
# Set up Docker Buildx - to use cache-from and cache-to argument of buildx command
- uses: docker/setup-buildx-action@v1
- name: Build CUDA Docker
# publish master/release
uses: docker/build-push-action@v2
Expand Down Expand Up @@ -130,9 +121,6 @@ jobs:
echo "::set-output name=CUDA::$cuda"
id: extend
# https://github.com/docker/setup-buildx-action
# Set up Docker Buildx - to use cache-from and cache-to argument of buildx command
- uses: docker/setup-buildx-action@v1
- name: Build CUDA Docker
# publish master/release
uses: docker/build-push-action@v2
Expand All @@ -150,10 +138,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
# https://github.com/docker/setup-buildx-action
# Set up Docker Buildx - to use cache-from and cache-to argument of buildx command
- uses: docker/setup-buildx-action@v1
- name: Build CUDA Docker

- name: Build NVIDIA Docker
uses: docker/build-push-action@v2
with:
file: dockers/nvidia/Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
# First run the same pipeline as Read-The-Docs
cd docs
make clean
make html --debug --jobs $(nproc) SPHINXOPTS="-W"
make html --debug --jobs $(nproc) SPHINXOPTS="-W --keep-going"
- name: Upload built docs
uses: actions/upload-artifact@v2
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/events-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,26 @@ jobs:
push: true
tags: pytorchlightning/pytorch_lightning:base-conda-py${{ matrix.python_version }}-torch${{ matrix.pytorch_version }}
timeout-minutes: 55

# docker-nvidia:
# runs-on: ubuntu-20.04
# steps:
# - name: Checkout
# uses: actions/checkout@v2
#
# # https://github.com/docker/setup-buildx-action
# # Set up Docker Buildx - to use cache-from and cache-to argument of buildx command
# - uses: docker/setup-buildx-action@v1
# - name: Login to DockerHub
# uses: docker/login-action@v1
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
#
# - name: Publish NVIDIA to Docker Hub
# uses: docker/build-push-action@v2
# with:
# file: dockers/nvidia/Dockerfile
# push: true
# tags: nvcr.io/pytorchlightning/pytorch_lightning:nvidia
# timeout-minutes: 55
26 changes: 25 additions & 1 deletion .github/workflows/release-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
types: [created]

jobs:
build-PL:
cuda-PL:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
Expand Down Expand Up @@ -36,3 +36,27 @@ jobs:
build_args: PYTHON_VERSION=${{ matrix.python_version }},PYTORCH_VERSION=${{ matrix.pytorch_version }},LIGHTNING_VERSION=${{ steps.get_version.outputs.RELEASE_VERSION }}
tags: "${{ steps.get_version.outputs.RELEASE_VERSION }}-py${{ matrix.python_version }}-torch${{ matrix.pytorch_version }},latest-py${{ matrix.python_version }}-torch${{ matrix.pytorch_version }}"
timeout-minutes: 55

# nvidia-PL:
# runs-on: ubuntu-20.04
# steps:
# - name: Checkout
# uses: actions/checkout@v2
#
# - name: Get release version
# if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'release'
# id: get_version
# run: echo "::set-output name=RELEASE_VERSION::$(echo ${GITHUB_REF##*/})"
#
# - name: Publish Releases to Docker
# # only on releases
# uses: docker/[email protected]
# if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'release'
# with:
# repository: nvcr.io/pytorchlightning/pytorch_lightning
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
# dockerfile: dockers/nvidia/Dockerfile
# build_args: LIGHTNING_VERSION=${{ steps.get_version.outputs.RELEASE_VERSION }}
# tags: "${{ steps.get_version.outputs.RELEASE_VERSION }}-nvidia"
# timeout-minutes: 55
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,4 @@ tags
data
MNIST
runs
*trace*
5 changes: 0 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,3 @@ repos:
hooks:
- id: yapf
args: [--parallel, --in-place]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.790
hooks:
- id: mypy
50 changes: 47 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

### Added

- Added `RetrievalMAP` metric, the corresponding functional version `retrieval_average_precision` and a generic superclass for retrieval metrics `RetrievalMetric` ([#5032](https://github.com/PyTorchLightning/pytorch-lightning/pull/5032))


- Added a way to print to terminal without breaking up the progress bar ([#5470](https://github.com/PyTorchLightning/pytorch-lightning/pull/5470))


- Added support to checkpoint after training steps in `ModelCheckpoint` callback ([#6146](https://github.com/PyTorchLightning/pytorch-lightning/pull/6146))


- Added `checkpoint` parameter to callback's `on_save_checkpoint` hook ([#6072](https://github.com/PyTorchLightning/pytorch-lightning/pull/6072))


Expand All @@ -37,11 +37,25 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added arg to `self.log` that enables users to give custom names when dealing with multiple dataloaders ([#6274](https://github.com/PyTorchLightning/pytorch-lightning/pull/6274))


- Added `teardown` method to `BaseProfiler` to enable subclasses defining post-profiling steps outside of `__del__` ([#6370](https://github.com/PyTorchLightning/pytorch-lightning/pull/6370))


- Added `setup` method to `BaseProfiler` to enable subclasses defining pre-profiling steps for every process ([#6633](https://github.com/PyTorchLightning/pytorch-lightning/pull/6633))


- Added no return warning to predict ([#6139](https://github.com/PyTorchLightning/pytorch-lightning/pull/6139))


- Added `outputs` parameter to callback's `on_validation_epoch_end` & `on_test_epoch_end` hooks ([#6120](https://github.com/PyTorchLightning/pytorch-lightning/pull/6120))
- Added `Trainer.predict` config validation ([#6543](https://github.com/PyTorchLightning/pytorch-lightning/pull/6543))


- Added `AbstractProfiler` interface ([#6621](https://github.com/PyTorchLightning/pytorch-lightning/pull/6621))


- Added support for including module names for forward in the autograd trace of `PyTorchProfiler` ([#6349](https://github.com/PyTorchLightning/pytorch-lightning/pull/6349))


- Added `outputs` parameter to callback's `on_validation_epoch_end` & `on_test_epoch_end` hooks ([#6120](https://github.com/PyTorchLightning/pytorch-lightning/pull/6120))


### Changed
Expand All @@ -58,6 +72,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Changed `setup()` and `teardown()` stage argument to take any of `{fit,validate,test,predict}` ([#6386](https://github.com/PyTorchLightning/pytorch-lightning/pull/6386))


- Changed profilers to save separate report files per state and rank ([#6621](https://github.com/PyTorchLightning/pytorch-lightning/pull/6621))


- Changed `PyTorchProfiler` to use `torch.autograd.profiler.record_function` to record functions ([#6349](https://github.com/PyTorchLightning/pytorch-lightning/pull/6349))


### Deprecated

- `period` has been deprecated in favor of `every_n_val_epochs` in the `ModelCheckpoint` callback ([#6146](https://github.com/PyTorchLightning/pytorch-lightning/pull/6146))
Expand All @@ -66,6 +86,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Deprecated `trainer.running_sanity_check` in favor of `trainer.sanity_checking` ([#4945](https://github.com/PyTorchLightning/pytorch-lightning/pull/4945))


- Deprecated `Profiler(output_filename)` in favor of `dirpath` and `filename` ([#6621](https://github.com/PyTorchLightning/pytorch-lightning/pull/6621))


- Deprecated `PytorchProfiler(profiled_functions)` in favor of `record_functions` ([#6349](https://github.com/PyTorchLightning/pytorch-lightning/pull/6349))


- Deprecated metrics in favor of `torchmetrics` ([#6505](https://github.com/PyTorchLightning/pytorch-lightning/pull/6505),

[#6530](https://github.com/PyTorchLightning/pytorch-lightning/pull/6530),
Expand All @@ -78,6 +104,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

[#6573](https://github.com/PyTorchLightning/pytorch-lightning/pull/6573),

[#6584](https://github.com/PyTorchLightning/pytorch-lightning/pull/6584),

[#6636](https://github.com/PyTorchLightning/pytorch-lightning/pull/6636),

[#6637](https://github.com/PyTorchLightning/pytorch-lightning/pull/6637),

)


Expand Down Expand Up @@ -114,6 +146,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

### Fixed

- Added Autocast in validation, test and predict modes for Native AMP ([#6565](https://github.com/PyTorchLightning/pytorch-lightning/pull/6565))


- Made the `Plugin.reduce` method more consistent across all Plugins to reflect a mean-reduction by default ([#6011](https://github.com/PyTorchLightning/pytorch-lightning/pull/6011))


Expand Down Expand Up @@ -141,9 +176,18 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Fixed LightningModule `all_gather` on cpu tensors ([#6416](https://github.com/PyTorchLightning/pytorch-lightning/pull/6416))


- Fixed a bug where `all_gather` would not work correctly with `tpu_cores=8` ([#6587](https://github.com/PyTorchLightning/pytorch-lightning/pull/6587))


- Update Gradient Clipping for the TPU Accelerator ([#6576](https://github.com/PyTorchLightning/pytorch-lightning/pull/6576))


- Fixed torch distributed not available in setup hook for DDP ([#6506](https://github.com/PyTorchLightning/pytorch-lightning/pull/6506))


- Fixed comparing required versions ([#6434](https://github.com/PyTorchLightning/pytorch-lightning/pull/6434))


## [1.2.4] - 2021-03-16

### Changed
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ test: clean

docs: clean
pip install --quiet -r requirements/docs.txt
python -m sphinx -b html -W docs/source docs/build
python -m sphinx -b html -W --keep-going docs/source docs/build
12 changes: 7 additions & 5 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,14 @@ jobs:
python -m pytest benchmarks -v --maxfail=2 --durations=0
displayName: 'Testing: benchmarks'
- bash: |
- script: |
set -e
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
# cd pl_examples/basic_examples
# bash submit_ddp_job.sh
# bash submit_ddp2_job.sh
env:
PL_USE_MOCKED_MNIST: "1"
displayName: 'Examples'
19 changes: 10 additions & 9 deletions dockers/nvidia/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM nvcr.io/nvidia/pytorch:20.12-py3
FROM nvcr.io/nvidia/pytorch:21.02-py3

MAINTAINER PyTorchLightning <https://github.com/PyTorchLightning>

Expand All @@ -22,16 +22,17 @@ COPY ./ ./pytorch-lightning/

# install dependencies
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 ; \
pip list | grep torch && \
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
1 change: 0 additions & 1 deletion dockers/release/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ COPY ./ ./pytorch-lightning/

# install dependencies
RUN \
# Disable cache
#conda install "pip>20.1" && \
if [ ! -z "$LIGHTNING_VERSION" ] ; then \
rm -rf pytorch-lightning ; \
Expand Down
2 changes: 1 addition & 1 deletion docs/source/advanced/multi_gpu.rst
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ Lightning allows multiple ways of training
- TPUs (``tpu_cores=8|x``) (tpu or TPU pod)

.. note::
If you request multiple GPUs or nodes without setting a mode, DDP will be automatically used.
If you request multiple GPUs or nodes without setting a mode, DDP Spawn will be automatically used.

For a deeper understanding of what Lightning is doing, feel free to read this
`guide <https://medium.com/@_willfalcon/9-tips-for-training-lightning-fast-neural-networks-in-pytorch-8e63a502f565>`_.
Expand Down
24 changes: 14 additions & 10 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.

# import m2r
import builtins
import glob
import os
import shutil
Expand All @@ -27,10 +26,13 @@

FOLDER_GENERATED = 'generated'
SPHINX_MOCK_REQUIREMENTS = int(os.environ.get('SPHINX_MOCK_REQUIREMENTS', True))
if SPHINX_MOCK_REQUIREMENTS:
builtins.__LIGHTNING_SETUP__ = True

import pytorch_lightning # noqa: E402
try:
from pytorch_lightning import info
except ImportError:
# alternative https://stackoverflow.com/a/67692/4521646
sys.path.append(os.path.join(PATH_ROOT, "pytorch_lightning"))
import info

# -- Project documents -------------------------------------------------------

Expand Down Expand Up @@ -79,13 +81,13 @@ def _transform_changelog(path_in: str, path_out: str) -> None:
# -- Project information -----------------------------------------------------

project = 'PyTorch Lightning'
copyright = pytorch_lightning.__copyright__
author = pytorch_lightning.__author__
copyright = info.__copyright__
author = info.__author__

# The short X.Y version
version = pytorch_lightning.__version__
version = info.__version__
# The full version, including alpha/beta/rc tags
release = pytorch_lightning.__version__
release = info.__version__

# -- General configuration ---------------------------------------------------

Expand Down Expand Up @@ -176,8 +178,8 @@ def _transform_changelog(path_in: str, path_out: str) -> None:
# documentation.

html_theme_options = {
'pytorch_project': pytorch_lightning.__homepage__,
'canonical_url': pytorch_lightning.__homepage__,
'pytorch_project': info.__homepage__,
'canonical_url': info.__homepage__,
'collapse_navigation': False,
'display_version': True,
'logo_only': False,
Expand Down Expand Up @@ -279,6 +281,7 @@ def _transform_changelog(path_in: str, path_out: str) -> None:
'torch': ('https://pytorch.org/docs/stable/', None),
'numpy': ('https://numpy.org/doc/stable/', None),
'PIL': ('https://pillow.readthedocs.io/en/stable/', None),
'torchmetrics': ('https://torchmetrics.readthedocs.io/en/stable/', None),
}

# -- Options for todo extension ----------------------------------------------
Expand Down Expand Up @@ -331,6 +334,7 @@ def package_list_from_file(file):
}
MOCK_PACKAGES = []
if SPHINX_MOCK_REQUIREMENTS:
MOCK_PACKAGES += ['fairscale']
# mock also base packages when we are on RTD since we don't install them there
MOCK_PACKAGES += package_list_from_file(os.path.join(PATH_ROOT, 'requirements.txt'))
MOCK_PACKAGES += package_list_from_file(os.path.join(PATH_ROOT, 'requirements', 'extra.txt'))
Expand Down
Loading

0 comments on commit 80cfbff

Please sign in to comment.