-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Adding SegGPT #27735
Adding SegGPT #27735
Conversation
@NielsRogge just pinging you here |
Co-authored-by: NielsRogge <[email protected]>
Hey @NielsRogge, could you take a look at the PR? Code quality is failing, but is unrelated and the documentation tests I don't know what is going on because it's failing on an example that it's not even in the |
Co-authored-by: amyeroberts <[email protected]>
Co-authored-by: amyeroberts <[email protected]>
Co-authored-by: amyeroberts <[email protected]>
Co-authored-by: amyeroberts <[email protected]>
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.
Awesome work! Thanks for all the work adding and iterating on this
Just some tiny nits. Please do not just mark comments as resolved when they are not - if you don't think the suggestion should be applied then comment with why on the comment before marking.
Main thing left to do is update all the checkpoints and make sure all the model tests (incl slow) pass with these checkpoints. Once that's all done it'll be ready to merge :)
] | ||
|
||
|
||
def patchify(tensor: torch.Tensor, patch_size: int) -> torch.Tensor: |
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.
Still not resolved! These should go just above the SegGptLoss definition
Co-authored-by: amyeroberts <[email protected]>
@amyeroberts what do you mean by updating the checkpoints? Move to the appropriate org or re-upload them (it's just one) with the conversion script. |
@EduardoPach The checkpoints should be uploaded under the correct org - @NielsRogge can help you with that. Then all the checkpoint references in this PR need to be updated to point to the right location |
Hey @amyeroberts checkpoints were moved and tests are green |
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.
Thanks for all the work adding this model - great addition! 💪
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. |
* First commit * Improvements * More improvements * Converted original checkpoint to HF checkpoint * Fix style * Fixed forward * More improvements * More improvements * Update src/transformers/models/seggpt/modeling_seggpt.py Co-authored-by: NielsRogge <[email protected]> * Remove asserts * Remove unnecessary attributes * Changed model name to camel case * Improve forward doc * Improve tests * More improvements * Fix copies * Fix doc * Make SegGptImageProcessor more flexible * Added few-shot test * Fix style * Update READMEs and docs * Update READMEs * Make inputs required * Add SegGptForImageSegmentation * Make tests pass * Rename to out_indicies * Update src/transformers/models/seggpt/image_processing_seggpt.py Co-authored-by: NielsRogge <[email protected]> * Update src/transformers/models/seggpt/image_processing_seggpt.py Co-authored-by: NielsRogge <[email protected]> * Fixed naming convention * Copying SegGptMlp from modeling_sam.py * Some minor improvements * Remove mlp_ratio * Fix docstrings * Fixed docstring match * Objects defined before use * Storing only patch_size and beta for SegGptLoss * removed _prepare_inputs method * Removed modified from headers * Renamed to output_indicies * Removed unnecessary einsums * Update tests/models/seggpt/test_modeling_seggpt.py Co-authored-by: amyeroberts <[email protected]> * Update tests/models/seggpt/test_modeling_seggpt.py Co-authored-by: amyeroberts <[email protected]> * Update tests/models/seggpt/test_modeling_seggpt.py Co-authored-by: amyeroberts <[email protected]> * Update src/transformers/models/seggpt/image_processing_seggpt.py Co-authored-by: amyeroberts <[email protected]> * Update src/transformers/models/seggpt/image_processing_seggpt.py Co-authored-by: amyeroberts <[email protected]> * Update src/transformers/models/seggpt/image_processing_seggpt.py Co-authored-by: amyeroberts <[email protected]> * Update src/transformers/models/seggpt/modeling_seggpt.py Co-authored-by: amyeroberts <[email protected]> * Update src/transformers/models/seggpt/modeling_seggpt.py Co-authored-by: amyeroberts <[email protected]> * Fixing issues * Raise error as soon as possible * More fixes * Fix merge * Added palette to SegGptImageProcessor * Fixed typo * Fixed shape typo * Added permute before doing palette to class mapping * Fixed style * Fixed and added tests * Fixed docstrings * Matching SegFormer API for post_processing_semantic_segmentation * Fixed copies * Fixed SegGptImageProcessor to handle both binary and RGB masks * Updated docstrings of SegGptImageProcessor * Update src/transformers/models/seggpt/image_processing_seggpt.py Co-authored-by: amyeroberts <[email protected]> * Update docs/source/en/model_doc/seggpt.md Co-authored-by: amyeroberts <[email protected]> * Update src/transformers/models/seggpt/configuration_seggpt.py Co-authored-by: amyeroberts <[email protected]> * Update src/transformers/models/seggpt/convert_seggpt_to_hf.py Co-authored-by: amyeroberts <[email protected]> * Update src/transformers/models/seggpt/image_processing_seggpt.py Co-authored-by: amyeroberts <[email protected]> * Update src/transformers/models/seggpt/modeling_seggpt.py Co-authored-by: amyeroberts <[email protected]> * Update src/transformers/models/seggpt/image_processing_seggpt.py Co-authored-by: amyeroberts <[email protected]> * Update src/transformers/models/seggpt/image_processing_seggpt.py Co-authored-by: amyeroberts <[email protected]> * Update src/transformers/models/seggpt/image_processing_seggpt.py Co-authored-by: amyeroberts <[email protected]> * Update src/transformers/models/seggpt/modeling_seggpt.py Co-authored-by: amyeroberts <[email protected]> * Update tests/models/seggpt/test_image_processing_seggpt.py Co-authored-by: amyeroberts <[email protected]> * Update tests/models/seggpt/test_modeling_seggpt.py Co-authored-by: amyeroberts <[email protected]> * Update src/transformers/models/seggpt/modeling_seggpt.py Co-authored-by: amyeroberts <[email protected]> * Update src/transformers/models/seggpt/modeling_seggpt.py Co-authored-by: amyeroberts <[email protected]> * Update src/transformers/models/seggpt/modeling_seggpt.py Co-authored-by: amyeroberts <[email protected]> * Object definitions above & fix style * Renamed output_indices to intermediate_feature_indices * Removed unnecessary check on bool_masked_pos * Loss first in the outputs * Added validation for do_normalize * Improved SegGptImageProcessor and added new tests * Added comment * Added docstrings to SegGptLoss * Reimplemented ensemble condition logic in SegGptEncoder * Update src/transformers/models/seggpt/__init__.py Co-authored-by: NielsRogge <[email protected]> * Update src/transformers/models/seggpt/modeling_seggpt.py Co-authored-by: NielsRogge <[email protected]> * Update src/transformers/models/seggpt/convert_seggpt_to_hf.py Co-authored-by: NielsRogge <[email protected]> * Update src/transformers/models/seggpt/configuration_seggpt.py Co-authored-by: NielsRogge <[email protected]> * Updated docstrings to use post_process_semantic_segmentation * Fixed typo on docstrings * moved pixel values test to test_image_processing_seggpt * Addressed comments * Update src/transformers/models/seggpt/configuration_seggpt.py Co-authored-by: amyeroberts <[email protected]> * Update src/transformers/models/seggpt/image_processing_seggpt.py Co-authored-by: amyeroberts <[email protected]> * Update src/transformers/models/seggpt/configuration_seggpt.py Co-authored-by: amyeroberts <[email protected]> * Update src/transformers/models/seggpt/modeling_seggpt.py Co-authored-by: amyeroberts <[email protected]> * Updated docstrings for SegGptLoss * Address comments * Added SegGpt example to model docs * Update src/transformers/models/seggpt/modeling_seggpt.py Co-authored-by: amyeroberts <[email protected]> * moved patchify and unpatchify * Rename checkpoint * Renamed intermediate_features to intermediate_hidden_states for consistency * Update src/transformers/models/seggpt/configuration_seggpt.py Co-authored-by: NielsRogge <[email protected]> * Replaced post_process_masks for post_process_semantic_segmentation in the docs --------- Co-authored-by: NielsRogge <[email protected]> Co-authored-by: Niels <[email protected]> Co-authored-by: Eduardo Pacheco <[email protected]> Co-authored-by: amyeroberts <[email protected]>
What does this PR do?
This PR adds
SegGPT
to the transformers libraryFixes #27514
TO-DOs
ImageProcessor