     <div class='code'>
            <div class="highlight"><pre><span class="lineno">32</span><span class="nd">@torch</span><span class="o">.</span><span class="n">no_grad</span><span class="p">()</span>
<span class="lineno">33</span><span class="k">def</span> <span class="nf">sample</span><span class="p">(</span><span class="n">model</span><span class="p">:</span> <span class="n">GPT2LMHeadModel</span><span class="p">,</span> <span class="n">tokenizer</span><span class="p">:</span> <span class="n">GPT2Toke