How to convert .pt file into .ptl (UnsupportedNodeError: GeneratorExp aren't supported)

Mansi_Sathawane: <p>I am referring below link for converting .pt to .ptl(PyTorch lite), Please check the code and please let me know if I am doing anything wrong - <a href="https://pytorch.org/tutorials/prototype/lite_interpreter.html" class="inline-onebox" rel="noopener nofollow ugc">(Prototype) Introduce lite interpreter workflow in Android and iOS — PyTorch Tutorials 1.9.0+cu102 documentation</a></p>
<p>here is my code -</p>
<p>import torch</p>
<p>model = torch.hub.load(‘ultralytics/yolov5’, ‘custom’,path=‘/content/drive/MyDrive/yolov5/runs/train/exp51/weights/last.pt’)</p>
<p>model.eval()</p>
<p>scripted_module = torch.jit.script(model)</p>
<p>scripted_module.save(“/content/drive/MyDrive/yolov5/runs/train/exp51/weights/last.pt”)</p>
<p>scripted_module._save_for_lite_interpreter(“/content/drive/MyDrive/yolov5/runs/train/exp51/weights/last.ptl”)</p>
<p>Error screenshot -<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/0/7/07c810567ceeeb31356433c5cd708765517ab6bf.png" data-download-href="https://discuss.pytorch.org/uploads/default/07c810567ceeeb31356433c5cd708765517ab6bf" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/0/7/07c810567ceeeb31356433c5cd708765517ab6bf_2_690x338.png" alt="image" data-base62-sha1="16PYzMnhYzU0BYs5eQXOHEwBNuv" width="690" height="338" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/0/7/07c810567ceeeb31356433c5cd708765517ab6bf_2_690x338.png, https://discuss.pytorch.org/uploads/default/optimized/3X/0/7/07c810567ceeeb31356433c5cd708765517ab6bf_2_1035x507.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/0/7/07c810567ceeeb31356433c5cd708765517ab6bf_2_1380x676.png 2x" data-dominant-color="F7F7F8"><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">1570×770 186 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>
<p>Is there any other way to convert the .pt file into .ptl?</p>

Sairaghavendra_Venka: <p><a href="https://github.com/raedle/YOLOExample" class="inline-onebox" rel="noopener nofollow ugc">GitHub - raedle/YOLOExample: Object detection example built with PyTorch Live and YOLOv5</a>. check this it will solve your problem.<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/7/3/7375336abaa23c833d479620ccb3f0e027797512.png" data-download-href="https://discuss.pytorch.org/uploads/default/7375336abaa23c833d479620ccb3f0e027797512" title="Screenshot from 2022-07-27 11-20-48"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/7/3/7375336abaa23c833d479620ccb3f0e027797512_2_549x500.png" alt="Screenshot from 2022-07-27 11-20-48" data-base62-sha1="gto0Fm9uTsCgbCEO7zTiy90ObNU" width="549" height="500" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/7/3/7375336abaa23c833d479620ccb3f0e027797512_2_549x500.png, https://discuss.pytorch.org/uploads/default/optimized/3X/7/3/7375336abaa23c833d479620ccb3f0e027797512_2_823x750.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/7/3/7375336abaa23c833d479620ccb3f0e027797512.png 2x" data-dominant-color="F3F4F5"><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">Screenshot from 2022-07-27 11-20-48</span><span class="informations">876×797 85.8 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>