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

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 - (Prototype) Introduce lite interpreter workflow in Android and iOS — PyTorch Tutorials 1.9.0+cu102 documentation

here is my code -

import torch

model = torch.hub.load(‘ultralytics/yolov5’, ‘custom’,path=’/content/drive/MyDrive/yolov5/runs/train/exp51/weights/’)


scripted_module = torch.jit.script(model)"/content/drive/MyDrive/yolov5/runs/train/exp51/weights/")


Error screenshot -

Is there any other way to convert the .pt file into .ptl?

GitHub - raedle/YOLOExample: Object detection example built with PyTorch Live and YOLOv5. check this it will solve your problem.