Hi team,
I am wondering about the definition of the attention mask in transformer-engine. I did not find an explanation in the docs. Does True mean that the position takes part in attention or that it is masked out?
These two code positions suggest that True means masked out:
https://github.com/NVIDIA/TransformerEngine/blob/main/tests/pytorch/test_numerics.py#L71
https://github.com/NVIDIA/TransformerEngine/blob/main/transformer_engine/pytorch/utils.py#L34
But for flash attention with padding, the cumulated sequence lengths are computed based on a sum over the mask. This suggests that it is vice versa:
https://github.com/NVIDIA/TransformerEngine/blob/main/transformer_engine/pytorch/attention.py#L180
Thanks for clarifying this!
Hi team,
I am wondering about the definition of the attention mask in transformer-engine. I did not find an explanation in the docs. Does True mean that the position takes part in attention or that it is masked out?
These two code positions suggest that True means masked out:
https://github.com/NVIDIA/TransformerEngine/blob/main/tests/pytorch/test_numerics.py#L71
https://github.com/NVIDIA/TransformerEngine/blob/main/transformer_engine/pytorch/utils.py#L34
But for flash attention with padding, the cumulated sequence lengths are computed based on a sum over the mask. This suggests that it is vice versa:
https://github.com/NVIDIA/TransformerEngine/blob/main/transformer_engine/pytorch/attention.py#L180
Thanks for clarifying this!