Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ONNX export support for RT-DETR models #1930

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

xenova
Copy link
Contributor

@xenova xenova commented Jun 28, 2024

What does this PR do?

cc @merveenoyan

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?

@HuggingFaceDocBuilderDev

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.

Copy link
Contributor

@merveenoyan merveenoyan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tiny question that you likely know answer to

from transformers.onnx.utils import get_preprocessor

preprocessor = get_preprocessor(normalized_config._name_or_path)
if preprocessor is not None and hasattr(preprocessor, "size"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not an Optimum expert, just wanted to ask in what case preprocessor would be None and we'd proceed?

@fxmarty
Copy link
Contributor

fxmarty commented Jun 28, 2024

@xenova can you add a test?

@xenova
Copy link
Contributor Author

xenova commented Jun 28, 2024

Done! @fxmarty :) I also set CHW axes to be static (must be what the model was trained on)

@xenova
Copy link
Contributor Author

xenova commented Jun 28, 2024

static shapes might not be necessary actually: huggingface/transformers#31640

@MattLiutt
Copy link

MattLiutt commented Aug 16, 2024

Hi, may I know that if it's possible to run with onnxruntime instead of using optimum and obtaining model processor using HF pipeline? Also, I tried to export with Cuda but it seems not working. Is there anything I can tweak? Thanks again for the great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants