Closed HackGiter closed 2 months ago
Hey! Best recommendation is to transition to using the update_causal_mask
:
https://github.com/huggingface/transformers/blob/416711c3ea88109cf25a9c5f85b4aeee2cb831b5/src/transformers/models/llama/modeling_llama.py#L1058
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.
System Info
transformers 4.37.0
Who can help?
No response
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
import torch from transformers.modeling_attn_mask_utils import AttentionMaskConverter
attn_mask_converter = AttentionMaskConverter(is_causal=True, sliding_window=None)
attention_mask = attn_mask_converter.to_causal_4d( 1, 1, 5, dtype=torch.float16, device='cpu' ) print(attention_mask.shape)
Expected behavior
torch.Size([1,1,1,5])