You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the current stable version of transformersattention_mask argument is annotated as Optional[torch.Tensor] (see for example modeling_llama.py).
However, in fact it is a required argument.
At the same time, the ancestor LlamaDecoderLayer classes accepts this argument as Optional (see).
Delving deeper, flash_attention_forward annotates attention_mask as Optional[torch.Tensor] and calls inside _flash_attention_forward which takes attention_mask as required torch.Tensor argument, but there is conditional statement checking whether the attention_mask is not None and the function can be called in fact with attention_mask as None.
I suggest correcting the typing by making attention_mask an optional argument with None as its default value.
The text was updated successfully, but these errors were encountered:
In the current stable version of
transformers
attention_mask
argument is annotated asOptional[torch.Tensor]
(see for example modeling_llama.py).However, in fact it is a required argument.
At the same time, the ancestor
LlamaDecoderLayer
classes accepts this argument as Optional (see).Delving deeper, flash_attention_forward annotates
attention_mask
asOptional[torch.Tensor]
and calls inside _flash_attention_forward which takesattention_mask
as requiredtorch.Tensor
argument, but there is conditional statement checking whether theattention_mask
is notNone
and the function can be called in fact withattention_mask
as None.I suggest correcting the typing by making
attention_mask
an optional argument withNone
as its default value.The text was updated successfully, but these errors were encountered: