optimum icon indicating copy to clipboard operation
optimum copied to clipboard

[RT-Detr] - Add RT-Detr Onnx Config

Open YHallouard opened this issue 1 year ago • 1 comments

What does this PR do?

  • Add RT-Detr Onnx config to optimum from this PR in transformers : https://github.com/huggingface/transformers/pull/33877

Fixes # (issue)

Before submitting

  • [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • [ ] Did you make sure to update the documentation with your changes?
  • [ ] Did you write any new necessary tests?

Who can review?

YHallouard avatar Oct 06 '24 11:10 YHallouard

Hi @fxmarty, @echarlaix, @JingyaHuang, @michaelbenayoun,

I'm creating this PR following @qubvel and @ArthurZucker advices on that PR: https://github.com/huggingface/transformers/pull/33877

YHallouard avatar Oct 06 '24 11:10 YHallouard

Hi @echarlaix, thanks for the review!

I added "PekingU/rtdetr_r18vd" for testing, but I saw that you used hf-internal-testing. Should I create a random initiated model their ?

YHallouard avatar Oct 27 '24 14:10 YHallouard

Hi @echarlaix, what are your insights ? I made the changes but should I create a random initiated model in hf-internal-testing ?

YHallouard avatar Dec 03 '24 13:12 YHallouard

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Apologies for the delay @YHallouard, just fixed the conflicts so that we can soon merge. Two things must be fixed before we can merge :

  • it seems that the height / width used for export needs to have a minimum size (won't work with default value 64) failing at https://github.com/huggingface/transformers/blob/deac971c469bcbb182c2e52da0b82fb3bf54cccf/src/transformers/models/rt_detr/modeling_rt_detr.py#L1900 as we need enc_outputs_class.shape[1] >= config.num_queries : can be fixed by overwriting _create_dummy_input_generator_classes and give an appropriate default value for height and width (+ raising an error if value not correctly provided)
  • it seems pixel_mask is considered as a constant during export and thus removed from the graph inputs

echarlaix avatar Dec 17 '24 17:12 echarlaix

Looks like this task got stuck, do you need any help on it? Would be really great to have RT-DETR exporter for onnx.

ggolda avatar Jan 16 '25 22:01 ggolda

Closed with https://github.com/huggingface/optimum/pull/2201

echarlaix avatar Mar 03 '25 17:03 echarlaix