Skip to content

Commit 04771fa

Browse files
authored
Merge branch 'master' into feature/1947_load_disparity
2 parents ffe9c85 + 23719e3 commit 04771fa

File tree

8 files changed

+36
-10
lines changed

8 files changed

+36
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
7575
- Fixed that metrics do not store computational graph for all seen data ([#4313](https://github.com/PyTorchLightning/pytorch-lightning/pull/4313))
7676
- Fixed AMP unscale for `on_after_backward` ([#4439](https://github.com/PyTorchLightning/pytorch-lightning/pull/4439))
7777
- Fixed TorchScript export when module includes Metrics ([#4428](https://github.com/PyTorchLightning/pytorch-lightning/pull/4428))
78+
- Fixed TorchScript trace method's data to device and docstring ([#4360](https://github.com/PyTorchLightning/pytorch-lightning/pull/4360))
7879
- Fixed CSV logger warning ([#4419](https://github.com/PyTorchLightning/pytorch-lightning/pull/4419))
7980
- Fixed skip DDP parameter sync ([#4301](https://github.com/PyTorchLightning/pytorch-lightning/pull/4301))
8081

dockers/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ or with specific arguments
1414
```bash
1515
git clone <git-repository>
1616
docker image build \
17-
-t pytorch-lightning:py3.8 \
18-
-f dockers/conda/Dockerfile \
17+
-t pytorch-lightning:py3.8-pt1.6 \
18+
-f dockers/base-cuda/Dockerfile \
1919
--build-arg PYTHON_VERSION=3.8 \
20-
--build-arg PYTORCH_VERSION=1.4 \
20+
--build-arg PYTORCH_VERSION=1.6 \
2121
.
2222
```
2323

dockers/base-conda/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ SHELL ["/bin/bash", "-c"]
3535

3636
ENV PATH="$PATH:/root/.local/bin"
3737

38-
RUN apt-get update && apt-get install -y --no-install-recommends \
38+
RUN apt-get update -qq && \
39+
apt-get install -y --no-install-recommends \
3940
build-essential \
4041
cmake \
4142
git \
@@ -104,6 +105,7 @@ RUN \
104105
# Install remaining requirements
105106
pip install -r requirements-extra.txt --upgrade-strategy only-if-needed && \
106107
pip install -r requirements-test.txt --upgrade-strategy only-if-needed && \
108+
pip install --extra-index-url https://developer.download.nvidia.com/compute/redist nvidia-dali-cuda${CUDA_VERSION%%.*}0 && \
107109
rm requirements*
108110

109111
RUN \
@@ -118,4 +120,4 @@ RUN \
118120
conda info && \
119121
pip list && \
120122
python -c "import sys; assert sys.version[:3] == '$PYTHON_VERSION', sys.version" && \
121-
python -c "import torch; assert torch.__version__[:3] == '$PYTORCH_VERSION', torch.__version__"
123+
python -c "import torch; assert torch.__version__[:3] == '$PYTORCH_VERSION', torch.__version__"

dockers/base-cuda/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ FROM nvidia/cuda:${CUDA_VERSION}-cudnn${CUDNN_VERSION}-devel-ubuntu18.04
2828

2929
ARG PYTHON_VERSION=3.7
3030
ARG PYTORCH_VERSION=1.6
31+
ARG CMAKE_VERSION=3.18.4
3132

3233
SHELL ["/bin/bash", "-c"]
3334
# https://techoverflow.net/2019/05/18/how-to-fix-configuring-tzdata-interactive-input-when-building-docker-images/
@@ -37,7 +38,7 @@ ENV TZ=Europe/Prague
3738
ENV PATH="$PATH:/root/.local/bin"
3839
ENV CUDA_TOOLKIT_ROOT_DIR="/usr/local/cuda"
3940

40-
RUN apt-get update && \
41+
RUN apt-get update -qq && \
4142
apt-get install -y --no-install-recommends \
4243
build-essential \
4344
pkg-config \
@@ -93,6 +94,7 @@ RUN \
9394

9495
# Install all requirements
9596
pip install -r requirements/devel.txt --upgrade-strategy only-if-needed --use-feature=2020-resolver && \
97+
pip install --extra-index-url https://developer.download.nvidia.com/compute/redist nvidia-dali-cuda${CUDA_VERSION%%.*}0 && \
9698
rm -rf requirements*
9799

98100
RUN \
@@ -105,5 +107,6 @@ RUN \
105107
# Show what we have
106108
pip --version && \
107109
pip list && \
110+
python -c 'from nvidia.dali.pipeline import Pipeline' && \
108111
python -c "import sys; assert sys.version[:3] == '$PYTHON_VERSION', sys.version" && \
109-
python -c "import torch; assert torch.__version__[:3] == '$PYTORCH_VERSION', torch.__version__"
112+
python -c "import torch; assert torch.__version__[:3] == '$PYTORCH_VERSION', torch.__version__"

dockers/base-xla/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ ENV CONDA_ENV=lightning
3131
# show system inforation
3232
RUN lsb_release -a && cat /etc/*-release
3333

34-
RUN apt-get update && \
34+
RUN apt-get update -qq && \
3535
apt-get install -y --no-install-recommends \
3636
build-essential \
3737
cmake \

docs/source/community_examples.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ Community Examples
1616
- `VAE Library of over 18+ VAE flavors <https://github.com/AntixK/PyTorch-VAE>`_.
1717
- `Transformers Question Answering (SQuAD) <https://github.com/tshrjn/Finetune-QA/>`_.
1818
- `Atlas: End-to-End 3D Scene Reconstruction from Posed Images <https://github.com/magicleap/atlas>`_.
19-
- `Self-Supervised Representation Learning (MoCo and BYOL) <https://github.com/untitled-ai/self_supervised>`_.
19+
- `Self-Supervised Representation Learning (MoCo and BYOL) <https://github.com/untitled-ai/self_supervised>`_.
20+
- `pytorch-forecasting: Time series forecasting package <https://github.com/jdb78/pytorch-forecasting>`_.

docs/source/metrics.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,26 @@ If ``on_epoch`` is True, the logger automatically logs the end of epoch metric v
7878
self.valid_acc(logits, y)
7979
self.log('valid_acc', self.valid_acc, on_step=True, on_epoch=True)
8080
81+
.. note::
82+
If using metrics in data parallel mode (dp), the metric update/logging should be done
83+
in the ``<mode>_step_end`` method (where ``<mode>`` is either ``training``, ``validation``
84+
or ``test``). This is due to metric states else being destroyed after each forward pass,
85+
leading to wrong accumulation. In practice do the following:
86+
87+
.. code-block:: python
88+
89+
def training_step(self, batch, batch_idx):
90+
data, target = batch
91+
pred = self(data)
92+
...
93+
return {'loss' : loss, 'preds' : preds, 'target' : target}
94+
95+
def training_step_end(self, outputs):
96+
#update and log
97+
self.metric(outputs['preds'], outputs['target'])
98+
self.log('metric', self.metric)
99+
100+
81101
This metrics API is independent of PyTorch Lightning. Metrics can directly be used in PyTorch as shown in the example:
82102

83103
.. code-block:: python

pytorch_lightning/core/lightning.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,6 @@ def _verify_is_manual_optimization(self, fn_name):
13991399

14001400
@classmethod
14011401
def _auto_collect_arguments(cls, frame=None) -> Tuple[Dict, Dict]:
1402-
""""""
14031402
"""
14041403
Collect all module arguments in the current constructor and all child constructors.
14051404
The child constructors are all the ``__init__`` methods that reach the current class through

0 commit comments

Comments
 (0)