Deployed 28618a3 with MkDocs version: 1.0.4

This commit is contained in:
William Falcon
2019-06-28 16:46:09 -05:00
parent f1d00ca90d
commit ee71cdbcfa
17 changed files with 560 additions and 101 deletions
+274
View File
@@ -0,0 +1,274 @@
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="../../img/favicon.ico">
<title>Methods - Pytorch lightning Documentation</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="../../css/theme.css" type="text/css" />
<link rel="stylesheet" href="../../css/theme_extra.css" type="text/css" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css">
<script>
// Current page data
var mkdocs_page_name = "Methods";
var mkdocs_page_input_path = "LightningModule/methods.md";
var mkdocs_page_url = null;
</script>
<script src="../../js/jquery-2.1.1.min.js" defer></script>
<script src="../../js/modernizr-2.8.3.min.js" defer></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
<div class="wy-side-nav-search">
<a href="../.." class="icon icon-home"> Pytorch lightning Documentation</a>
<div role="search">
<form id ="rtd-search-form" class="wy-form" action="../../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" title="Type search term here" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1">
<a class="" href="../..">PYTORCH-LIGHTNING DOCUMENTATION</a>
</li>
<li class="toctree-l1">
<span class="caption-text">LightningModule</span>
<ul class="subnav">
<li class="">
<a class="" href="../RequiredTrainerInterface/">Lightning Module interface</a>
</li>
<li class=" current">
<a class="current" href="./">Methods</a>
<ul class="subnav">
<li class="toctree-l3"><a href="#freeze">freeze</a></li>
<li class="toctree-l3"><a href="#load_from_metrics">load_from_metrics</a></li>
<li class="toctree-l3"><a href="#unfreeze">unfreeze</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1">
<span class="caption-text">Trainer</span>
<ul class="subnav">
<li class="">
<a class="" href="../../Trainer/">Trainer</a>
</li>
<li class="">
<a class="" href="../../Trainer/Checkpointing/">Checkpointing</a>
</li>
<li class="">
<a class="" href="../../Trainer/Distributed training/">Distributed training</a>
</li>
<li class="">
<a class="" href="../../Trainer/Logging/">Logging</a>
</li>
<li class="">
<a class="" href="../../Trainer/SLURM Managed Cluster/">SLURM Managed Cluster</a>
</li>
<li class="">
<a class="" href="../../Trainer/Training Loop/">Training Loop</a>
</li>
<li class="">
<a class="" href="../../Trainer/Validation loop/">Validation loop</a>
</li>
<li class="">
<a class="" href="../../Trainer/debugging/">Debugging</a>
</li>
<li class="">
<a class="" href="../../Trainer/hooks/">Hooks</a>
</li>
</ul>
</li>
</ul>
</div>
&nbsp;
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../..">Pytorch lightning Documentation</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../..">Docs</a> &raquo;</li>
<li>LightningModule &raquo;</li>
<li>Methods</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/williamFalcon/pytorch-lightning/edit/master/docs/LightningModule/methods.md"
class="icon icon-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
</div>
<div role="main">
<div class="section">
<p>Lightning modules are strict superclasses of torch.nn.Module. A LightningModule offers the following in addition to that API.</p>
<hr />
<h3 id="freeze">freeze</h3>
<p>Freeze all params for inference</p>
<pre><code class="python">model = MyLightningModule(...)
model.freeze()
</code></pre>
<hr />
<h3 id="load_from_metrics">load_from_metrics</h3>
<p>This is the easiest/fastest way which uses the meta_tags.csv file from test-tube to rebuild the model.
The meta_tags.csv file can be found in the test-tube experiment save_dir. </p>
<pre><code class="python">pretrained_model = MyLightningModule.load_from_metrics(
weights_path='/path/to/pytorch_checkpoint.ckpt',
tags_csv='/path/to/test_tube/experiment/version/meta_tags.csv',
on_gpu=True,
map_location=None
)
# predict
pretrained_model.freeze()
y_hat = pretrained_model(x)
</code></pre>
<p><strong>Params</strong> </p>
<table>
<thead>
<tr>
<th>Param</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>weights_path</td>
<td>Path to a pytorch checkpoint</td>
</tr>
<tr>
<td>tags_csv</td>
<td>Path to meta_tags.csv file generated by the test-tube Experiment</td>
</tr>
<tr>
<td>on_gpu</td>
<td>if True, puts model on GPU. Make sure to use transforms option if model devices have changed</td>
</tr>
<tr>
<td>map_location</td>
<td>A dictionary mapping saved weight GPU devices to new GPU devices</td>
</tr>
</tbody>
</table>
<p><strong>Returns</strong> </p>
<p>LightningModule - The pretrained LightningModule</p>
<hr />
<h3 id="unfreeze">unfreeze</h3>
<p>Unfreeze all params for inference</p>
<pre><code class="python">model = MyLightningModule(...)
model.unfreeze()
</code></pre>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="../../Trainer/" class="btn btn-neutral float-right" title="Trainer">Next <span class="icon icon-circle-arrow-right"></span></a>
<a href="../RequiredTrainerInterface/" class="btn btn-neutral" title="Lightning Module interface"><span class="icon icon-circle-arrow-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<!-- Copyright etc -->
</div>
Built with <a href="http://www.mkdocs.org">MkDocs</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<div class="rst-versions" role="note" style="cursor: pointer">
<span class="rst-current-version" data-toggle="rst-current-version">
<a href="https://github.com/williamFalcon/pytorch-lightning/" class="fa fa-github" style="float: left; color: #fcfcfc"> GitHub</a>
<span><a href="../RequiredTrainerInterface/" style="color: #fcfcfc;">&laquo; Previous</a></span>
<span style="margin-left: 15px"><a href="../../Trainer/" style="color: #fcfcfc">Next &raquo;</a></span>
</span>
</div>
<script>var base_url = '../..';</script>
<script src="../../js/theme.js" defer></script>
<script src="../../search/main.js" defer></script>
</body>
</html>