LlamaAttention forward function type hint is incorrect
System Info
For the current version (4.52.4), in the LlamaAttention class, the type hint for the forward function
https://github.com/huggingface/transformers/blob/aa798b7ac9ff5018b3578eb927dc438671ab6a3e/src/transformers/models/llama/modeling_llama.py#L231
and what it actually returns
https://github.com/huggingface/transformers/blob/aa798b7ac9ff5018b3578eb927dc438671ab6a3e/src/transformers/models/llama/modeling_llama.py#L264
mismatch. Looking at the git blame, this is probably the result of the attention refactor introduced in #35235.
Who can help?
@ArthurZucker
Information
- [ ] The official example scripts
- [ ] My own modified scripts
Tasks
- [ ] An officially supported task in the
examplesfolder (such as GLUE/SQuAD, ...) - [ ] My own task or dataset (give details below)
Reproduction
Look at the code
Expected behavior
The type hint should be correct to avoid confusion
Hello! I noticed a small mismatch in the return type of the LlamaAttention forward method in Transformers version 4.52.4. It does not match what is actually being returned. This might have happened during the recent attention refactor, possibly in pull request . I just wanted to point it out. I would be happy to open a quick pull request to fix it if that helps. Thank you for all the great work you are doing!
@nhatkhtn ?
Hi @nhatkhtn, yes, this looks like an incorrect type hint. Would you be willing to make a PR to fix it?
Yeah sure...
@Rocketknight1 i have done the changes...I am pushing the changes Plz review
Hi @ArkVex can you link the PR?
#38795 @Rocketknight1
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.
Fixed with #38998
Thanks!