Skip to content

ViTPose#2183

Merged
echarlaix merged 8 commits into
huggingface:mainfrom
ariG23498:aritra/vitpose-onnx
Feb 18, 2025
Merged

ViTPose#2183
echarlaix merged 8 commits into
huggingface:mainfrom
ariG23498:aritra/vitpose-onnx

Conversation

@ariG23498

Copy link
Copy Markdown
Contributor

This PR will:

  1. Add the dummy inputs
  2. Build a small model
  3. Add test

CC: @xenova

I am following this guide. While @xenova has already taken care of the configurations and registry, I am trying to push this PR to the end line.

Currently the following works

from pathlib import Path
from optimum.exporters import TasksManager
from optimum.exporters.onnx import export
from transformers import VitPoseForPoseEstimation

base_model = VitPoseForPoseEstimation.from_pretrained("usyd-community/vitpose-base-simple")

onnx_path = Path("model.onnx")
onnx_config_constructor = TasksManager.get_exporter_config_constructor("onnx", base_model, library_name="transformers", task="keypoint-detection")
onnx_config = onnx_config_constructor(base_model.config)

print(onnx_config)

onnx_inputs, onnx_outputs = export(base_model, onnx_config, onnx_path, onnx_config.DEFAULT_ONNX_OPSET)

Are there any other immediate check that I need to perform?

@ariG23498
ariG23498 requested a review from xenova February 10, 2025 11:09

@xenova xenova left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @ariG23498! Could you merge the commits from #2098 into this PR too so we only have one PR to review/merge? Thanks!

@ariG23498
ariG23498 changed the base branch from vitpose-onnx to main February 11, 2025 06:27
@ariG23498

Copy link
Copy Markdown
Contributor Author

@xenova I have made the adjustments. Is it okay now?

@ariG23498
ariG23498 requested a review from xenova February 11, 2025 06:31
@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

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.

@xenova xenova mentioned this pull request Feb 11, 2025
3 tasks

@xenova xenova left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I added support for exporting models with num_experts>1 and things seem to work well. I've also created a tiny-random model which can be used for testing. Other than that, LGTM ✅

cc @echarlaix for final review :)

@xenova
xenova requested a review from echarlaix February 11, 2025 12:36

@echarlaix echarlaix left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good, thanks a lot !

@echarlaix
echarlaix merged commit 0245619 into huggingface:main Feb 18, 2025
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.

4 participants