pkg> add TuringCallbacks.jl</code></pre><h2 id="Visualizing-sampling-on-the-fly"><a class="docs-heading-anchor" href="#Visualizing-sampling-on-the-fly">Visualizing sampling on-the-fly</a><a id="Visualizing-sampling-on-the-fly-1"></a><a class="docs-heading-anchor-permalink" href="#Visualizing-sampling-on-the-fly" title="Permalink"></a></h2><p><code>TensorBoardCallback</code> is a wrapper around <code>Base.CoreLogging.AbstractLogger</code> which can be used to create a <code>callback</code> compatible with <code>Turing.sample</code>.</p><p>To actually visualize the results of the logging, you need to have installed <code>tensorboard</code> in Python. If you do not have <code>tensorboard</code> installed, it should hopefully be sufficient to just run</p><pre><code class="language-sh hljs">pip3 install tensorboard</code></pre><p>Then you can start up the <code>TensorBoard</code>:</p><pre><code class="language-sh hljs">python3 -m tensorboard.main --logdir tensorboard_logs/run</code></pre><p>Now we're ready to actually write some Julia code.</p><p>The following snippet demonstrates the usage of <code>TensorBoardCallback</code> on a simple model. This will write a set of statistics at each iteration to an event-file compatible with Tensorboard:</p><pre><code class="language-julia hljs">using Turing, TuringCallbacks
0 commit comments