Skip to content

Commit

Permalink
Deployed c58978c to latest with MkDocs 1.6.1 and mike 2.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Dec 21, 2024
1 parent 784744e commit 69ec0e0
Show file tree
Hide file tree
Showing 15 changed files with 650 additions and 1,370 deletions.
8 changes: 4 additions & 4 deletions latest/guides/customization/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1510,8 +1510,8 @@ <h2 id="enriching-benchmark-metadata-with-context-values">Enriching benchmark me
<div class="language-python highlight"><pre><span></span><code><span id="__span-3-1"><a id="__codelineno-3-1" name="__codelineno-3-1" href="#__codelineno-3-1"></a><span class="kn">import</span> <span class="nn">nnbench</span>
</span><span id="__span-3-2"><a id="__codelineno-3-2" name="__codelineno-3-2" href="#__codelineno-3-2"></a>
</span><span id="__span-3-3"><a id="__codelineno-3-3" name="__codelineno-3-3" href="#__codelineno-3-3"></a><span class="c1"># uses the `platinfo` context provider from above to log platform metadata.</span>
</span><span id="__span-3-4"><a id="__codelineno-3-4" name="__codelineno-3-4" href="#__codelineno-3-4"></a><span class="n">runner</span> <span class="o">=</span> <span class="n">nnbench</span><span class="o">.</span><span class="n">BenchmarkRunner</span><span class="p">()</span>
</span><span id="__span-3-5"><a id="__codelineno-3-5" name="__codelineno-3-5" href="#__codelineno-3-5"></a><span class="n">result</span> <span class="o">=</span> <span class="n">runner</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="vm">__name__</span><span class="p">,</span> <span class="n">params</span><span class="o">=</span><span class="p">{},</span> <span class="n">context</span><span class="o">=</span><span class="p">[</span><span class="n">platinfo</span><span class="p">])</span>
</span><span id="__span-3-4"><a id="__codelineno-3-4" name="__codelineno-3-4" href="#__codelineno-3-4"></a><span class="n">benchmarks</span> <span class="o">=</span> <span class="n">nnbench</span><span class="o">.</span><span class="n">collect</span><span class="p">(</span><span class="vm">__name__</span><span class="p">)</span>
</span><span id="__span-3-5"><a id="__codelineno-3-5" name="__codelineno-3-5" href="#__codelineno-3-5"></a><span class="n">result</span> <span class="o">=</span> <span class="n">nnbench</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">benchmarks</span><span class="p">,</span> <span class="n">params</span><span class="o">=</span><span class="p">{},</span> <span class="n">context</span><span class="o">=</span><span class="p">[</span><span class="n">platinfo</span><span class="p">])</span>
</span></code></pre></div>
<h2 id="being-type-safe-by-using-nnbenchparameters">Being type safe by using <code>nnbench.Parameters</code><a class="headerlink" href="#being-type-safe-by-using-nnbenchparameters" title="Permanent link">&para;</a></h2>
<p>Instead of specifying your benchmark's parameters by using a raw Python dictionary, you can define a custom subclass of <code>nnbench.Parameters</code>:</p>
Expand All @@ -1531,8 +1531,8 @@ <h2 id="being-type-safe-by-using-nnbenchparameters">Being type safe by using <co
</span><span id="__span-4-14"><a id="__codelineno-4-14" name="__codelineno-4-14" href="#__codelineno-4-14"></a>
</span><span id="__span-4-15"><a id="__codelineno-4-15" name="__codelineno-4-15" href="#__codelineno-4-15"></a>
</span><span id="__span-4-16"><a id="__codelineno-4-16" name="__codelineno-4-16" href="#__codelineno-4-16"></a><span class="n">params</span> <span class="o">=</span> <span class="n">MyParams</span><span class="p">(</span><span class="n">a</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">b</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>
</span><span id="__span-4-17"><a id="__codelineno-4-17" name="__codelineno-4-17" href="#__codelineno-4-17"></a><span class="n">runner</span> <span class="o">=</span> <span class="n">nnbench</span><span class="o">.</span><span class="n">BenchmarkRunner</span><span class="p">()</span>
</span><span id="__span-4-18"><a id="__codelineno-4-18" name="__codelineno-4-18" href="#__codelineno-4-18"></a><span class="n">result</span> <span class="o">=</span> <span class="n">runner</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="vm">__name__</span><span class="p">,</span> <span class="n">params</span><span class="o">=</span><span class="n">params</span><span class="p">)</span>
</span><span id="__span-4-17"><a id="__codelineno-4-17" name="__codelineno-4-17" href="#__codelineno-4-17"></a><span class="n">benchmarks</span> <span class="o">=</span> <span class="n">nnbench</span><span class="o">.</span><span class="n">collect</span><span class="p">(</span><span class="vm">__name__</span><span class="p">)</span>
</span><span id="__span-4-18"><a id="__codelineno-4-18" name="__codelineno-4-18" href="#__codelineno-4-18"></a><span class="n">result</span> <span class="o">=</span> <span class="n">nnbench</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">benchmarks</span><span class="p">,</span> <span class="n">params</span><span class="o">=</span><span class="n">params</span><span class="p">)</span>
</span></code></pre></div>
<p>While this does not have a concrete advantage in terms of type safety over a raw dictionary, it guards against accidental modification of parameters breaking reproducibility.</p>

Expand Down
4 changes: 2 additions & 2 deletions latest/guides/organization/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1502,8 +1502,8 @@ <h2 id="tip-3-attach-tags-to-benchmarks-for-selective-filtering">Tip 3: Attach t
<p>Now, to only run data quality benchmarks marked "foo", pass the corresponding tag to <code>BenchmarkRunner.run()</code>:</p>
<div class="language-python highlight"><pre><span></span><code><span id="__span-4-1"><a id="__codelineno-4-1" name="__codelineno-4-1" href="#__codelineno-4-1"></a><span class="kn">import</span> <span class="nn">nnbench</span>
</span><span id="__span-4-2"><a id="__codelineno-4-2" name="__codelineno-4-2" href="#__codelineno-4-2"></a>
</span><span id="__span-4-3"><a id="__codelineno-4-3" name="__codelineno-4-3" href="#__codelineno-4-3"></a><span class="n">runner</span> <span class="o">=</span> <span class="n">nnbench</span><span class="o">.</span><span class="n">BenchmarkRunner</span><span class="p">()</span>
</span><span id="__span-4-4"><a id="__codelineno-4-4" name="__codelineno-4-4" href="#__codelineno-4-4"></a><span class="n">foo_data_metrics</span> <span class="o">=</span> <span class="n">runner</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="s2">&quot;benchmarks/data_quality.py&quot;</span><span class="p">,</span> <span class="n">params</span><span class="o">=...</span><span class="p">,</span> <span class="n">tags</span><span class="o">=</span><span class="p">(</span><span class="s2">&quot;foo&quot;</span><span class="p">,))</span>
</span><span id="__span-4-3"><a id="__codelineno-4-3" name="__codelineno-4-3" href="#__codelineno-4-3"></a><span class="n">benchmarks</span> <span class="o">=</span> <span class="n">nnbench</span><span class="o">.</span><span class="n">collect</span><span class="p">(</span><span class="s2">&quot;benchmarks/data_quality.py&quot;</span><span class="p">,</span> <span class="n">tags</span><span class="o">=</span><span class="p">(</span><span class="s2">&quot;foo&quot;</span><span class="p">,))</span>
</span><span id="__span-4-4"><a id="__codelineno-4-4" name="__codelineno-4-4" href="#__codelineno-4-4"></a><span class="n">foo_data_metrics</span> <span class="o">=</span> <span class="n">nnbench</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">benchmarks</span><span class="p">,</span> <span class="n">params</span><span class="o">=...</span><span class="p">,</span> <span class="p">)</span>
</span></code></pre></div>
<div class="admonition tip">
<p class="admonition-title">Tip</p>
Expand Down
Loading

0 comments on commit 69ec0e0

Please sign in to comment.