mirror of
https://github.com/wassname/pytorch-lightning.git
synced 2026-09-20 13:10:42 +08:00
Deployed f0af138 with MkDocs version: 1.0.4
This commit is contained in:
+11
-5
@@ -495,13 +495,19 @@
|
||||
<p>[<a href="https://github.com/williamFalcon/pytorch-lightning/blob/master/pytorch_lightning/models/trainer.py">Github Code</a>]</p>
|
||||
<p>The lightning trainer abstracts best practices for running a training, val, test routine. It calls parts of your model when it wants to hand over full control and otherwise makes training assumptions which are now standard practice in AI research.</p>
|
||||
<p>This is the basic use of the trainer:</p>
|
||||
<pre><code class="python">from pytorch_lightning import Trainer
|
||||
<table class="codehilitetable"><tr><td class="linenos"><div class="linenodiv"><pre>1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6</pre></div></td><td class="code"><div class="codehilite"><pre><span></span><span class="kn">from</span> <span class="nn">pytorch_lightning</span> <span class="kn">import</span> <span class="n">Trainer</span>
|
||||
|
||||
model = LightningTemplate()
|
||||
<span class="n">model</span> <span class="o">=</span> <span class="n">LightningTemplate</span><span class="p">()</span>
|
||||
|
||||
trainer = Trainer()
|
||||
trainer.fit(model)
|
||||
</code></pre>
|
||||
<span class="n">trainer</span> <span class="o">=</span> <span class="n">Trainer</span><span class="p">()</span>
|
||||
<span class="n">trainer</span><span class="o">.</span><span class="n">fit</span><span class="p">(</span><span class="n">model</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</td></tr></table>
|
||||
|
||||
<p>But of course the fun is in all the advanced things it can do:</p>
|
||||
<p><strong>Checkpointing</strong> </p>
|
||||
|
||||
Reference in New Issue
Block a user