-
Notifications
You must be signed in to change notification settings - Fork 27.8k
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
Fix segformer reshape last stage #15748
base: main
Are you sure you want to change the base?
Fix segformer reshape last stage #15748
Conversation
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. |
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.
This is indeed a breaking change, and before doing it we should make sure there are no configurations in the wild with this parameter set to False.
I am not sure if anyone has done this because there are no use cases for this.
It's not sufficient, we need to actually be sure before moving forward with this, cc @LysandreJik
932f4a0
to
982ba0b
Compare
if "reshape_last_stage" in kwargs: | ||
warnings.warn(DEPRECATION_WARNING, FutureWarning) |
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.
This warning will be issued for the models in the Hub that contain this in their config. So, those configs should be updated to remove that attribute.
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.
Yes, can I remove it after we have a new version of Transformers?
What does this PR do?
This PR improves SegFormer by removing the
reshape_last_stage
attribute of the configuration. In fact, this attribute was not needed at all.Previously, the
reshape_last_stage
argument was set toFalse
forSegformerForImageClassification
models, however it's perfectly fine to reshape afterwards within this head model.@sgugger I know you'll warn me about this being a breaking change. Here's why I think this change will not have an impact:
reshape_last_stage
was set toTrue
by default in the configuration. As this PR only removes the ability to set this toFalse
, the only use case in which this might be a breaking change is in case one defined aSegformerModel
withconfig.reshape_last_stage = False
. I am not sure if anyone has done this because there are no use cases for this.