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 docs examples & typos #4930

Merged
merged 28 commits into from
Feb 1, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f26ca74
Fix docs
siahuat0727 Dec 1, 2020
51ecf0b
typo
Borda Dec 1, 2020
55d356e
Merge branch 'master' into fix-docs
tchaton Dec 3, 2020
cec1393
import
Borda Dec 3, 2020
4858b80
Merge branch 'master' into fix-docs
edenlightning Dec 16, 2020
a7b2151
Apply suggestions from code review
Borda Jan 26, 2021
1eccebb
Merge branch 'master' into fix-docs
mergify[bot] Jan 26, 2021
9ed8ca3
Merge branch 'master' into fix-docs
mergify[bot] Jan 27, 2021
d8e7da9
Merge branch 'master' into fix-docs
mergify[bot] Jan 27, 2021
552e483
Merge branch 'master' into fix-docs
mergify[bot] Jan 27, 2021
b5c3599
Merge branch 'master' into fix-docs
mergify[bot] Jan 27, 2021
d9f6be1
Merge branch 'master' into fix-docs
mergify[bot] Jan 27, 2021
b35e10b
Merge branch 'master' into fix-docs
mergify[bot] Jan 27, 2021
7e310bf
Merge branch 'master' into fix-docs
mergify[bot] Jan 28, 2021
793be6e
Apply suggestions from code review
Borda Jan 28, 2021
1ace420
Merge branch 'master' into fix-docs
mergify[bot] Jan 28, 2021
e8bc81d
Apply suggestions from code review
Borda Jan 29, 2021
058b5a0
typo
Borda Jan 29, 2021
0c917d8
pl
Borda Jan 29, 2021
bd391da
mock
Borda Jan 29, 2021
c726ba0
Merge branch 'master' into fix-docs
mergify[bot] Jan 29, 2021
7156260
Merge branch 'master' into fix-docs
mergify[bot] Jan 29, 2021
25358b9
Merge branch 'master' into fix-docs
mergify[bot] Jan 29, 2021
4bec4c4
Merge branch 'master' into fix-docs
mergify[bot] Jan 30, 2021
1a71ff1
Merge branch 'master' into fix-docs
mergify[bot] Jan 31, 2021
bbd4d8f
Merge branch 'master' into fix-docs
mergify[bot] Jan 31, 2021
0b44200
Merge branch 'master' into fix-docs
mergify[bot] Feb 1, 2021
1d9516c
nn
Borda Feb 1, 2021
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
10 changes: 5 additions & 5 deletions docs/source/style_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ A LightningModule can define both a system and a model.

Here's a LightningModule that defines a model:

.. code-block:: python
.. testcode::

class LitModel(pl.LightningModule):
Borda marked this conversation as resolved.
Show resolved Hide resolved
def __init__(self, num_layers: int = 3)
Expand All @@ -44,7 +44,7 @@ Here's a LightningModule that defines a model:
self.layer_2 = nn.Linear(...)
self.layer_3 = nn.Linear(...)
Borda marked this conversation as resolved.
Show resolved Hide resolved

Here's a lightningModule that defines a system:
Here's a LightningModule that defines a system:

.. code-block:: python

Expand Down Expand Up @@ -74,7 +74,7 @@ sensible defaults in the init so that the user doesn't have to guess.

Here's an example where a user will have to go hunt through files to figure out how to init this LightningModule.

.. code-block:: python
.. testcode::

class LitModel(pl.LightningModule):
Borda marked this conversation as resolved.
Show resolved Hide resolved
def __init__(self, params):
Expand All @@ -85,10 +85,10 @@ Models defined as such leave you with many questions; what is coef_x? is it a st

Instead, be explicit in your init

.. code-block:: python
.. testcode::

class LitModel(pl.LightningModule):
def __init__(self, encoder: nn.Module, coeff_x: float = 0.2, lr: float = 1e-3)
def __init__(self, encoder: nn.Module, coef_x: float = 0.2, lr: float = 1e-3):
Borda marked this conversation as resolved.
Show resolved Hide resolved

Now the user doesn't have to guess. Instead they know the value type and the model has a sensible default where the
user can see the value immediately.
Expand Down
2 changes: 1 addition & 1 deletion pytorch_lightning/core/lightning.py
Original file line number Diff line number Diff line change
Expand Up @@ -1442,7 +1442,7 @@ def save_hyperparameters(self, *args, frame=None) -> None:

Args:
args: single object of `dict`, `NameSpace` or `OmegaConf`
or string names or argumenst from class `__init__`
or string names or arguments from class `__init__`

>>> from collections import OrderedDict
>>> class ManuallyArgsModel(LightningModule):
Expand Down