* fix quickstart command in readme

* fix documentation links in model and datamodule

* add `terminate_on_nan` trainer arg to readme

* improve docstrings and type hinting
This commit is contained in:
Łukasz Zalewski authored and GitHub committed 2021-04-07 17:15:09 +02:00
1 parent 6a15f8ef3b
commit e2c8ed4bf8
3 files changed
+23 -14

No files matched your search

+3 -4
View File
@@ -19,7 +19,7 @@ class MNISTLitModel(LightningModule):
- Optimizers (configure_optimizers)
Read the docs:
https://pytorch-lightning.readthedocs.io/en/latest/lightning_module.html
https://pytorch-lightning.readthedocs.io/en/latest/common/lightning_module.html
"""
def __init__(
@@ -57,10 +57,10 @@ class MNISTLitModel(LightningModule):
"val/loss": [],
}
def forward(self, x):
def forward(self, x: torch.Tensor):
return self.model(x)
def step(self, batch):
def step(self, batch: Any):
x, y = batch
logits = self.forward(x)
loss = self.criterion(logits, y)
@@ -123,7 +123,6 @@ class MNISTLitModel(LightningModule):
See examples here:
https://pytorch-lightning.readthedocs.io/en/latest/common/lightning_module.html#configure-optimizers
"""
return torch.optim.Adam(
params=self.parameters(), lr=self.hparams.lr, weight_decay=self.hparams.weight_decay