GithubHelp home page GithubHelp logo

Comments (4)

nobody-cheng avatar nobody-cheng commented on May 22, 2024 1

This is reserved for the target torchscript model to be generated. Fell free to delete this line! If you want to save the generated model, you can do something as following:

model_script.save(export_script_name)

ths
ultralytics/yolov5 code

model.model[-1].export = False  # set
python models/export.py --weights ./runs/train/exp5/weights/best.pt --img 640 --batch 1

it work

from yolort.

zhiqwang avatar zhiqwang commented on May 22, 2024

Hi @nobody-cheng ,

Are you interested in the python side or the cpp side?

If you want to use python, you could check this notebook, and if you are interested in the Cpp backend, you could check the unit-test, and we provided an C++ example of how to infer with the transformed torchscript model, but this example is a little outdated.

BTW the upstream PyTorch have refactored their interfaces of torchscript recently, I've only updated the unit-test to PyTorch 1.8. The example in deployment only works in PyTorch 1.7.x. I will update the example in deployment to PyTorch 1.8 soon.

from yolort.

nobody-cheng avatar nobody-cheng commented on May 22, 2024

Hi @nobody-cheng ,

Are you interested in the python side or the cpp side?

If you want to use python, you could check this notebook, and if you are interested in the Cpp backend, you could check the unit-test, and we provided an C++ example of how to infer with the transformed torchscript model, but this example is a little outdated.

BTW the upstream PyTorch have refactored their interfaces of torchscript recently, I've only updated the unit-test to PyTorch 1.8. The example in deployment only works in PyTorch 1.7.x. I will update the example in deployment to PyTorch 1.8 soon.

# TorchScript export
print(f'Starting TorchScript export with torch {torch.__version__}...')
export_script_name = './checkpoints/yolov5/yolov5s.torchscript.pt'  # >>>>>>> ** Variable is not called **

model_script = torch.jit.script(model)
model_script.eval()
model_script = model_script.to(device)

x = img[None]
out = model(x)
out_script = model_script(x)

export_script_name Variable is not called

from yolort.

zhiqwang avatar zhiqwang commented on May 22, 2024

Hi @nobody-cheng ,

This is reserved for the target torchscript model to be generated. Fell free to delete this line! If you want to save the generated model, you can do something as following:

model_script.save(export_script_name)

from yolort.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.