-
Notifications
You must be signed in to change notification settings - Fork 28.3k
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
Output None
as attention when layer is skipped
#30597
Output None
as attention when layer is skipped
#30597
Conversation
Hi @jonghwanhyeon, thanks for adding this! Could you add a test which passes with this fix and fails on main? cc @kamilakesbi for first review |
e0f9396
to
4cd97cc
Compare
Added a test case |
Hi @jonghwanhyeon, Thank you very much for working on this! Could you provide your working environnement (by running I've run the test you suggested both with Thanks! |
2bface9
to
853a95a
Compare
853a95a
to
4e9bafd
Compare
Oh, that is because the value of import torch
from transformers import WavLMConfig, WavLMModel
model = WavLMModel(WavLMConfig())
model.config.layerdrop = 1.0
model.train()
outputs = model(torch.randn(1, 8_000), output_attentions=True) For your information, my environment is as below (with the modifications of
|
Ok, thanks a lot @jonghwanhyeon! LGTM - I can reproduce the bug and your code seems to fix it. I've tried your test and it passes know. CC @amyeroberts for a final check! |
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 fixing and adding a test!
What does this PR do?
Fixes an out of index error caused by skipped layers when
output_attentions
isTrue
in training mode on WavLM model.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.
@sanchit-gandhi @patrickvonplaten