-
Notifications
You must be signed in to change notification settings - Fork 30.9k
Remove device parameter from create_extended_attention_mask_for_decoder #16894
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
Remove device parameter from create_extended_attention_mask_for_decoder #16894
Conversation
9eaea11 to
5d59df5
Compare
|
The documentation is not available anymore as the PR was closed or merged. |
|
This seems legit for me, pinging @LysandreJik, @sgugger and @ydshieh to comment on this. |
|
LGTM, as it uses the device from the argument Thank you for reducing the potential issue! (Please wait the approvals from sgugger or LysandreJik before merge 🙏 ) |
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 your PR. Removing arguments from public methods is a bit of a breaking change (even if I don't expect many users to use those directly) so since it's very easy to avoid it here and raise a proper deprecation warning, I would like to this added before we merge.
Also, the first two research projects should not be touched.
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 example is pinned to Transformers == 3.5.1 so don't make any change there.
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.
Same here.
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.
Same here.
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 one can be updated as it's not pinned.
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 one can be updated as it's not pinned.
src/transformers/modeling_utils.py
Outdated
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.
Removing an argument from a public method like this is a breaking change, so we should continue to accept if with a default of None than raise a deprecation warning if we detect it's not None telling the user that argument is not used anymore and will be removed in v5 of Transformers.
src/transformers/modeling_utils.py
Outdated
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.
Removing an argument from a public method like this is a breaking change, so we should continue to accept if with a default of None than raise a deprecation warning if we detect it's not None telling the user that argument is not used anymore and will be removed in v5 of Transformers.
src/transformers/modeling_utils.py
Outdated
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.
Same here.
src/transformers/modeling_utils.py
Outdated
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.
Same here.
1326012 to
994597c
Compare
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 example is pinned to Transformers == 3.5.1 so don't make any change there.
src/transformers/modeling_utils.py
Outdated
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.
| warnings.warn("`device` is deprecated and will be removed in v5 of Transformers.") | |
| warnings.warn("The `device` argument is deprecated and will be removed in v5 of Transformers.", FutureWarning) |
src/transformers/modeling_utils.py
Outdated
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.
Remove the documentation entirely for a deprecated argument.
src/transformers/modeling_utils.py
Outdated
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.
| warnings.warn("`device` is deprecated and will be removed in v5 of Transformers.") | |
| warnings.warn("The `device` argument is deprecated and will be removed in v5 of Transformers.", FutureWarning) |
994597c to
91758cf
Compare
91758cf to
209647b
Compare
|
@sgugger thanks for the code review! all comments have been addressed |
|
Thanks! Pinging @LysandreJik for final review :-) |
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.
LGTM, thanks @pbelevich!
What does this PR do?
This RP removes redundant
deviceparameter fromcreate_extended_attention_mask_for_decoderthat may cause potential issues if passeddeviceis not equalattention_mask.device, see linemodeling_utils.py#L610. Explanation: tracing logic from line 610 to method signature:causal_mask.device==attention_mask.device=>seq_ids.device==attention_mask.device=>device==attention_mask.device@michaelbenayoun
Fixes # (issue)
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.