-
Notifications
You must be signed in to change notification settings - Fork 30.9k
Moved functions to pytorch_utils.py #16625
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
Conversation
|
The documentation is not available anymore as the PR was closed or merged. |
|
@patrickvonplaten I'm new to contributing to this repo. What other updates are required? |
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 tackling this! There are a few imports that seem wrong in some of the modeling files, could you fix them?
| return input | ||
|
|
||
|
|
||
| def find_pruneable_heads_and_indices( |
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.
For backward compatibility, these functions should still be imported in this module.
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.
@sgugger does that mean a copy of the functions should remain in modeling_utils.py?
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.
Or as described 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.
No, just from .pytorch_utils import find_pruneable_heads_and_indices (and same for the others)
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.
@sgugger Thank you - trying my best to learn!
I incorporated your comment. Won't resolve this conversation until you have confirmed that I incorporated it correctly.
examples/research_projects/movement-pruning/emmental/modeling_bert_masked.py
Outdated
Show resolved
Hide resolved
src/transformers/models/decision_transformer/modeling_decision_transformer.py
Outdated
Show resolved
Hide resolved
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.
Went through all the files and it looks good to me!
Think it would make a bit more sense to leave Conv1D in modeling_utils.py next to classes like PoolerAnswerClass instead of moving it to a pytorch utils class since it's more related to modeling IMO - what do you think @sgugger ?
|
Those should be removed entirely honestly (components should be in model files, not modeling_utils), so I care little where they are :-) |
|
@patrickvonplaten won't moving Conv1D back to modeling_utils.py cause circular imports? |
|
@patrickvonplaten any thoughts? |
|
@sgugger any more changes to complete on this PR? |
|
Good to go for me! |
|
Waiting for final review from @sgugger |
|
I'm good on my side, was waiting for you Patrick ;-) |
* Moved functions to pytorch_utils.py * isort formatting * Reverted tf changes * isort, make fix-copies * documentation fix * Fixed Conv1D import * Reverted research examples file * backward compatibility for pytorch_utils * missing import * isort fix
What does this PR do?
Moved all pruning stuff, apply_chunking_to_forward to pytorch_utils.py
Fixes #15543
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@patrickvonplaten @sgugger