clean up docs (#1614)

* fixed hparams section

* docs clean up
This commit is contained in:
William Falcon
2020-04-26 10:57:26 -04:00
committed by GitHub
parent 4755ded863
commit d2b94ca81b
4 changed files with 254 additions and 124 deletions
+7 -11
View File
@@ -27,9 +27,9 @@ Argparser Best Practices
^^^^^^^^^^^^^^^^^^^^^^^^
It is best practice to layer your arguments in three sections.
1. Trainer args (gpus, num_nodes, etc...)
2. Model specific arguments (layer_dim, num_layers, learning_rate, etc...)
3. Program arguments (data_path, cluster_email, etc...)
1. Trainer args (gpus, num_nodes, etc...)
2. Model specific arguments (layer_dim, num_layers, learning_rate, etc...)
3. Program arguments (data_path, cluster_email, etc...)
We can do this as follows. First, in your LightningModule, define the arguments
specific to that module. Remember that data splits or data paths may also be specific to
@@ -84,15 +84,11 @@ Finally, make sure to start the training like so:
# YES
model = LitModel(hparams)
# NO
# model = LitModel(learning_rate=hparams.learning_rate, ...)
# YES
trainer = Trainer.from_argparse_args(hparams, early_stopping_callback=...)
# NO
trainer = Trainer(gpus=hparams.gpus, ...)
# model = LitModel(learning_rate=hparams.learning_rate, ...)
#trainer = Trainer(gpus=hparams.gpus, ...)
LightiningModule hparams
@@ -144,8 +140,8 @@ Now pass in the params when you init your model
The line `self.hparams = hparams` is very special. This line assigns your hparams to the LightningModule.
This does two things:
1. It adds them automatically to tensorboard logs under the hparams tab.
2. Lightning will save those hparams to the checkpoint and use them to restore the module correctly.
1. It adds them automatically to tensorboard logs under the hparams tab.
2. Lightning will save those hparams to the checkpoint and use them to restore the module correctly.
Trainer args
^^^^^^^^^^^^