Deci-AI / super-gradients

Easily train or fine-tune SOTA computer vision models with one open source training library. The home of Yolo-NAS.
https://www.supergradients.com
Apache License 2.0
4.58k stars 509 forks source link

pth or onnx -> pb #1917

Closed 6894556 closed 6 months ago

6894556 commented 7 months ago

💡 Your Question

Hi, I've followed yolo_nas_custom_dataset_fine_tuning_with_qat.ipynb this tutorial notebook. And I've got 'ckpt_best.pth' and 'yolo_nas_m_cppe-5_qat_1x3x640x640_ptq.onnx' at my ckpt directory. Now I want convert this model to pb file (frozenGraph or savedModel). So I've googled and built the theory as follows:

# In Theory
import torch
from your_model_module import ModelClass

pth_path = "experiments/yolo_nas_m_cppe-5_qat/RUN_20240222_201118_772223/ckpt_best.pth"
model_state_dict = torch.load(pth_path)
print(model_state_dict.keys())

model = ModelClass()
model_state_dict = torch.load(pth_path)
model.load_state_dict(model_state_dict)

model.eval()

# pytorch2keras

How can I instantiate ModelClass , in this case YOLO_NAS_M, and load state dictionary and run model.eval()?

Thanks.

Versions

super-gradients 3.6.1 onnx 1.15.0 onnx-tf 1.9.0 onnx2keras 0.0.24 onnx2tf 1.17.5 onnxoptimizer 0.3.13 onnxruntime 1.15.0

BloodAxe commented 6 months ago

frozenGraph or savedModel suggest Tensorflow models. It is unclear for me why it is mentioned in the context of this repo. Please clarify your question since I'm unable to follow your question.