Unable to save the model in TorchScript format?

iamexperimentingnow: <p>I’m trying to save my model in TorchScript format, but unfortunately getting errors.</p>
<h2><a name="what-you-have-already-tried-1" class="anchor" href="#what-you-have-already-tried-1"></a>What you have already tried</h2>
<p><code>torch.jit.script(model)</code></p>
<h2><a name="environment-2" class="anchor" href="#environment-2"></a>Environment</h2>
<p>python</p>
<blockquote>
<p>Build information about Torch-TensorRT can be found by turning on debug messages</p>
</blockquote>
<ul>
<li>PyTorch Version (e.g., 1.0):1.11.0+cu113</li>
<li>CPU Architecture:</li>
<li>OS (e.g., Linux): ubuntu 20.04</li>
<li>How you installed PyTorch (<code>conda</code>, <code>pip</code>, <code>libtorch</code>, source): pip</li>
<li>Build command you used (if compiling from source):</li>
<li>Are you using local sources or building from archives:</li>
<li>Python version:3.9.7</li>
<li>CUDA version:11.7</li>
<li>GPU models and configuration: RTX GEFORCE 2060</li>
<li>Any other relevant information:</li>
</ul>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/7/e/7e264f0357986feccf6427a8d2a8b6f06959129e.png" data-download-href="https://discuss.pytorch.org/uploads/default/7e264f0357986feccf6427a8d2a8b6f06959129e" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/7/e/7e264f0357986feccf6427a8d2a8b6f06959129e_2_690x388.png" alt="image" data-base62-sha1="hZYeHG74na1togHinZ3EswbNCEK" width="690" height="388" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/7/e/7e264f0357986feccf6427a8d2a8b6f06959129e_2_690x388.png, https://discuss.pytorch.org/uploads/default/optimized/3X/7/e/7e264f0357986feccf6427a8d2a8b6f06959129e_2_1035x582.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/7/e/7e264f0357986feccf6427a8d2a8b6f06959129e_2_1380x776.png 2x" data-dominant-color="3C1B32"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">1920×1080 394 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
<h2><a name="to-reproduce-3" class="anchor" href="#to-reproduce-3"></a>To Reproduce</h2>
<p>please find the original git repo. Here, I’m using <code>ade20k-hrnetv2.yaml</code> config file.</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://github.com/CSAILVision/semantic-segmentation-pytorch">
  <header class="source">
      <img src="https://github.githubassets.com/favicons/favicon.svg" class="site-icon" width="32" height="32">

      <a href="https://github.com/CSAILVision/semantic-segmentation-pytorch" target="_blank" rel="noopener nofollow ugc">GitHub</a>
  </header>

  <article class="onebox-body">
    <div class="aspect-image" style="--aspect-ratio:690/344;"><img src="https://opengraph.githubassets.com/a9cdfa5321964e5c753904082779fcc13a4897f613b47a0e61ed34d6bbaf53ac/CSAILVision/semantic-segmentation-pytorch" class="thumbnail" width="690" height="345"></div>

<h3><a href="https://github.com/CSAILVision/semantic-segmentation-pytorch" target="_blank" rel="noopener nofollow ugc">GitHub - CSAILVision/semantic-segmentation-pytorch: Pytorch implementation...</a></h3>

  <p>Pytorch implementation for Semantic Segmentation/Scene Parsing on MIT ADE20K dataset - GitHub - CSAILVision/semantic-segmentation-pytorch: Pytorch implementation for Semantic Segmentation/Scene Par...</p>


  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>

<p><a class="mention" href="/u/ptrblck">@ptrblck</a></p>