-
Notifications
You must be signed in to change notification settings - Fork 31.9k
Add OneFormer Model #20577
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 OneFormer Model #20577
Conversation
67aa7cd to
aa3ca0c
Compare
|
The documentation is not available anymore as the PR was closed or merged. |
aa3ca0c to
3b06567
Compare
a42bb67 to
8f087ca
Compare
|
Hi @praeclarumjj3, thanks a lot for your PR. It's awesome OneFormer will be available in the library (we already have MaskFormer and plan to add Mask2Former as well). I've got 2 main points for now: BackbonesHowever, there's no need to implement backbones from scratch again, as we've just added the Next, the framework (like OneFormer) can use the The plan is to next add Auto classI doubt there's a need for an Will soon do a more in depth review! Thanks already for all your work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@praeclarumjj3 thank you for working on this! Seems like you already made very good progress, my main comments are:
- As Niels suggested, you can create and/or leverage the XXXBackbone classes. The SwinBackbone PR will be merged shortly so you can just focus on the DinatBackbone class.
- The current code is CUDA dependent (correct me if I'm wrong). I took a look at the paper and the Pixel Decoder seems very similar to that of Mask2Former (also uses multi-scale deformable attention). Perhaps you could use their PyTorch implementation to get rid of the CUDA scripts, here is the relevant Mask2Former code.
- I think having a OneFormerForUniversalSegmentation class makes sense but we can add it to auto mapping for instance segmentation instead of creating a new mapping for simplicity.
I will do a detailed review once the custom CUDA scripts are cleaned up.
Thanks again :)
Thanks for the suggestions @alaradirik! I will work on using AutoBackbone classes everywhere. About the CUDA code, sure, the PyTorch code is already there, we just check for the presence of GPU. I will clean the CUDA files. Also, I believe you tagged the wrong person by mistake 😂.
I still think it's better to create a different |
Great, that makes things much easier then, and sorry about tagging the wrong person :)
MaskFormer and Mask2Former (in progress in another PR) also feature universal segmentation architectures and I agree that new research will likely leverage the same paradigm. In retrospect, creating an auto mapping for universal segmentation and adding MaskFormer and Mask2Former along with OneFormer might be better. @NielsRogge what do you think about this? |
a2c4071 to
8bbaade
Compare
d476d2d to
76419ab
Compare
|
Thanks for all your work! Merging now. |
|
Hi @praeclarumjj3 Thank you for adding this model! There are a few examples in the docstrings failing the CI. For example, in >>> # you can pass them to feature_extractor for instance postprocessing
>>> predicted_instance_map = feature_extractor.post_process_instance_segmentation(the Would you like to make them fixed 🙏 ? If so, you can run the doctest like (if you have some change in the branch, stage them first) python3 utils/prepare_for_doc_test.py src docsthen python3 -m pytest -v --make-reports doc_tests_gpu --doctest-modules src/transformers/models/gptj/modeling_gptj.py::transformers.models.gptj.modeling_gptj.GPTJForSequenceClassification.forward -sv --doctest-continue-on-failure --doctest-glob="*.mdx"and also python3 -m pytest -v --make-reports doc_tests_gpu --doctest-modules src/transformers/models/oneformer/modeling_oneformer.py::transformers.models.oneformer.modeling_oneformer.OneFormerModel.forward -sv --doctest-continue-on-failure --doctest-glob="*.mdx"After running the doctests, discard the change produced by Don't hesitate if you have further question, or if you could not find time on this at this moment (our team will fix it then) 🙏 Thank you |
|
Hi @ydshieh, thanks for pointing this out to me. I apologize for not fixing the docstrings in the original PR (missed the changes after changing the code in an older commit). I have opened a new PR with the inconsistencies fixed: #21215. Please take a look and let me know if something's still broken. And thanks for letting me know about the doctests! ✌🏻 |
What does this PR do?
Adds the Code, Documentation, and Tests for OneFormer proposed in OneFormer: One Transformer to Rule Universal Image Segmentation. I have also opened a PR to add the documentation images to
huggingface/documentation-images.I have also made changes to the
ImageSegmentationPipelineto accommodate OneFormer.Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
@patrickvonplaten @NielsRogge