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

Fix callback metrics for non-Tensor types #550

Closed
wants to merge 52 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
46e549c
Save and load hparams from checkpoints
neggert Oct 22, 2019
b1f6c49
Update docs
neggert Oct 22, 2019
9529aa6
Add warning when not saving hparams
neggert Oct 22, 2019
c9dbfef
Missing import
neggert Oct 22, 2019
7092b6c
Update .run_local_tests.sh
williamFalcon Oct 23, 2019
c5c03c8
Update lm_test_module_mixins.py
williamFalcon Oct 23, 2019
3a24662
Update lightning_module_template.py
williamFalcon Oct 23, 2019
f7dda50
Merge branch 'master' of https://github.com/williamFalcon/pytorch-lig…
williamFalcon Oct 23, 2019
3fcce57
Merge branch 'hparams_from_checkpoint' of https://github.com/neggert/…
williamFalcon Oct 23, 2019
35a0ba0
Merge branch 'master' of https://github.com/williamFalcon/pytorch-lig…
williamFalcon Oct 23, 2019
bc94fb8
Merge branch 'master' of https://github.com/williamFalcon/pytorch-lig…
williamFalcon Oct 23, 2019
25d6eb5
Merge branch 'master' of https://github.com/williamFalcon/pytorch-lig…
williamFalcon Oct 24, 2019
950e399
Merge branch 'master' of https://github.com/williamFalcon/pytorch-lig…
williamFalcon Nov 3, 2019
efe5f17
Merge branch 'master' of https://github.com/williamFalcon/pytorch-lig…
williamFalcon Nov 5, 2019
7c942c6
Merge branch 'master' of https://github.com/williamFalcon/pytorch-lig…
williamFalcon Nov 5, 2019
5910fa1
Merge branch 'master' of https://github.com/williamFalcon/pytorch-lig…
williamFalcon Nov 6, 2019
5142a96
Update logging_mixin.py
Jonny-GM Nov 26, 2019
55f3ffd
fixing bug in testing for IterableDataset (#547)
MikeScarp Nov 26, 2019
f2191b0
fix for pyTorch 1.2 (#549)
Borda Nov 26, 2019
fea7cc8
Move model to cuda before creating optimizer (#554)
akhti Nov 27, 2019
9785a3e
Refactor: name modules (#548)
Borda Nov 27, 2019
47659da
speed-up testing (#504)
Borda Nov 28, 2019
d71556e
Sphinx generated documentation (#521)
Borda Nov 28, 2019
29122e4
Dp default (#560)
williamFalcon Nov 28, 2019
6629897
Merge branch 'master' of https://github.com/williamFalcon/pytorch-lig…
williamFalcon Nov 29, 2019
db0587f
fixed tests
williamFalcon Nov 29, 2019
df7b6d9
Correct behavior for argument gpus in Trainer (#561)
mpariente Nov 30, 2019
2b8475f
Add resuming from specific checkpoint (#516)
dreamgonfly Nov 30, 2019
89ececb
fix for pyTorch 1.1 (#552)
Borda Dec 1, 2019
a6d64ac
Support torch.optim.lr_scheduler.ReduceLROnPlateau (#320)
vikmary Dec 3, 2019
62f6f92
Use pytest tmpdir fixture (#482)
neggert Dec 3, 2019
63717e8
prune tests (#564)
Borda Dec 4, 2019
3a58937
rename variables nb -> num (#567)
Borda Dec 4, 2019
ab4fea0
fix defecation warnings (#570)
Borda Dec 4, 2019
b5b77e4
fix logging error (#575)
wakandan Dec 4, 2019
d4571d1
filter param with no grad (#579)
Ir1d Dec 4, 2019
c316173
use print for INFO and lower levels summarize() (#580)
Ir1d Dec 4, 2019
218f0a5
inspect training_step for opt_idx (#573)
Dec 4, 2019
6ba30a1
fixed gan template (#528)
williamFalcon Dec 4, 2019
e0dbc8a
Abstract Mixin classes (#572)
Borda Dec 4, 2019
1d4b6be
rename trainer modules, drop `_mixin` (#571)
Borda Dec 4, 2019
6666ca5
add slack badge (#583)
Borda Dec 5, 2019
ed97231
update GitHub templates (#601)
Borda Dec 7, 2019
c374c4f
extend documentation (#569)
Borda Dec 7, 2019
0489e31
Fix CometML tests (#585)
neggert Dec 7, 2019
cc65f39
Fix number of total steps shown in progress bar during sanity validat…
YehCF Dec 7, 2019
f7e1040
Docs and Tests for "gpus" Trainer Argument (#593)
Dec 7, 2019
c6e0dbe
prevent Travis caching (#590)
Borda Dec 7, 2019
1051c18
Simplify variables: step, epoch, max_epochs, min_epochs (#589)
elliotwaite Dec 7, 2019
2f01c03
Additional hooks (#598)
Dec 7, 2019
88162ab
Update logging_mixin.py
Jonny-GM Nov 26, 2019
b669ab8
Merge branch 'patch-2' of https://github.com/ctlaltdefeat/pytorch-lig…
Jonny-GM Dec 7, 2019
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
21 changes: 20 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ references:
run:
name: Install Dependences
command: |
# PyPI
pip install "$TORCH_VERSION" --user
# this is temporal fix til test-tube is not merged and released
pip install -r requirements.txt --user
sudo pip install pytest pytest-cov pytest-flake8
pip install -r ./tests/requirements.txt --user
Expand All @@ -22,9 +22,27 @@ references:
command: |
python --version ; pip --version ; pip list
py.test pytorch_lightning tests pl_examples -v --doctest-modules --junitxml=test-reports/pytest_junit.xml --flake8
no_output_timeout: 15m

make_docs: &make_docs
run:
name: Make Documentation
command: |
# sudo apt-get install pandoc
pip install -r requirements.txt --user
sudo pip install -r docs/requirements.txt
# sphinx-apidoc -o ./docs/source ./pytorch_lightning **/test_* --force --follow-links
cd docs; make clean ; make html

jobs:

Build-Docs:
docker:
- image: circleci/python:3.7
steps:
- checkout
- *make_docs

PyTorch:
docker:
- image: circleci/python:3.7
Expand Down Expand Up @@ -66,6 +84,7 @@ workflows:
version: 2
build:
jobs:
- Build-Docs
- PyTorch-v1.1
- PyTorch-v1.2
- PyTorch-v1.3
26 changes: 16 additions & 10 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,32 @@ assignees: ''
1. Tensorboard not showing in Jupyter-notebook see [issue 79](https://github.com/williamFalcon/pytorch-lightning/issues/79).
2. PyTorch 1.1.0 vs 1.2.0 support [see FAQ](https://github.com/williamFalcon/pytorch-lightning#faq)

**Describe the bug**
### Describe the bug
A clear and concise description of what the bug is.

**To Reproduce**
#### To Reproduce
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
2. Run '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
#### Code sample
Ideally attach a minimal code sample to reproduce the decried issue.
[Minimal means having the shortest code but still preserving the bug]

#### Expected behavior
A clear and concise description of what you expected to happen.

**Screenshots**
#### Screenshots
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
### Environment information

Desktop (please complete the following information):
- OS: [e.g. iOS, Linux, Win]
- Packaging [e.g. pip, conda]
- Version [e.g. 0.5.2.1]

**Additional context**
### Additional context
Add any other context about the problem here.
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/typos-and-doc-fixes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ assignees: ''

---

## Typos and docs fixes

For typos and doc fixes, please go ahead and:

1. Create an issue.
2. Fix the typo.
3. Submit a PR.


Thanks!
11 changes: 8 additions & 3 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/source/conf.py

# Build documentation with MkDocs
mkdocs:
configuration: mkdocs.yml
#mkdocs:
# configuration: mkdocs.yml

# Optionally build your docs in additional formats such as PDF and ePub
formats: all
Expand All @@ -16,4 +20,5 @@ formats: all
python:
version: 3.7
install:
- requirements: docs/requirements.txt
#- requirements: requirements.txt
- requirements: docs/requirements.txt
8 changes: 7 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,14 @@ before_script:
script:
# integration
- tox --sitepackages
- pip install --editable .

#- python setup.py install --dry-run --user
- virtualenv vEnv ;
source vEnv/bin/activate
- pip install --editable . ;
cd .. & python -c "import pytorch_lightning ; print(pytorch_lightning.__version__)"
- deactivate ;
rm -rf vEnv

after_success:
- coverage report
Expand Down
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">

![Logo](./docs/source/_static/lightning_logo_small.png)
![Logo](docs/source/_static/images/lightning_logo_small.png)

# PyTorch Lightning

Expand All @@ -11,11 +11,11 @@
[![PyPI Status](https://pepy.tech/badge/pytorch-lightning)](https://pepy.tech/project/pytorch-lightning)
[![Build Status](https://travis-ci.org/williamFalcon/pytorch-lightning.svg?branch=master)](https://travis-ci.org/williamFalcon/pytorch-lightning)
[![Build status](https://ci.appveyor.com/api/projects/status/NEW-PROJECT-ID?svg=true)](https://ci.appveyor.com/project/williamFalcon/pytorch-lightning)
[![Coverage](https://github.com/williamFalcon/pytorch-lightning/blob/master/docs/source/_static/coverage.svg)](https://github.com/williamFalcon/pytorch-lightning/tree/master/tests#running-coverage)
[![Coverage](docs/source/_static/images/coverage.svg)](https://github.com/williamFalcon/pytorch-lightning/tree/master/tests#running-coverage)
[![CodeFactor](https://www.codefactor.io/repository/github/borda/pytorch-lightning/badge)](https://www.codefactor.io/repository/github/borda/pytorch-lightning)

[![ReadTheDocs](https://readthedocs.org/projects/pytorch-lightning/badge/?version=latest)](https://pytorch-lightning.readthedocs.io/en/latest)
[![Gitter](https://badges.gitter.im/PyTorch-Lightning/community.svg)](https://gitter.im/PyTorch-Lightning/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[![Slack](https://img.shields.io/badge/slack-chat-green.svg?logo=slack)](https://join.slack.com/t/pytorch-lightning/shared_invite/enQtODU5ODIyNTUzODQwLTFkMDg5Mzc1MDBmNjEzMDgxOTVmYTdhYjA1MDdmODUyOTg2OGQ1ZWZkYTQzODhhNzdhZDA3YmNhMDhlMDY4YzQ)
[![license](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/williamFalcon/pytorch-lightning/blob/master/LICENSE)
[![Next Release](https://img.shields.io/badge/Next%20Release-Dec%206-<COLOR>.svg)](https://shields.io/)

Expand Down Expand Up @@ -96,15 +96,15 @@ To use lightning do 2 things:
def forward(self, x):
return torch.relu(self.l1(x.view(x.size(0), -1)))

def training_step(self, batch, batch_nb):
def training_step(self, batch, batch_idx):
# REQUIRED
x, y = batch
y_hat = self.forward(x)
loss = F.cross_entropy(y_hat, y)
tensorboard_logs = {'train_loss': loss}
return {'loss': loss, 'log': tensorboard_logs}

def validation_step(self, batch, batch_nb):
def validation_step(self, batch, batch_idx):
# OPTIONAL
x, y = batch
y_hat = self.forward(x)
Expand Down Expand Up @@ -154,16 +154,16 @@ use something other than tensorboard).
Here are more advanced examples
```python
# train on cpu using only 10% of the data (for demo purposes)
trainer = Trainer(max_nb_epochs=1, train_percent_check=0.1)
trainer = Trainer(max_epochs=1, train_percent_check=0.1)

# train on 4 gpus (lightning chooses GPUs for you)
# trainer = Trainer(max_nb_epochs=1, gpus=4, distributed_backend='ddp')
# trainer = Trainer(max_epochs=1, gpus=4, distributed_backend='ddp')

# train on 4 gpus (you choose GPUs)
# trainer = Trainer(max_nb_epochs=1, gpus=[0, 1, 3, 7], distributed_backend='ddp')
# trainer = Trainer(max_epochs=1, gpus=[0, 1, 3, 7], distributed_backend='ddp')

# train on 32 gpus across 4 nodes (make sure to submit appropriate SLURM job)
# trainer = Trainer(max_nb_epochs=1, gpus=8, nb_gpu_nodes=4, distributed_backend='ddp')
# trainer = Trainer(max_epochs=1, gpus=8, num_gpu_nodes=4, distributed_backend='ddp')

# train (1 epoch only here for demo)
trainer.fit(model)
Expand All @@ -183,14 +183,14 @@ trainer.test()
Everything in gray!
You define the blue parts using the LightningModule interface:

![Overview](./docs/source/_static/overview_flat.jpg)
![Overview](docs/source/_static/images/overview_flat.jpg)

```python
# what to do in the training loop
def training_step(self, batch, batch_nb):
def training_step(self, batch, batch_idx):

# what to do in the validation loop
def validation_step(self, batch, batch_nb):
def validation_step(self, batch, batch_idx):

# how to aggregate validation_step outputs
def validation_end(self, outputs):
Expand All @@ -205,7 +205,7 @@ def test_dataloader():

```python
# define what happens for training here
def training_step(self, batch, batch_nb):
def training_step(self, batch, batch_idx):
x, y = batch

# define your own forward and loss calculation
Expand All @@ -232,7 +232,7 @@ def training_step(self, batch, batch_nb):

```python
# define what happens for validation here
def validation_step(self, batch, batch_nb):
def validation_step(self, batch, batch_idx):
x, y = batch

# or as basic as a CNN classification
Expand Down Expand Up @@ -266,11 +266,11 @@ def validation_end(self, outputs):
## Tensorboard
Lightning is fully integrated with tensorboard, MLFlow and supports any logging module.

![tensorboard-support](./docs/source/_static/tf_loss.png)
![tensorboard-support](docs/source/_static/images/tf_loss.png)

Lightning also adds a text column with all the hyperparameters for this experiment.

![tensorboard-support](./docs/source/_static/tf_tags.png)
![tensorboard-support](docs/source/_static/images/tf_tags.png)

## Lightning automates all of the following ([each is also configurable](https://williamfalcon.github.io/pytorch-lightning/Trainer/)):

Expand Down
Loading