+
    œ°³jSU  ã                   ó´   € R t ^ RIt^ RIHt ^ RIHt ^ RIt^RIHtH	t	 Rt
] ! R R4      4       tRR R	 lltRR
 R lltRR R lltRR R lltRR R lltR# )a  
IMPORTANT NOTICE: Every class and function in this file is deprecated in favor of using the much more general
`masking_utils.py` primitives. New code should not rely on it, it is only kept for backward compatibility for now,
and will be removed in the future.
N)Ú	dataclass)ÚUnion)Úis_torchdynamo_compilingÚ
is_tracingzÐThe attention mask API under `transformers.modeling_attn_mask_utils` (`AttentionMaskConverter`) is deprecated and will be removed in Transformers v5.10. Please use the new API in `transformers.masking_utils`.c                   óî   a € ] tR t^#t o RtRV 3R lR lltRV 3R lR lltRV 3R lR llt]RV 3R	 lR
 ll4       t	]RV 3R lR ll4       t
]V 3R lR l4       t]RV 3R lR ll4       tV 3R ltRtV tR# )ÚAttentionMaskConverteraÝ  
A utility attention mask class that allows one to:
    - Create a causal 4d mask
    - Create a causal 4d mask with slided window
    - Convert a 2d attention mask (batch_size, query_length) to a 4d attention mask (batch_size, 1, query_length,
      key_value_length) that can be multiplied with attention scores

Examples:

```python
>>> import torch
>>> from transformers.modeling_attn_mask_utils import AttentionMaskConverter

>>> converter = AttentionMaskConverter(True)
>>> converter.to_4d(torch.tensor([[0, 0, 0, 1, 1]]), 5, key_value_length=5, dtype=torch.float32)
tensor([[[[-3.4028e+38, -3.4028e+38, -3.4028e+38, -3.4028e+38, -3.4028e+38],
        [-3.4028e+38, -3.4028e+38, -3.4028e+38, -3.4028e+38, -3.4028e+38],
        [-3.4028e+38, -3.4028e+38, -3.4028e+38, -3.4028e+38, -3.4028e+38],
        [-3.4028e+38, -3.4028e+38, -3.4028e+38,  0.0000e+00, -3.4028e+38],
        [-3.4028e+38, -3.4028e+38, -3.4028e+38,  0.0000e+00,  0.0000e+00]]]])
```

Parameters:
    is_causal (`bool`):
        Whether the attention mask should be a uni-directional (causal) or bi-directional mask.

    sliding_window (`int`, *optional*):
        Optionally, the sliding window masks can be created if `sliding_window` is defined to a positive integer.
Nc                ó4   <€ V ^8„  d   QhRS[ RS[R,          /# )é   Ú	is_causalÚsliding_windowN©ÚboolÚint)ÚformatÚ__classdict__s   "€Úf/home/luca/screen-checking/.venv/lib/python3.14/site-packages/transformers/modeling_attn_mask_utils.pyÚ__annotate__Ú#AttentionMaskConverter.__annotate__F   s   ø€ ÷ 	ñ 	¡$ð 	¹¸d½
ñ 	ó    c                óÐ   € \         P                  ! \        \        4       Wn        W n        V P
                  e-   V P
                  ^ 8:  d   \        RV P
                   R24      hR # R # )NzaMake sure that when passing `sliding_window` that its value is a strictly positive integer, not `Ú`)ÚwarningsÚwarnÚDEPRECATION_MESSAGEÚFutureWarningr
   r   Ú
ValueError)Úselfr
   r   s   &&&r   Ú__init__ÚAttentionMaskConverter.__init__F   ss   € Ü�ŠÔ)¬=Ô9à"ŒØ,Ôà×ÑÒ*¨t×/BÑ/BÀaÔ/GÜØsÐtx÷  uHñ  uHð  tIð  IJð  Kóð ñ 0HÑ*r   c                óœ   <€ V ^8„  d   QhRS[ RS[ RS[ RS[P                  RS[S[P                  R3,          RS[P
                  R,          /# )	r	   Ú
batch_sizeÚquery_lengthÚkey_value_lengthÚdtypeÚdeviceÚstrÚreturnN)r   Útorchr#   r   r$   ÚTensor)r   r   s   "€r   r   r   Q   sb   ø€ ÷ ñ áðñ ðñ ð	ñ
 �{‰{ðñ ‘e—l‘l EÐ)Õ*ðñ 
�‰˜Õ	ñr   c                óî   € V P                   '       g   \        RV P                   R24      hW3pW2,
          pRpVR,          ^8”  g   V P                  e!   V P	                  VVVVV P                  R7      pV# )z§
Creates a causal 4D mask of (bsz, head_dim=1, query_length, key_value_length) shape and adds large negative
bias to upper right hand triangular matrix (causal mask).
z"Please use `to_causal_4d` only if z has `is_causal` set to True.N©r$   Úpast_key_values_lengthr   éÿÿÿÿ)r
   r   Ú	__class__r   Ú_make_causal_mask)	r   r    r!   r"   r#   r$   Úinput_shaper+   Úcausal_4d_masks	   &&&&&&   r   Úto_causal_4dÚ#AttentionMaskConverter.to_causal_4dQ   s‹   € ð �~�~ˆ~ÜÐAÀ$Ç.Á.ÐAQÐQnÐoÓpÐpð "Ð0ˆØ!1Õ!@Ðð ˆØ�r�?˜QÔ $×"5Ñ"5Ò"AØ!×3Ñ3ØØØØ'=Ø#×2Ñ2ð 4ó ˆNð Ðr   c          
      ó‚   <€ V ^8„  d   QhRS[ P                  RS[RS[ P                  RS[R,          RS[ P                  /# )r	   Úattention_mask_2dr!   r#   r"   Nr&   )r'   r(   r   r#   )r   r   s   "€r   r   r   r   sM   ø€ ÷ - ñ - á Ÿ<™<ð- ñ ð- ñ �{‰{ð	- ñ
  �*ð- ñ 
�‰ñ- r   c                ó4  € VP                   ^ ,          V3pRpVR,          ^8”  g   V P                  eU   V P                  '       dC   Vf   \        R4      hWB,
          pV P	                  VVVP
                  VV P                  R7      pMV P                  e   \        R4      hV P                  WVR,          R7      P                  VP
                  4      pVe?   VP                  VP                  4       \        P                  ! V4      P                  4      pTp	V	# )z÷
Converts 2D attention mask to 4D attention mask by expanding mask to (bsz, head_dim=1, query_length,
key_value_length) shape and by adding a large negative bias to not-attended positions. If attention_mask is
causal, a causal mask will be added.
NzpThis attention mask converter is causal. Make sure to pass `key_value_length` to correctly create a causal mask.r*   z?Sliding window is currently only implemented for causal masking)Útgt_lenr,   )Úshaper   r
   r   r.   r$   ÚNotImplementedErrorÚ_expand_maskÚtoÚmasked_fillr   r'   ÚfinfoÚmin)
r   r4   r!   r#   r"   r/   r0   r+   Úexpanded_attn_maskÚexpanded_4d_masks
   &&&&&     r   Úto_4dÚAttentionMaskConverter.to_4dr   s'  € ð )×.Ñ.¨qÕ1°<Ð@ˆð ˆØ˜�O˜aÔ 4×#6Ñ#6Ò#BÈÏÏÈØÒ'Ü ð Góð ð &6Õ%DÐ"Ø!×3Ñ3ØØØ(×/Ñ/Ø'=Ø#×2Ñ2ð 4ó ‰Nð × Ñ Ò,Ü%Ð&gÓhÐhð "×.Ñ.Ð/@ÐQ\Ð]_ÕQ`Ð.Óa×dÑdØ×$Ñ$ó
Ðð Ò%Ø!/×!;Ñ!;Ð<N×<SÑ<SÓ<UÔW\×WbÒWbÐchÓWi×WmÑWmÓ!nÐð .ÐàÐr   c                ó‚   <€ V ^8„  d   QhRS[ P                  RS[ P                  RS[ P                  RS[RS[R,          /# )r	   Úinput_ids_shaper#   r$   r+   r   N)r'   ÚSizer#   r$   r   )r   r   s   "€r   r   r   ¢   sR   ø€ ÷ !`ñ !`ÙŸ™ð!`á�{‰{ð!`ñ —‘ð!`ñ !$ð	!`ñ
 ˜d�
ñ!`r   c           	     óŠ  € \         P                  ! \        \        4       V w  rV\        P
                  ! Wf3\        P                  ! V4      P                  VR7      p\        P                  ! VP                  R4      VR7      pVP                  Wˆ^,           P                  VP                  R4      ^4      8  ^ 4       VP                  V4      pV^ 8”  d1   \        P                  ! \        P                  ! WcWR7      V.RR7      pVeœ   W4,
          ^,
          p	\        P                  ! \        P                   ! V\        P"                  R7      V	R7      p
\%        4       '       d   VP'                  4       pVP                  V
\        P                  ! V4      P                  4       VR,          P)                  V^WfV,           4      # )z:
Make causal mask used for bi-directional self-attention.
)r$   ©r#   r$   )Údim©r#   )Údiagonalr,   )NNºNNNrJ   )r   r   r   r   r'   Úfullr<   r=   ÚarangeÚsizeÚmasked_fill_Úviewr:   ÚcatÚzerosÚtrilÚ	ones_liker   r   ÚcloneÚexpand)rC   r#   r$   r+   r   Úbszr6   ÚmaskÚ	mask_condrI   Úcontext_masks   &&&&&      r   r.   Ú(AttentionMaskConverter._make_causal_mask¡   sE  € ô 	�ŠÔ)¬=Ô9à&‰ˆÜ�zŠz˜7Ð,¬e¯kªk¸%Ó.@×.DÑ.DÈVÔTˆÜ—L’L §¡¨2£°vÔ>ˆ	Ø×Ñ˜)°1¥}×&:Ñ&:¸4¿9¹9ÀR»=È!Ó&LÑLÈaÔPà�w‰w�u‹~ˆà! AÔ%Ü—9’9œeŸkšk¨'ÐQVÔfÐhlÐmÐsuÔvˆDð Ò%Ø-Õ>ÀÕBˆHä Ÿ:š:¤e§o¢o°dÄ%Ç*Á*Ô&MÐX`ÔaˆLô (×)Ò)Ø—z‘z“|�Ø×Ñ˜l¬E¯KªK¸Ó,>×,BÑ,BÔCàÐ$Õ%×,Ñ,¨S°!°WÐH^Õ>^Ó_Ð_r   c                ób   <€ V ^8„  d   QhRS[ P                  RS[ P                  RS[R,          /# ©r	   rW   r#   r6   N©r'   r(   r#   r   )r   r   s   "€r   r   r   Æ   s3   ø€ ÷ _ñ _™5Ÿ<™<ð _±·±ð _ÁcÈDÅjñ _r   c                óž  € \         P                  ! \        \        4       V P	                  4       w  r4Ve   TMTpV R,          P                  V^W$4      P                  V4      p\        P                  ! RVR7      V,
          pVP                  VP                  \        P                  4      \        P                  ! V4      P                  4      # )zW
Expands attention_mask from `[bsz, seq_len]` to `[bsz, 1, tgt_seq_len, src_seq_len]`.
ç      ð?rH   )rJ   NNrJ   )r   r   r   r   rM   rU   r:   r'   Útensorr;   r   r<   r=   )rW   r#   r6   rV   Úsrc_lenÚexpanded_maskÚinverted_masks   &&&    r   r9   Ú#AttentionMaskConverter._expand_maskÅ   s™   € ô
 	�ŠÔ)¬=Ô9à—y‘y“{‰ˆØ$Ò0‘'°gˆàÐ-Õ.×5Ñ5°c¸1¸gÓO×RÑRÐSXÓYˆäŸš S°Ô6¸ÕFˆà×(Ñ(¨×)9Ñ)9¼%¿*¹*Ó)EÄuÇ{Â{ÐSXÓGY×G]ÑG]Ó^Ð^r   c                ó:   <€ V ^8„  d   QhRS[ P                  RS[/# )r	   rb   Ú	min_dtype)r'   ÚFloatTensorÚfloat)r   r   s   "€r   r   r   Ö   s'   ø€ ÷ 0_ñ 0_Ù×(Ñ(ð0_áñ0_r   c                óê   € \         P                  ! \        \        4       V P                  \
        P                  8X  d   \        R4      hV P                  \
        P                  ! W8H  RRR7      ( 4      # )a×  
Attend to all tokens in masked rows from the expanded attention mask, for example the relevant first rows when
using left padding. This is required by F.scaled_dot_product_attention memory-efficient attention path.
Details: https://github.com/pytorch/pytorch/issues/110213

`expanded_mask` is [bsz, num_masks, tgt_seq_len, src_seq_len] or [bsz, tgt_seq_len, src_seq_len].
`attention_mask` is [bsz, src_seq_len].

The dimension num_masks of `expanded_mask` is most often 1, but it can also be the number of heads in the case of alibi attention bias.

For example, if `expanded_mask` is (e.g. here left-padding case)
```
[[[[0, 0, 0],
   [0, 0, 0],
   [0, 0, 1]]],
 [[[1, 0, 0],
   [1, 1, 0],
   [1, 1, 1]]],
 [[[0, 0, 0],
   [0, 1, 0],
   [0, 1, 1]]]]
```
then the modified `expanded_mask` will be
```
[[[[1, 1, 1],   <-- modified
   [1, 1, 1],   <-- modified
   [0, 0, 1]]],
 [[[1, 0, 0],
   [1, 1, 0],
   [1, 1, 1]]],
 [[[1, 1, 1],   <-- modified
   [0, 1, 0],
   [0, 1, 1]]]]
```
z\AttentionMaskConverter._unmask_unattended expects a float `expanded_mask`, got a BoolTensor.T)rG   Úkeepdimr,   )
r   r   r   r   r#   r'   r   r   ÚmulÚall)rb   rf   s   &&r   Ú_unmask_unattendedÚ)AttentionMaskConverter._unmask_unattendedÕ   s_   € ôR 	�ŠÔ)¬=Ô9ð ×Ñ¤%§*¡*Ô,ÜØnóð ð × Ñ ¤%§)¢)¨MÑ,FÈBÐX\Ô"]Ð!]Ó^Ð^r   c                ó‚   <€ V ^8„  d   QhRS[ P                  R,          RS[ P                  RS[RS[R,          RS[RS[/# )r	   Úattention_maskNÚinputs_embedsr+   r   Úis_trainingr&   )r'   r(   r   r   )r   r   s   "€r   r   r   	  sV   ø€ ÷ 8"ñ 8"ÙŸ™ tÕ+ð8"á—|‘|ð8"ñ !$ð8"ñ ˜d�
ð	8"ñ
 ð8"ñ 
ñ8"r   c                óÎ  € \         P                  ! \        \        4       VP                  ^ ,          VP                  ^,          reWb,           p\        V4      pRp	V f,   V'       g	   V'       g   V^8X  g   Wv8X  d   Ve   Ws8  d   Rp	V	# Ve   Ws8  dS   \        V P                  4      ^8X  d   R# V'       g/   \        P                  ! V ^8H  4      '       d   V^8X  g   Wv8X  d   Rp	V	# )a  
Detects whether the optional user-specified attention_mask & the automatically created causal mask can be
ignored in case PyTorch's SDPA is used, rather relying on SDPA's `is_causal` argument.

In case no token is masked in the `attention_mask` argument, if `query_length == 1` or
`key_value_length == query_length`, we rather rely on SDPA `is_causal` argument to use causal/non-causal masks,
allowing to dispatch to the flash attention kernel (that can otherwise not be used if a custom `attn_mask` is
passed).
FT)	r   r   r   r   r7   r   Úlenr'   rl   )
rp   rq   r+   r   rr   Ú_r!   r"   Úis_tracing_Úignore_causal_masks
   &&&&&     r   Ú_ignore_causal_mask_sdpaÚ/AttentionMaskConverter._ignore_causal_mask_sdpa  sÔ   € ô" 	�ŠÔ)¬=Ô9à'×-Ñ-¨aÕ0°-×2EÑ2EÀaÕ2Hˆ<Ø'Õ@Ðä  Ó/ˆà"ÐàÒ!÷ §KØ! QÔ&Ð*:Ô*JØ#Ò+Ð/?Ô/Pà%)Ð"ð "Ð!ð Ò#Ð'7Ô'HÜ�>×'Ñ'Ó(¨AÔ-Ùß ¤U§Y¢Y¨~ÀÑ/B×%CÒ%CØ 1Ô$Ð(8Ô(Hà)-Ð&ð "Ð!r   c                ó2   <€ V ^8„  d   Qh/ S[ ;R&   S[;R&   # )r	   r
   r   r   )r   r   s   "€r   r   r   #   s"   ø‡ ‚ ñ@ �OñA ñB ÑòC r   ©r
   r   ©N)Úcpu©é    N)NF)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r1   r@   Ústaticmethodr.   r9   rm   rx   Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__)r   s   @r   r   r   #   sœ   ø‡ € ñ÷B	ò 	÷ò ÷B- ò - ð^ ÷!`ñ !`ó ð!`ðF ÷_ñ _ó ð_ð ÷0_ó ð0_ðd ÷8"ñ 8"ó ð8"÷M ƒ r   r   c                óØ   € V ^8„  d   QhR\         P                  R,          R\         P                  \        ,          \        ,          R\         P                  R\
        R\
        R,          /# ©r	   rp   Nr/   rq   r+   r   ©r'   r(   rD   ÚtupleÚlistr   )r   s   "r   r   r   D  sY   € ÷ 1ñ 1Ü—L‘L 4Õ'ð1ä—‘œeÕ#¤dÕ*ð1ô —<‘<ð1ô  ð	1ô
 ˜$•Jñ1r   c                óÞ  € \        RVR7      pVR	,          V,           pV eA   \        V P                  4      ^8X  d'   VP                  WR	,          WbP                  R7      p V # V eÑ   \        V P                  4      ^8X  d·   V^ ,          ^V^,          V3p\        V P                  4      V8w  d&   \        R\        V P                  4       RV R24      hRV ,
          pVP                  VP                  \        P                  4      \        P                  ! VP                  4      P                  4      p  V # VP                  V^ ,          VR	,          WbP                  VP                  R7      p V # )
a¹  
Creates a causal 4D mask of shape `(batch_size, 1, query_length, key_value_length)` from a 2D mask of shape
`(batch_size, key_value_length)`

Args:
    attention_mask (`torch.Tensor` or `None`):
        A 2D attention mask of shape `(batch_size, key_value_length)`
    input_shape (`tuple(int)` or `list(int)` or `torch.Size`):
        The input shape should be a tuple that defines `(batch_size, query_length)`.
    inputs_embeds (`torch.Tensor`):
        The embedded inputs as a torch Tensor.
    past_key_values_length (`int`):
        The length of the key value cache.
    sliding_window (`int`, *optional*):
        If the model uses windowed attention, a sliding window should be passed.
Tr{   )r"   r#   z#Incorrect 4D attention_mask shape: z; expected: Ú.r_   rF   r,   )r   rt   r7   r@   r#   rŒ   r   r;   r:   r'   r   r<   r=   r1   r$   )	rp   r/   rq   r+   r   Úattn_mask_converterr"   Úexpected_shaperc   s	   &&&&&    r   Ú!_prepare_4d_causal_attention_maskr’   D  sg  € ô. 1¸4ÐP^Ô_Ðà" 2•Ð)?Õ?Ðð Ò!¤c¨.×*>Ñ*>Ó&?À1Ô&DØ,×2Ñ2Ø¨�OÐ>N×ViÑVið 3ó 
ˆð( Ðð# 
Ò	#¬¨N×,@Ñ,@Ó(AÀQÔ(FØ% a�.¨!¨[¸­^Ð=MÐNˆÜ�×%Ñ%Ó&¨.Ô8ÜØ5´e¸N×<PÑ<PÓ6QÐ5RÐR^Ð_mÐ^nÐnoÐpóð ð
   .Õ0ˆMØ*×6Ñ6Ø× Ñ ¤§¡Ó,¬e¯kªk¸-×:MÑ:MÓ.N×.RÑ.Ró‰Nð Ðð	 -×9Ñ9Ø˜�N˜K¨�OÐ-=×EXÑEXÐan×auÑauð :ó 
ˆð Ðr   c                óØ   € V ^8„  d   QhR\         P                  R,          R\         P                  \        ,          \        ,          R\         P                  R\
        R\
        R,          /# rŠ   r‹   )r   s   "r   r   r   y  sY   € ÷ 7ñ 7Ü—L‘L 4Õ'ð7ä—‘œeÕ#¤dÕ*ð7ô —<‘<ð7ô  ð	7ô
 ˜$•Jñ7r   c                óZ  € \        RVR7      pVR,          V,           p\        V4      p\         P                  V VVVR7      pV'       d   Rp	V	# V f:   VP                  V^ ,          VR,          WbP                  VP
                  R7      p	V	# V P                  4       ^8X  d   T p	M&VP                  V VR,          VP                  VR7      p	V'       g[   V	P
                  P                  R	9   d@   \         P                  V	\        P                  ! VP                  4      P                  R7      p	V	# )
aÕ  
Prepares the correct `attn_mask` argument to be used by `torch.nn.functional.scaled_dot_product_attention`.

In case no token is masked in the `attention_mask` argument, we simply set it to `None` for the cases `query_length == 1` and
`key_value_length == query_length`, and rely instead on SDPA `is_causal` argument to use causal/non-causal masks,
allowing to dispatch to the flash attention kernel (that can otherwise not be used if a custom `attn_mask` is passed).
Tr{   )rp   rq   r+   r   NrF   )r#   r"   )rf   r,   )ÚcudaÚxpu)r   r   rx   r1   r#   r$   rG   r@   Útyperm   r'   r<   r=   )
rp   r/   rq   r+   r   r�   r"   rv   rw   r?   s
   &&&&&     r   Ú*_prepare_4d_causal_attention_mask_for_sdpar˜   y  s@  € ô 1¸4ÐP^Ô_Ðà" 2•Ð)?Õ?Ðô
 ˜]Ó+€Kä/×HÑHØ%Ø#Ø5Ø%ð	 Ió Ð÷ ØÐð0 Ðð/ 
Ò	Ø.×;Ñ;Ø˜�N˜K¨�OÐ-=×EXÑEXÐan×auÑauð <ó 
Ðð, Ðð% ×ÑÓ 1Ô$Ø-Ñà2×8Ñ8ØØ˜B•Ø#×)Ñ)Ø!1ð	  9ó  Ð÷ Ð/×6Ñ6×;Ñ;¸ÔNÜ5×HÑHØ ¬E¯KªK¸×8KÑ8KÓ,L×,PÑ,Pð  Ió  Ðð Ðr   c                ór   € V ^8„  d   QhR\         P                  R\         P                  R\        R,          /# r\   r]   )r   s   "r   r   r   ³  s5   € ÷ Xñ X¤U§\¡\ð X¼%¿+¹+ð XÔPSÐVZÕPZñ Xr   c                ó0   € \         P                  WVR7      # )á¦  
Creates a non-causal 4D mask of shape `(batch_size, 1, query_length, key_value_length)` from a 2D mask of shape
`(batch_size, key_value_length)`

Args:
    mask (`torch.Tensor`):
        A 2D attention mask of shape `(batch_size, key_value_length)`
    dtype (`torch.dtype`):
        The torch dtype the created mask shall have.
    tgt_len (`int`):
        The target length or query length the created mask shall have.
©rW   r#   r6   )r   r9   rœ   s   &&&r   Ú_prepare_4d_attention_maskr�   ³  s   € ô "×.Ñ.°DÈwÐ.ÓWÐWr   c                ór   € V ^8„  d   QhR\         P                  R\         P                  R\        R,          /# r\   r]   )r   s   "r   r   r   Ã  s5   € ÷ \ñ \¬e¯l©lð \Ä5Ç;Á;ð \ÔY\Ð_cÕYcñ \r   c                óþ   € \         P                  ! \        \        4       V P                  w  r4Ve   TMTp\        V 4      '       g"   \        P                  ! V ^8H  4      '       d   R# \        P                  WVR7      # )r›   Nrœ   )
r   r   r   r   r7   r   r'   rl   r   r9   )rW   r#   r6   ru   r"   s   &&&  r   Ú#_prepare_4d_attention_mask_for_sdpar    Ã  se   € ô ‡M‚MÔ%¤}Ô5àŸ*™*Ñ€AØ Ò,‰gÐ2B€Gô �d×Ò¤§	¢	¨$°!©)× 4Ò 4Ùä%×2Ñ2¸ÐSZÐ2Ó[Ð[r   c                óø   € V ^8„  d   QhR\         P                  \        ,          \        ,          R\         P                  R\         P
                  R\        R\        R,          R\         P                  R,          /# )r	   r/   r#   r$   r+   r   Nr&   )r'   rD   rŒ   r�   r#   r$   r   r(   )r   s   "r   r   r   Ü  sg   € ÷ ñ Ü—‘œeÕ#¤dÕ*ðä�;‰;ðô �L‰Lðô  ð	ô
 ˜$•Jðô ‡\�\�DÕñr   c                ó„   € \        RVR7      pW0R,          ,           pVP                  V ^ ,          V R,          WaVR7      pV# )a  
Creates a causal 4D mask of shape `(batch_size, 1, query_length, key_value_length)`

Args:
    input_shape (`tuple(int)` or `list(int)` or `torch.Size`):
        The input shape should be a tuple that defines `(batch_size, query_length)`.
    dtype (`torch.dtype`):
        The torch dtype the created mask shall have.
    device (`int`):
        The torch device the created mask shall have.
    sliding_window (`int`, *optional*):
        If the model uses windowed attention, a sliding window should be passed.
Tr{   rF   r,   )r   r1   )r/   r#   r$   r+   r   r�   r"   rp   s   &&&&&   r   Ú _create_4d_causal_attention_maskr£   Ü  sN   € ô( 1¸4ÐP^Ô_Ðà-¸BµÕ?ÐØ(×5Ñ5Ø�A�˜ B�Ð)9Èvð 6ó €Nð Ðr   r|   r~   )r„   r   Údataclassesr   Útypingr   r'   Úutils.import_utilsr   r   r   r   r’   r˜   r�   r    r£   © r   r   Ú<module>r¨      se   ðñó Ý !Ý ã ç Dðwð ð ÷]"ð ]"ó ð]"÷@	1÷j7÷tX÷ \÷2ñ r   