mirror of
https://github.com/wassname/pytorch-lightning.git
synced 2026-09-09 11:32:07 +08:00
added warnings to unimplemented methods (#1317)
* added warnings and removed default optimizer * opt * Apply suggestions from code review Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
This commit is contained in:
co-authored by
Jirka Borovec
parent
3c5530c29d
commit
e68ba1c836
@@ -269,7 +269,6 @@ In PyTorch we do it as follows:
|
||||
|
||||
|
||||
In Lightning we do the same but organize it under the configure_optimizers method.
|
||||
If you don't define this, Lightning will automatically use `Adam(self.parameters(), lr=1e-3)`.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -278,6 +277,17 @@ If you don't define this, Lightning will automatically use `Adam(self.parameters
|
||||
def configure_optimizers(self):
|
||||
return Adam(self.parameters(), lr=1e-3)
|
||||
|
||||
.. note:: The LightningModule itself has the parameters, so pass in self.parameters()
|
||||
|
||||
However, if you have multiple optimizers use the matching parameters
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
class LitMNIST(pl.LightningModule):
|
||||
|
||||
def configure_optimizers(self):
|
||||
return Adam(self.generator(), lr=1e-3), Adam(self.discriminator(), lr=1e-3)
|
||||
|
||||
Training step
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
|
||||
Reference in New Issue
Block a user