Skip to content
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

Mask t5 relative position bias then head pruned #17968

Merged
merged 7 commits into from
Sep 6, 2022

Conversation

hadaev8
Copy link
Contributor

@hadaev8 hadaev8 commented Jun 30, 2022

What does this PR do?

Fixes #17886

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

@patrickvonplaten

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jun 30, 2022

The documentation is not available anymore as the PR was closed or merged.

@patrickvonplaten
Copy link
Contributor

Thanks for the PR @hadaev8!

Could you add a test for the newly added functionality ? :-)

@hadaev8
Copy link
Contributor Author

hadaev8 commented Jul 6, 2022

@patrickvonplaten
Never did it, how it should looks like?

@patrickvonplaten
Copy link
Contributor

Hey @hadaev8,

The test should be added to this file here: https://github.com/huggingface/transformers/blob/main/tests/models/t5/test_modeling_t5.py

In this test it would be great if you could do the following for example:
Create a dummy T5 model and run a forward pass with output_attentions=True. The prune a head and run a forward pass again with output_attentions=True. Then you can compare that the attentions returned by the second forward pass will be 0 or just have fewer tensors because the head was pruned

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@hadaev8
Copy link
Contributor Author

hadaev8 commented Aug 5, 2022

@patrickvonplaten
I spotted another thing.
In encoder-decoder only one broken function to prune. Should I split in two?

Copy link
Contributor

@patrickvonplaten patrickvonplaten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@patrickvonplaten
Copy link
Contributor

@hadaev8 let's maybe do this in another PR :-)

@hadaev8
Copy link
Contributor Author

hadaev8 commented Aug 25, 2022

Okay, i only will make test

@patrickvonplaten
Copy link
Contributor

Hey @hadaev8,

Sorry last thing - could you maybe remove the accidently added datasets folder? See: https://github.com/huggingface/transformers/pull/17968/files#diff-714284abfa95a1447d7c34554c2d65b16fcfb1af22a44fc15489d13b76e951e5

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Happy to merge this once the datasets folder has been removed :)

@hadaev8
Copy link
Contributor Author

hadaev8 commented Aug 29, 2022

@patrickvonplaten
Sorry, still had no time to write the test.
Removed datasets folder.

@LysandreJik
Copy link
Member

It seems there is an issue with your CircleCI permissions, the tests won't run.
Could you try refreshing your permissions as shown here?

@hadaev8
Copy link
Contributor Author

hadaev8 commented Sep 5, 2022

Seems I can't register account at CircleCI because sanctioned country.

@LysandreJik
Copy link
Member

Arf that's super annoying, sorry about that @hadaev8. I'll look into triggering it for you.

@LysandreJik
Copy link
Member

I pushed the same commits under a different branch: https://github.com/huggingface/transformers/tree/fix_t5_pruning-lysandre
It used my token permissions so it could run. Sorry you're experiencing this, I'll handle the triggers if some tests need to be fixed.

@LysandreJik
Copy link
Member

All tests pass, thank you @hadaev8! Merging the PR.

@LysandreJik LysandreJik merged commit 734b7e2 into huggingface:main Sep 6, 2022
@hadaev8
Copy link
Contributor Author

hadaev8 commented Sep 6, 2022

@LysandreJik
Cool, thank you.

oneraghavan pushed a commit to oneraghavan/transformers that referenced this pull request Sep 26, 2022
* add position bias head masking if heads pruned

* fix pruning function in t5 encoder

* make style

* make fix-copies

* Revert added folder

Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pruning function in T5Attention doesnt affect _relative_position_bucket
4 participants