zhiqwang / yolort

yolort is a runtime stack for yolov5 on specialized accelerators such as tensorrt, libtorch, onnxruntime, tvm and ncnn.
https://zhiqwang.com/yolort
GNU General Public License v3.0
708 stars 153 forks source link

SpeedUp with microsoft/nni #484

Open zhiqwang opened 1 year ago

zhiqwang commented 1 year ago

🚀 The feature

https://github.com/microsoft/nni/issues/5345

Motivation, pitch

To be updated

Alternatives

No response

Additional context

No response

chandan-wiai commented 1 year ago

Taking the discussion forward from here.

Does this mean, I can take my checkpoint trained on yolort.models.YOLOv5 and load as shown above, and that model object won't have 'transform' module?

Hi @chandan-wiai , I guess not in this scenario. There are no parameters or buffers in YOLOTransform modules, it should be easy theoretically. Maybe we should build the model as following from this api:

from yolort.models.yolo import yolov5_darknet_pan_s_r60  # aka yolov5s

model = yolov5_darknet_pan_s_r60()  # we do not specify pretrained=True, i.e. do not load default weights
model.load_state_dict(torch.load('checkpoint_from_yolort.pt'))
model.eval()

We can also discuss this ticket at https://github.com/zhiqwang/yolov5-rt-stack/issues/484 so as not to disturb more people for questions not related to nni.

Got it. Basically directly doing this step. I think this should help. Thanks.

chandan-wiai commented 1 year ago

BTW @zhiqwang , why return a nested tensor as it is done here because I don't see samples.image_sizes being used anywhere?

zhiqwang commented 1 year ago

Hi @chandan-wiai , NestedTensor can be removed I guess, I didn't do it because I'm working on other projects now. See https://github.com/zhiqwang/yolov5-rt-stack/issues/471 for more details, and contributions are welcome here.