+
    QV-ju	  ã                   ó6   € ^ RI t ^RIHt R R ltRR R lltR# )é    N)ÚPagedAttentionCachec                ód   € V ^8„  d   QhR\         P                  R\        R\         P                  /# )é   Úhidden_statesÚn_repÚreturn)ÚtorchÚTensorÚint)Úformats   "Úu/Volumes/fast/ai/experiments/ui-tars-smoke/.venv/lib/python3.14/site-packages/transformers/integrations/sdpa_paged.pyÚ__annotate__r      s.   € ÷ 	Uñ 	UœUŸ\™\ð 	U´#ð 	U¼%¿,¹,ñ 	Uó    c                ó˜   € V P                   w  r#rEV^8X  d   V # V R,          P                  W#WV4      p V P                  W#V,          WE4      # )zÈ
This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
)ºNNNr   Nr   r   )ÚshapeÚexpandÚreshape)r   r   ÚbatchÚnum_key_value_headsÚslenÚhead_dims   &&    r   Ú	repeat_kvr      sU   € ð
 2?×1DÑ1DÑ.€E Ø�„zØÐØ!Ð"2Õ3×:Ñ:¸5ÐW\ÐdlÓm€MØ× Ñ  ¸eÕ(CÀTÓTÐTr   c                ó:  € V ^8„  d   QhR\         P                  P                  R\         P                  R\         P                  R\         P                  R\         P                  R,          R\        R\        R,          R	\
        \         P                  R3,          /# )
r   ÚmoduleÚqueryÚkeyÚvalueÚattention_maskNÚdropoutÚscalingr   )r	   ÚnnÚModuler
   ÚfloatÚtuple)r   s   "r   r   r      s‡   € ÷ 0ñ 0Ü�H‰H�O‰Oð0ä�<‰<ð0ô 
�‰ð0ô �<‰<ð	0ô
 —L‘L 4Õ'ð0ô ð0ô �T�\ð0ô Œ5�<‰<˜ÐÕñ0r   c           
      ó–  € VP                  R R4      pVes   VP                  VVV P                  VR,          VR,          R7      w  r#VP                  ^ ^4      P	                  ^ 4      pVP                  ^ ^4      P	                  ^ 4      p\        V R4      '       d+   \        W P                  4      p\        W0P                  4      pTp	VP                  4       pVP                  4       pVP                  4       p\        P                  P                  P                  VVVV	VVRR7      p
V
P                  ^^4      P                  4       p
V
R3# )ÚcacheNÚ
read_indexÚwrite_index)Ú
key_statesÚvalue_statesÚ	layer_idxr(   r)   Únum_key_value_groupsF)Ú	attn_maskÚ	dropout_pÚscaleÚ	is_causal)ÚpopÚupdater,   Ú	transposeÚ	unsqueezeÚhasattrr   r-   Ú
contiguousr	   r"   Ú
functionalÚscaled_dot_product_attention)r   r   r   r   r   r    r!   Úkwargsr'   Úcausal_maskÚattn_outputs   &&&&&&&,   r   Úsdpa_attention_paged_forwardr=      sD  € ð )/¯
©
°7¸DÓ(A€EØÒà—\‘\ØØØ×&Ñ&Ø˜lÕ+Ø˜}Õ-ð "ó 
‰
ˆð �m‰m˜A˜qÓ!×+Ñ+¨AÓ.ˆØ—‘  1Ó%×/Ñ/°Ó2ˆô ˆvÐ-×.Ò.Ü˜×8Ñ8Ó9ˆÜ˜%×!<Ñ!<Ó=ˆð !€Kð ×ÑÓ€EØ
�.‰.Ó
€CØ×ÑÓ€EÜ—(‘(×%Ñ%×BÑBØØØØØØàð Có 	€Kð ×'Ñ'¨¨1Ó-×8Ñ8Ó:€Kà˜ÐÐr   )g        N)r	   Ú$generation.continuous_batching.cacher   r   r=   © r   r   Ú<module>r@      s   ðÛ å Fõ	U÷0ñ 0r   