-
Notifications
You must be signed in to change notification settings - Fork 28.2k
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
[WIP]Add ViTPose to Transformers #25001
Conversation
@amyeroberts weights for ViTPose are in PyTorch checkpoint files, should I convert them into .bin or something else? |
@shauray8 You will want to write a conversion script, which translates the names of the weights in the state dict to their equivalent in transformers. These weights will then be loaded into the transformers model. Then we save the transformers model using For this model, because the encoder is ViT, the translation of these weights will follow a similar pattern to the conversion script here: https://github.com/huggingface/transformers/blob/main/src/transformers/models/vit/convert_vit_timm_to_pytorch.py Similarly, the encoder structure can be implemented directly by using If you haven't seen it already, I'd also suggest looking through this doc as it covers in detail all the steps for adding a model to transformers. |
Thank you for the information and the link to the conversion script for ViT. |
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. |
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
@shauray8 Are you still actively working on this model addition? If you don't have the capacity to address it at the moment, we could open up to someone else in the community to take over. Let us know if you have any questions about the implementation. |
Hi, @amyeroberts I'm sorry for not keeping you informed on this, it was a little time-consuming transferring everything from mmcv especially, I think I've done most of it correctly, But it does not work as it should, the only thing I can think of is I have not transferred the weights correctly (I might be totally wrong though), If that's the case maybe I can still find some time and fix it. |
@shauray8 Let us know if you need help in getting it across the line. When you say that it's not working well - what tests are you running to confirm this? If you pass the same image to the mmcv implementation and this one, do you get the same outputs? If not, how about the same activations in the first layer? Debugging like this will help you pinpoint where the issue might be. |
Yes, I did compare to the results from the original code, that's the only test I did, I'll try debugging it step by step as you said and let you know If I need any help, maybe I'll try doing at faster this time |
@amyeroberts While debugging I couldn't find any non-trivial differences, opening it for the community again. |
What does this PR do?
Adds ViTPose to Huggingface/Transformers
Code and weights: https://github.com/ViTAE-Transformer/ViTPose
Paper: https://arxiv.org/abs/2204.12484
Fixes #24915
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@amyeroberts