提交 10157764 编写于 作者: P PaParaZz1

Deploying to gh-pages from @ 8050a9bb 🚀

上级 ffe2d7f9
......@@ -5,6 +5,6 @@ Developer Guide
:maxdepth: 2
git_guide_en
doc_contribution
code_comment
doc_contribution_en
code_comment_en
......@@ -201,8 +201,7 @@ DI-engine supports various useful tools in common RL training, as shown in follo
Epsilon Greedy
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
An easy way of deploying epsilon greedy exploration when sampling data has already been shown above. It is
called by the ``epsilon_greedy`` function each step. And you can select your own decay strategy, such as envstep and train_iter.
An easy way of deploying epsilon greedy exploration when sampling data is shown as follows:
.. code-block:: python
......@@ -214,12 +213,14 @@ called by the ``epsilon_greedy`` function each step. And you can select your own
eps = epsilon_greedy(learner.train_iter)
...
Firstly, you should call ``get_epsilon_greedy_fn`` to acquire an eps-greedy function. Then, you should call ``epsilon_greedy`` function at each step. The epsilon decay strategy can be configured by you, for example, start value, end value, type of decay(linear, exponential). And you can control whether it decay by env step or train iteration.
Visualization & Logging
~~~~~~~~~~~~~~~~~~~~~~~~~
Some environments have a rendering surface or visualization. DI-engine doesn't use render interface but add a switch to save these replays.
After training, users can add the next lines to enable this function. If everything is working fine, you can find some videos with ``.mp4`` suffix in the ``replay_path`` (some GUI interfaces are normal).
Some environments have a rendering visualization. DI-engine doesn't use render interface, but supports saving replay videos instead.
After training, users can add the code shown below to enable this function. If everything works well, you can find some videos with ``.mp4`` suffix in directory ``replay_path`` (some GUI interfaces are normal).
.. code-block:: python
......@@ -235,7 +236,7 @@ After training, users can add the next lines to enable this function. If everyth
.. note::
If users want to visualize with a trained policy, please refer to ``dizoo/classic_control/cartpole/entry/cartpole_dqn_eval.py`` to construct a user-defined evaluation function, and indicate two fields ``env.replay_path`` and ``policy.learn.learner.hook.load_ckpt_before_run`` in config, an example is shown as follows:
If users want to visualize with a trained policy, please refer to ``dizoo/classic_control/cartpole/entry/cartpole_dqn_eval.py`` to construct a user-defined evaluation function, and indicate two fields ``env.replay_path`` and ``policy.learn.learner.hook.load_ckpt_before_run`` in config. An example is shown as follows:
.. code-block:: python
......@@ -252,7 +253,7 @@ After training, users can add the next lines to enable this function. If everyth
.. tip::
Each new RL environments can define their own ``enable_save_replay`` method to specify how to generate replay files. DI-engine utilizes ``gym wrapper (coupled with ffmpeg)`` to generate replay for some traditional environments. If users encounter some errors in recording videos by ``gym wrapper`` , you should install ``ffmpeg`` first.
All new RL environments can define their own ``enable_save_replay`` method to specify how to generate replay files. DI-engine utilizes ``gym wrapper (coupled with ffmpeg)`` to generate replays for some traditional environments. If users encounter some errors in recording videos by ``gym wrapper``, you should install ``ffmpeg`` first.
Similar with other Deep Learning platforms, DI-engine uses tensorboard to record key parameters and results during
......@@ -269,8 +270,8 @@ DQN experiment.
Loading & Saving checkpoints
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It is usually needed to save and resume an experiments with model checkpoints. DI-engine saves and loads checkpoints
in the same way as PyTorch.
It is usually needed to save and resume an experiment with model checkpoint.
DI-engine saves and loads checkpoints in the same way as PyTorch.
.. code-block:: python
......@@ -282,7 +283,7 @@ in the same way as PyTorch.
...
dirname = './ckpt_{}'.format(learner.name)
os.mkdir(dirname, exsit_ok=True)
os.mkdir(dirname, exist_ok=True)
ckpt_name = 'iteration_{}.pth.tar'.format(learner.last_iter.val)
path = os.path.join(dirname, ckpt_name)
state_dict = learner.policy.state_dict()
......@@ -290,9 +291,9 @@ in the same way as PyTorch.
learner.info('{} save ckpt in {}'.format(learner.name, path))
To deploy this in a more elegant way, DI-engine is configured to use
:class:`Learner Hooks <ding.worker.learner.learner_hook.LearnerHook>` to handle these cases. The saving hook is
automatically frequently called after training iterations. And to load & save checkpoints at the beginning and
in the end, users can simply add one line code before & after training as follow.
:class:`Learner Hook <ding.worker.learner.learner_hook.LearnerHook>` to handle these cases. The saving hook is
automatically called after training iterations. And to load & save checkpoints at the beginning and
in the end, users can simply add one-line code before & after training as follows.
.. code-block:: python
......
......@@ -4,8 +4,8 @@ Tensorboard and Logging demo
.. toctree::
:maxdepth: 3
In this page, the default tensorboard and logging information is detailly described. A ``CartPole DQN`` experiment
is used as example.
In this page, the default tensorboard and logging information is described in detail.
A ``CartPole DQN`` experiment is used as example.
Tensorboard info
-----------------
......
......@@ -38,7 +38,7 @@
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Tutorial-Developer" href="../tutorial_dev/index.html" />
<link rel="prev" title="Documentation Contribution Guide" href="doc_contribution.html" />
<link rel="prev" title="Documentation Contribution Guide" href="doc_contribution_en.html" />
<link href="../_static/css/style.css" rel="stylesheet" type="text/css">
</head>
......@@ -100,7 +100,7 @@
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Developer Guide</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="git_guide_en.html">Git Collaboration Guide</a></li>
<li class="toctree-l2"><a class="reference internal" href="doc_contribution.html">Documentation Contribution Guide</a></li>
<li class="toctree-l2"><a class="reference internal" href="doc_contribution_en.html">Documentation Contribution Guide</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Code Comment</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#code-comment-template">Code Comment Template</a></li>
</ul>
......@@ -162,7 +162,7 @@
<li class="wy-breadcrumbs-aside">
<a href="../_sources/guide/code_comment.rst.txt" rel="nofollow"> View page source</a>
<a href="../_sources/guide/code_comment_en.rst.txt" rel="nofollow"> View page source</a>
</li>
......@@ -358,7 +358,7 @@ And of course you can insert the line comment in front of the code line as a new
<a href="../tutorial_dev/index.html" class="btn btn-neutral float-right" title="Tutorial-Developer" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="doc_contribution.html" class="btn btn-neutral float-left" title="Documentation Contribution Guide" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
<a href="doc_contribution_en.html" class="btn btn-neutral float-left" title="Documentation Contribution Guide" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
......
......@@ -37,7 +37,7 @@
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Code Comment" href="code_comment.html" />
<link rel="next" title="Code Comment" href="code_comment_en.html" />
<link rel="prev" title="Git Collaboration Guide" href="git_guide_en.html" />
<link href="../_static/css/style.css" rel="stylesheet" type="text/css">
......@@ -101,7 +101,7 @@
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Developer Guide</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="git_guide_en.html">Git Collaboration Guide</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Documentation Contribution Guide</a></li>
<li class="toctree-l2"><a class="reference internal" href="code_comment.html">Code Comment</a></li>
<li class="toctree-l2"><a class="reference internal" href="code_comment_en.html">Code Comment</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../tutorial_dev/index.html">Tutorial-Developer</a></li>
......@@ -159,7 +159,7 @@
<li class="wy-breadcrumbs-aside">
<a href="../_sources/guide/doc_contribution.rst.txt" rel="nofollow"> View page source</a>
<a href="../_sources/guide/doc_contribution_en.rst.txt" rel="nofollow"> View page source</a>
</li>
......@@ -216,7 +216,7 @@
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="code_comment.html" class="btn btn-neutral float-right" title="Code Comment" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="code_comment_en.html" class="btn btn-neutral float-right" title="Code Comment" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="git_guide_en.html" class="btn btn-neutral float-left" title="Git Collaboration Guide" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
......
......@@ -37,7 +37,7 @@
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Documentation Contribution Guide" href="doc_contribution.html" />
<link rel="next" title="Documentation Contribution Guide" href="doc_contribution_en.html" />
<link rel="prev" title="Developer Guide" href="index.html" />
<link href="../_static/css/style.css" rel="stylesheet" type="text/css">
......@@ -104,8 +104,8 @@
<li class="toctree-l3"><a class="reference internal" href="#git-standards">Git Standards</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="doc_contribution.html">Documentation Contribution Guide</a></li>
<li class="toctree-l2"><a class="reference internal" href="code_comment.html">Code Comment</a></li>
<li class="toctree-l2"><a class="reference internal" href="doc_contribution_en.html">Documentation Contribution Guide</a></li>
<li class="toctree-l2"><a class="reference internal" href="code_comment_en.html">Code Comment</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../tutorial_dev/index.html">Tutorial-Developer</a></li>
......@@ -237,7 +237,7 @@ git checkout -b base-master base/master <span class="c1"># use `base-master` to
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="doc_contribution.html" class="btn btn-neutral float-right" title="Documentation Contribution Guide" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="doc_contribution_en.html" class="btn btn-neutral float-right" title="Documentation Contribution Guide" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="index.html" class="btn btn-neutral float-left" title="Developer Guide" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
......
......@@ -100,8 +100,8 @@
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">Developer Guide</a><ul>
<li class="toctree-l2"><a class="reference internal" href="git_guide_en.html">Git Collaboration Guide</a></li>
<li class="toctree-l2"><a class="reference internal" href="doc_contribution.html">Documentation Contribution Guide</a></li>
<li class="toctree-l2"><a class="reference internal" href="code_comment.html">Code Comment</a></li>
<li class="toctree-l2"><a class="reference internal" href="doc_contribution_en.html">Documentation Contribution Guide</a></li>
<li class="toctree-l2"><a class="reference internal" href="code_comment_en.html">Code Comment</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../tutorial_dev/index.html">Tutorial-Developer</a></li>
......@@ -179,9 +179,9 @@
<li class="toctree-l2"><a class="reference internal" href="git_guide_en.html#git-standards">Git Standards</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="doc_contribution.html">Documentation Contribution Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="code_comment.html">Code Comment</a><ul>
<li class="toctree-l2"><a class="reference internal" href="code_comment.html#code-comment-template">Code Comment Template</a></li>
<li class="toctree-l1"><a class="reference internal" href="doc_contribution_en.html">Documentation Contribution Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="code_comment_en.html">Code Comment</a><ul>
<li class="toctree-l2"><a class="reference internal" href="code_comment_en.html#code-comment-template">Code Comment Template</a></li>
</ul>
</li>
</ul>
......
......@@ -335,8 +335,8 @@ If you want to deeply customize your algorithm and application with DI-engine, a
<ul>
<li class="toctree-l1"><a class="reference internal" href="guide/index.html">Developer Guide</a><ul>
<li class="toctree-l2"><a class="reference internal" href="guide/git_guide_en.html">Git Collaboration Guide</a></li>
<li class="toctree-l2"><a class="reference internal" href="guide/doc_contribution.html">Documentation Contribution Guide</a></li>
<li class="toctree-l2"><a class="reference internal" href="guide/code_comment.html">Code Comment</a></li>
<li class="toctree-l2"><a class="reference internal" href="guide/doc_contribution_en.html">Documentation Contribution Guide</a></li>
<li class="toctree-l2"><a class="reference internal" href="guide/code_comment_en.html">Code Comment</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="tutorial_dev/index.html">Tutorial-Developer</a><ul>
......
无法预览此类型文件
......@@ -347,8 +347,7 @@ collecting data, updating policy, updating related modules and evaluation.</p>
<p>DI-engine supports various useful tools in common RL training, as shown in follows.</p>
<div class="section" id="epsilon-greedy">
<h3>Epsilon Greedy<a class="headerlink" href="#epsilon-greedy" title="Permalink to this headline"></a></h3>
<p>An easy way of deploying epsilon greedy exploration when sampling data has already been shown above. It is
called by the <code class="docutils literal notranslate"><span class="pre">epsilon_greedy</span></code> function each step. And you can select your own decay strategy, such as envstep and train_iter.</p>
<p>An easy way of deploying epsilon greedy exploration when sampling data is shown as follows:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">ding.rl_utils</span> <span class="kn">import</span> <span class="n">get_epsilon_greedy_fn</span>
<span class="n">eps_cfg</span> <span class="o">=</span> <span class="n">cfg</span><span class="o">.</span><span class="n">policy</span><span class="o">.</span><span class="n">other</span><span class="o">.</span><span class="n">eps</span>
......@@ -358,11 +357,12 @@ called by the <code class="docutils literal notranslate"><span class="pre">epsil
<span class="o">...</span>
</pre></div>
</div>
<p>Firstly, you should call <code class="docutils literal notranslate"><span class="pre">get_epsilon_greedy_fn</span></code> to acquire an eps-greedy function. Then, you should call <code class="docutils literal notranslate"><span class="pre">epsilon_greedy</span></code> function at each step. The epsilon decay strategy can be configured by you, for example, start value, end value, type of decay(linear, exponential). And you can control whether it decay by env step or train iteration.</p>
</div>
<div class="section" id="visualization-logging">
<h3>Visualization &amp; Logging<a class="headerlink" href="#visualization-logging" title="Permalink to this headline"></a></h3>
<p>Some environments have a rendering surface or visualization. DI-engine doesn’t use render interface but add a switch to save these replays.
After training, users can add the next lines to enable this function. If everything is working fine, you can find some videos with <code class="docutils literal notranslate"><span class="pre">.mp4</span></code> suffix in the <code class="docutils literal notranslate"><span class="pre">replay_path</span></code> (some GUI interfaces are normal).</p>
<p>Some environments have a rendering visualization. DI-engine doesn’t use render interface, but supports saving replay videos instead.
After training, users can add the code shown below to enable this function. If everything works well, you can find some videos with <code class="docutils literal notranslate"><span class="pre">.mp4</span></code> suffix in directory <code class="docutils literal notranslate"><span class="pre">replay_path</span></code> (some GUI interfaces are normal).</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">evaluator_env</span> <span class="o">=</span> <span class="n">BaseEnvManager</span><span class="p">(</span><span class="n">env_fn</span><span class="o">=</span><span class="p">[</span><span class="n">wrapped_cartpole_env</span> <span class="k">for</span> <span class="n">_</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">evaluator_env_num</span><span class="p">)],</span> <span class="n">cfg</span><span class="o">=</span><span class="n">cfg</span><span class="o">.</span><span class="n">env</span><span class="o">.</span><span class="n">manager</span><span class="p">)</span>
<span class="n">cfg</span><span class="o">.</span><span class="n">env</span><span class="o">.</span><span class="n">replay_path</span> <span class="o">=</span> <span class="s1">&#39;./video&#39;</span> <span class="c1"># indicate save replay directory path</span>
<span class="n">evaluator_env</span><span class="o">.</span><span class="n">seed</span><span class="p">(</span><span class="n">seed</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">dynamic_seed</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
......@@ -375,7 +375,7 @@ After training, users can add the next lines to enable this function. If everyth
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>If users want to visualize with a trained policy, please refer to <code class="docutils literal notranslate"><span class="pre">dizoo/classic_control/cartpole/entry/cartpole_dqn_eval.py</span></code> to construct a user-defined evaluation function, and indicate two fields <code class="docutils literal notranslate"><span class="pre">env.replay_path</span></code> and <code class="docutils literal notranslate"><span class="pre">policy.learn.learner.hook.load_ckpt_before_run</span></code> in config, an example is shown as follows:</p>
<p>If users want to visualize with a trained policy, please refer to <code class="docutils literal notranslate"><span class="pre">dizoo/classic_control/cartpole/entry/cartpole_dqn_eval.py</span></code> to construct a user-defined evaluation function, and indicate two fields <code class="docutils literal notranslate"><span class="pre">env.replay_path</span></code> and <code class="docutils literal notranslate"><span class="pre">policy.learn.learner.hook.load_ckpt_before_run</span></code> in config. An example is shown as follows:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">config</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span>
<span class="n">env</span><span class="o">=</span><span class="nb">dict</span><span class="p">(</span>
<span class="n">replay_path</span><span class="o">=</span><span class="s1">&#39;your_replay_save_dir_path&#39;</span><span class="p">,</span>
......@@ -391,7 +391,7 @@ After training, users can add the next lines to enable this function. If everyth
</div>
<div class="admonition tip">
<p class="admonition-title">Tip</p>
<p>Each new RL environments can define their own <code class="docutils literal notranslate"><span class="pre">enable_save_replay</span></code> method to specify how to generate replay files. DI-engine utilizes <code class="docutils literal notranslate"><span class="pre">gym</span> <span class="pre">wrapper</span> <span class="pre">(coupled</span> <span class="pre">with</span> <span class="pre">ffmpeg)</span></code> to generate replay for some traditional environments. If users encounter some errors in recording videos by <code class="docutils literal notranslate"><span class="pre">gym</span> <span class="pre">wrapper</span></code> , you should install <code class="docutils literal notranslate"><span class="pre">ffmpeg</span></code> first.</p>
<p>All new RL environments can define their own <code class="docutils literal notranslate"><span class="pre">enable_save_replay</span></code> method to specify how to generate replay files. DI-engine utilizes <code class="docutils literal notranslate"><span class="pre">gym</span> <span class="pre">wrapper</span> <span class="pre">(coupled</span> <span class="pre">with</span> <span class="pre">ffmpeg)</span></code> to generate replays for some traditional environments. If users encounter some errors in recording videos by <code class="docutils literal notranslate"><span class="pre">gym</span> <span class="pre">wrapper</span></code>, you should install <code class="docutils literal notranslate"><span class="pre">ffmpeg</span></code> first.</p>
</div>
<p>Similar with other Deep Learning platforms, DI-engine uses tensorboard to record key parameters and results during
training. In addition to the default logging parameters, users can add their own logging parameters as follow.</p>
......@@ -404,8 +404,8 @@ DQN experiment.</p>
</div>
<div class="section" id="loading-saving-checkpoints">
<h3>Loading &amp; Saving checkpoints<a class="headerlink" href="#loading-saving-checkpoints" title="Permalink to this headline"></a></h3>
<p>It is usually needed to save and resume an experiments with model checkpoints. DI-engine saves and loads checkpoints
in the same way as PyTorch.</p>
<p>It is usually needed to save and resume an experiment with model checkpoint.
DI-engine saves and loads checkpoints in the same way as PyTorch.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">ckpt_path</span> <span class="o">=</span> <span class="s1">&#39;path/to/your/ckpt&#39;</span>
<span class="n">state_dict</span> <span class="o">=</span> <span class="n">torch</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">ckpt_path</span><span class="p">,</span> <span class="n">map_location</span><span class="o">=</span><span class="s1">&#39;cpu&#39;</span><span class="p">)</span>
<span class="n">learner</span><span class="o">.</span><span class="n">policy</span><span class="o">.</span><span class="n">load_state_dict</span><span class="p">(</span><span class="n">state_dict</span><span class="p">)</span>
......@@ -414,7 +414,7 @@ in the same way as PyTorch.</p>
<span class="o">...</span>
<span class="n">dirname</span> <span class="o">=</span> <span class="s1">&#39;./ckpt_</span><span class="si">{}</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">learner</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
<span class="n">os</span><span class="o">.</span><span class="n">mkdir</span><span class="p">(</span><span class="n">dirname</span><span class="p">,</span> <span class="n">exsit_ok</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="n">os</span><span class="o">.</span><span class="n">mkdir</span><span class="p">(</span><span class="n">dirname</span><span class="p">,</span> <span class="n">exist_ok</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="n">ckpt_name</span> <span class="o">=</span> <span class="s1">&#39;iteration_</span><span class="si">{}</span><span class="s1">.pth.tar&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">learner</span><span class="o">.</span><span class="n">last_iter</span><span class="o">.</span><span class="n">val</span><span class="p">)</span>
<span class="n">path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">dirname</span><span class="p">,</span> <span class="n">ckpt_name</span><span class="p">)</span>
<span class="n">state_dict</span> <span class="o">=</span> <span class="n">learner</span><span class="o">.</span><span class="n">policy</span><span class="o">.</span><span class="n">state_dict</span><span class="p">()</span>
......@@ -423,9 +423,9 @@ in the same way as PyTorch.</p>
</pre></div>
</div>
<p>To deploy this in a more elegant way, DI-engine is configured to use
<a class="reference internal" href="../api_doc/worker/learner/learner.html#ding.worker.learner.learner_hook.LearnerHook" title="ding.worker.learner.learner_hook.LearnerHook"><code class="xref py py-class docutils literal notranslate"><span class="pre">Learner</span> <span class="pre">Hooks</span></code></a> to handle these cases. The saving hook is
automatically frequently called after training iterations. And to load &amp; save checkpoints at the beginning and
in the end, users can simply add one line code before &amp; after training as follow.</p>
<a class="reference internal" href="../api_doc/worker/learner/learner.html#ding.worker.learner.learner_hook.LearnerHook" title="ding.worker.learner.learner_hook.LearnerHook"><code class="xref py py-class docutils literal notranslate"><span class="pre">Learner</span> <span class="pre">Hook</span></code></a> to handle these cases. The saving hook is
automatically called after training iterations. And to load &amp; save checkpoints at the beginning and
in the end, users can simply add one-line code before &amp; after training as follows.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">learner</span><span class="o">.</span><span class="n">call_hook</span><span class="p">(</span><span class="s1">&#39;before_run&#39;</span><span class="p">)</span>
<span class="c1"># training loop</span>
......
......@@ -167,8 +167,8 @@
<h1>Tensorboard and Logging demo<a class="headerlink" href="#tensorboard-and-logging-demo" title="Permalink to this headline"></a></h1>
<div class="toctree-wrapper compound">
</div>
<p>In this page, the default tensorboard and logging information is detailly described. A <code class="docutils literal notranslate"><span class="pre">CartPole</span> <span class="pre">DQN</span></code> experiment
is used as example.</p>
<p>In this page, the default tensorboard and logging information is described in detail.
A <code class="docutils literal notranslate"><span class="pre">CartPole</span> <span class="pre">DQN</span></code> experiment is used as example.</p>
<div class="section" id="tensorboard-info">
<h2>Tensorboard info<a class="headerlink" href="#tensorboard-info" title="Permalink to this headline"></a></h2>
<p>There are 4 main parts in tensorboard: buffer, collector, learner and evaluator, corresponding to 4 modules.
......
此差异已折叠。
......@@ -38,7 +38,7 @@
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Architecture Design" href="../architecture/index.html" />
<link rel="prev" title="Code Comment" href="../guide/code_comment.html" />
<link rel="prev" title="Code Comment" href="../guide/code_comment_en.html" />
<link href="../_static/css/style.css" rel="stylesheet" type="text/css">
</head>
......@@ -395,7 +395,7 @@
<a href="../architecture/index.html" class="btn btn-neutral float-right" title="Architecture Design" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="../guide/code_comment.html" class="btn btn-neutral float-left" title="Code Comment" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
<a href="../guide/code_comment_en.html" class="btn btn-neutral float-left" title="Code Comment" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册