From 1255a8f738d2a2efa0c5659bdccbacd4c88430d9 Mon Sep 17 00:00:00 2001 From: David Waterworth Date: Thu, 10 Sep 2020 23:22:27 +1000 Subject: [PATCH] Updated "Models defined by data" (#3433) * Updated "Models defined by data" * Fixed WARNING: Inline substitution_reference start-string without end-string. Co-authored-by: David Waterworth --- docs/source/introduction_guide.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/introduction_guide.rst b/docs/source/introduction_guide.rst index 0453c965c8..32a9861cd7 100644 --- a/docs/source/introduction_guide.rst +++ b/docs/source/introduction_guide.rst @@ -289,15 +289,15 @@ When your models need to know about the data, it's best to process the data befo dm.setup() model = LitModel(out_features=dm.num_classes, img_width=dm.img_width, img_height=dm.img_height) - trainer.fit(model) + trainer.fit(model, dm) 1. use `prepare_data` to download and process the dataset. 2. use `setup` to do splits, and build your model internals -| +An alternative to using a DataModule is to defer initialization of the models modules to the `setup` method of your LightningModule as follows: -.. testcode:: +.. code-block:: python class LitMNIST(LightningModule):