+
    œ°³já  ã                   óÈ  € ^ RI Ht ^ RIt^ RIHt ^ RIHu Ht ^RIH	t	 ^RI
Ht ^RIHt ^RIHt ^RIHt ^RIHt ^R	IHtHtHtHtHtHtHtHtHt ^R
IHt ]P@                  ! ]!4      t" ! R R]PF                  4      t$ ! R R]4      t% ! R R]4      t&]! R4      RR l4       t' ! R R]4      t( ! R R]4      t) ! R R]4      t* ! R R]4      t+ ! R R]4      t,. ROt-R# )é    )ÚCallableN)ÚCache)Úuse_kernel_forward_from_hub)Údynamic_rope_update)ÚALL_ATTENTION_FUNCTIONS)Úlogging)Úmaybe_autocast)	ÚLlamaAttentionÚLlamaDecoderLayerÚLlamaForCausalLMÚLlamaForSequenceClassificationÚLlamaMLPÚ
LlamaModelÚLlamaRotaryEmbeddingÚeager_attention_forwardÚrotate_half©Ú
OlmoConfigc                   óT   a a€ ] tR t^1t oRtV3R lV 3R lltV3R lR ltRtVtV ;t	# )ÚOlmoLayerNormz/LayerNorm but with no learnable weight or bias.c                ó$   <€ V ^8„  d   QhRS[ RR/# )é   Úhidden_sizeÚreturnN)Úint)ÚformatÚ__classdict__s   "€Úf/home/luca/screen-checking/.venv/lib/python3.14/site-packages/transformers/models/olmo/modular_olmo.pyÚ__annotate__ÚOlmoLayerNorm.__annotate__4   s   ø€ ÷ /ñ /¡Cð /¨Dñ /ó    c                ó4   <€ \         SV `  4        V3V n        R # ©N)ÚsuperÚ__init__Únormalized_shape)Úselfr   Ú	__class__s   &&€r   r%   ÚOlmoLayerNorm.__init__4   s   ø€ Ü‰ÑÔØ!, ˆÖr!   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# )r   Úhidden_statesr   )ÚtorchÚTensor)r   r   s   "€r   r   r    8   s#   ø€ ÷ 
ñ 
¡U§\¡\ð 
±e·l±lñ 
r!   c                ó¾   € VP                   p\        P                  ! VP                  \        P
                  R 7      V P                  RRRR7      P                  V4      # ))ÚdtypeNgñhãˆµøä>)Úeps)r/   ÚFÚ
layer_normÚtor,   Úfloat32r&   )r'   r+   Ú
orig_dtypes   && r   ÚforwardÚOlmoLayerNorm.forward8   sO   € Ø"×(Ñ(ˆ
Ü�|Š|˜M×,Ñ,´5·=±=Ð,ÓAÀ4×CXÑCXÐZ^Ð`dÐjnÔo×rÑrØó
ð 	
r!   )r&   )
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r%   r6   Ú__static_attributes__Ú__classdictcell__Ú__classcell__©r(   r   s   @@r   r   r   1   s!   ù‡ € Ù9÷/ó /÷
÷ 
ð 
r!   r   c                   ó2   a a€ ] tR t^?t oV 3R ltRtVtV ;t# )ÚOlmoMLPc                óR  <€ \         SV `  V4       \        P                  ! V P                  V P
                  R R7      V n        \        P                  ! V P                  V P
                  R R7      V n        \        P                  ! V P
                  V P                  R R7      V n        R# )F)ÚbiasN)	r$   r%   ÚnnÚLinearr   Úintermediate_sizeÚ	gate_projÚup_projÚ	down_proj)r'   Úconfigr(   s   &&€r   r%   ÚOlmoMLP.__init__@   ss   ø€ Ü‰Ñ˜Ô ÜŸš 4×#3Ñ#3°T×5KÑ5KÐRWÔXˆŒÜ—y’y ×!1Ñ!1°4×3IÑ3IÐPUÔVˆŒÜŸš 4×#9Ñ#9¸4×;KÑ;KÐRWÔXˆŽr!   )rJ   rH   rI   ©r8   r9   r:   r;   r%   r=   r>   r?   r@   s   @@r   rB   rB   ?   s   ù‡ € ÷Yõ Yr!   rB   c                   óX   a € ] tR t^It o ]P
                  ! 4       ]R 4       4       tRtV t	R# )ÚOlmoRotaryEmbeddingc                ó0  € V P                   R,          P                  4       P                  VP                  ^ ,          R^4      P	                  VP
                  4      pVR,          P                  4       p\        VP
                  P                  \        4      '       d2   VP
                  P                  R8w  d   VP
                  P                  MRp\        VRR7      ;_uu_ 4        VP                  4       VP                  4       ,          P                  ^^4      p\        P                  ! Wf3RR7      pVP                  4       V P                  ,          pVP                  4       V P                  ,          p	R R R 4       W‰3#   + '       g   i     XX	3# ; i)	NÚmpsÚcpuF)Údevice_typeÚenabled)Údim)NºNNNNéÿÿÿÿ)rV   NrV   )Úinv_freqÚfloatÚexpandÚshaper3   ÚdeviceÚ
isinstanceÚtypeÚstrr	   Ú	transposer,   ÚcatÚcosÚattention_scalingÚsin)
r'   ÚxÚposition_idsÚinv_freq_expandedÚposition_ids_expandedrS   ÚfreqsÚembrb   rd   s
   &&&       r   r6   ÚOlmoRotaryEmbedding.forwardJ   s.  € ð !ŸM™M¨-Õ8×>Ñ>Ó@×GÑGÈ×HZÑHZÐ[\ÕH]Ð_aÐcdÓe×hÑhÐij×iqÑiqÓrÐØ ,¨ZÕ 8× >Ñ >Ó @Ðä'1°!·(±(·-±-Ä×'EÒ'EÈ!Ï(É(Ï-É-Ð[`ÔJ`�a—h‘h—m’mÐfkˆÜ¨¸U×CÖCØ&×,Ñ,Ó.Ð1F×1LÑ1LÓ1NÕN×YÑYÐZ[Ð]^Ó_ˆEÜ—)’)˜U˜N°Ô3ˆCØ—'‘'“)˜d×4Ñ4Õ4ˆCØ—'‘'“)˜d×4Ñ4Õ4ˆC÷	 Dð
 ˆxˆ÷ DÖCð
 �Cˆxˆús   Ã&BFÆF	© N)
r8   r9   r:   r;   r,   Úno_gradr   r6   r=   r>   ©r   s   @r   rO   rO   I   s%   ø‡ € Ø
‡]‚]ƒ_Øñ
ó ó ö
r!   rO   Úrotary_pos_embc                ó4  € V P                   VP                   reVP                  V4      pVP                  V4      pW,          \        V 4      V,          ,           pW,          \        V4      V,          ,           pVP                  V4      VP                  V4      3# )aI  Applies Rotary Position Embedding to the query and key tensors.

Args:
    q (`torch.Tensor`): The query tensor.
    k (`torch.Tensor`): The key tensor.
    cos (`torch.Tensor`): The cosine part of the rotary embedding.
    sin (`torch.Tensor`): The sine part of the rotary embedding.
    unsqueeze_dim (`int`, *optional*, defaults to 1):
        The 'unsqueeze_dim' argument specifies the dimension along which to unsqueeze cos[position_ids] and
        sin[position_ids] so that they can be properly broadcasted to the dimensions of q and k. For example, note
        that cos[position_ids] and sin[position_ids] have the shape [batch_size, seq_len, head_dim]. Then, if q and
        k have the shape [batch_size, heads, seq_len, head_dim], then setting unsqueeze_dim=1 makes
        cos[position_ids] and sin[position_ids] broadcastable to the shapes of q and k. Similarly, if q and k have
        the shape [batch_size, seq_len, heads, head_dim], then set unsqueeze_dim=2.
Returns:
    `tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
)r/   Ú	unsqueezer   r3   )	ÚqÚkrb   rd   Úunsqueeze_dimÚq_typeÚk_typeÚq_embedÚk_embeds	   &&&&&    r   Úapply_rotary_pos_embry   Y   sv   € ð& —W‘W˜aŸg™gˆFØ
�-‰-˜Ó
&€CØ
�-‰-˜Ó
&€CØ�wœ; q›>¨CÕ/Õ0€GØ�wœ; q›>¨CÕ/Õ0€GØ�:‰:�fÓ˜wŸz™z¨&Ó1Ð1Ð1r!   c                   ó6   a € ] tR t^tt o RV 3R lR lltRtV tR# )ÚOlmoAttentionNc                ó  <€ V ^8„  d   QhRS[ P                  RS[S[ P                  S[ P                  3,          RS[ P                  R,          RS[R,          RS[S[ P                  S[ P                  R,          3,          /# )r   r+   Úposition_embeddingsÚattention_maskNÚpast_key_valuesr   )r,   r-   Útupler   )r   r   s   "€r   r   ÚOlmoAttention.__annotate__u   sw   ø€ ÷ /)ñ /)á—|‘|ð/)ñ #¡5§<¡<±·±Ð#=Õ>ð/)ñ Ÿ™ tÕ+ð	/)ñ
  �ð/)ñ 
‰u�|‰|™UŸ\™\¨DÕ0Ð0Õ	1ñ/)r!   c                ó´  € VP                   R R p. VORNV P                  N5pV P                  V4      pV P                  V4      p	V P	                  V4      p
V P
                  P                  eµ   VP                  V P
                  P                  ) V P
                  P                  R7       V	P                  V P
                  P                  ) V P
                  P                  R7       V
P                  V P
                  P                  ) V P
                  P                  R7       VP                  V4      P                  ^^4      pV	P                  V4      P                  ^^4      p	V
P                  V4      P                  ^^4      p
Vw  r¼\        W‰W¼4      w  r‰Ve   VP                  WšV P                  4      w  rš\        P                  ! V P
                  P                  \         4      pT! V VV	V
V3RV P"                  '       g   RMV P$                  RV P&                  /VB w  rïVP(                  ! . VORN5!  P+                  4       pV P-                  V4      pWï3# )N)ÚminÚmaxÚdropoutg        ÚscalingrW   )r[   Úhead_dimÚq_projÚk_projÚv_projrK   Úclip_qkvÚclamp_Úviewr`   ry   ÚupdateÚ	layer_idxr   Úget_interfaceÚ_attn_implementationr   ÚtrainingÚattention_dropoutr†   ÚreshapeÚ
contiguousÚo_proj)r'   r+   r}   r~   r   ÚkwargsÚinput_shapeÚhidden_shapeÚquery_statesÚ
key_statesÚvalue_statesrb   rd   Úattention_interfaceÚattn_outputÚattn_weightss   &&&&&,          r   r6   ÚOlmoAttention.forwardu   s  € ð $×)Ñ)¨#¨2Ð.ˆØ8˜Ð8 bÐ8¨$¯-©-Ñ8ˆà—{‘{ =Ó1ˆØ—[‘[ Ó/ˆ
Ø—{‘{ =Ó1ˆà�;‰;×ÑÒ+Ø×Ñ T§[¡[×%9Ñ%9Ð$9¸t¿{¹{×?SÑ?SÐÔTØ×Ñ 4§;¡;×#7Ñ#7Ð"7¸T¿[¹[×=QÑ=QÐÔRØ×Ñ T§[¡[×%9Ñ%9Ð$9¸t¿{¹{×?SÑ?SÐÔTà#×(Ñ(¨Ó6×@Ñ@ÀÀAÓFˆØ—_‘_ \Ó2×<Ñ<¸QÀÓBˆ
Ø#×(Ñ(¨Ó6×@Ñ@ÀÀAÓFˆà&‰ˆÜ#7¸ÐRUÓ#[Ñ ˆàÒ&Ø'6×'=Ñ'=¸jÐX\×XfÑXfÓ'gÑ$ˆJä(?×(MÒ(MØ�K‰K×,Ñ,Ô.Eó)
Ðñ %8ØØØØØñ	%
ð  $Ÿ}Ÿ}˜}‘C°$×2HÑ2Hð	%
ð —L‘Lð	%
ð ñ	%
Ñ!ˆð "×)Ò)Ð;¨;Ð;¸Ó;×FÑFÓHˆØ—k‘k +Ó.ˆØÐ(Ð(r!   rl   r#   )r8   r9   r:   r;   r6   r=   r>   rn   s   @r   r{   r{   t   s   ø‡ € ÷/)÷ /)ð /)r!   r{   c                   ó>   a a€ ] tR t^§t oV3R lV 3R lltRtVtV ;t# )ÚOlmoDecoderLayerc                ó&   <€ V ^8„  d   QhRS[ RS[/# )r   rK   r�   )r   r   )r   r   s   "€r   r   ÚOlmoDecoderLayer.__annotate__¨   s   ø€ ÷ Kñ K™zð K±cñ Kr!   c                ó°   <€ \         SV `  W4       \        VP                  4      V n        \        VP                  4      V n        \        WR 7      V n        R# ))rK   r�   N)r$   r%   r   r   Úinput_layernormÚpost_attention_layernormr{   Ú	self_attn©r'   rK   r�   r(   s   &&&€r   r%   ÚOlmoDecoderLayer.__init__¨   sB   ø€ Ü‰Ñ˜Ô+Ü,¨V×-?Ñ-?Ó@ˆÔÜ(5°f×6HÑ6HÓ(IˆÔ%Ü&¨fÔJˆŽr!   )r¦   r§   r¨   rM   r@   s   @@r   r¢   r¢   §   s   ù‡ € ÷K÷ Kó Kr!   r¢   c                   ó>   a a€ ] tR t^¯t oV3R lV 3R lltRtVtV ;t# )Ú	OlmoModelc                ó    <€ V ^8„  d   QhRS[ /# )r   rK   r   )r   r   s   "€r   r   ÚOlmoModel.__annotate__°   s   ø€ ÷ 6ñ 6™zñ 6r!   c           	     óò   <€ \         SV `  V4       \        P                  ! \	        VP
                  4       Uu. uF  p\        W4      NK  	  up4      V n        \        VP                  4      V n
        R # u upi r#   )r$   r%   rE   Ú
ModuleListÚrangeÚnum_hidden_layersr¢   Úlayersr   r   Únormr©   s   && €r   r%   ÚOlmoModel.__init__°   s_   ø€ Ü‰Ñ˜Ô Ü—m’mÜBGÈ×H`ÑH`ÔBaÓbÑBa°YÔ˜fÖ0ÑBaÑbó
ˆŒô " &×"4Ñ"4Ó5ˆŽ	ùò cs   ¸A4)r³   r´   rM   r@   s   @@r   r¬   r¬   ¯   s   ù‡ € ÷6÷ 6ó 6r!   r¬   c                   ó   € ] tR t^¸tRtR# )ÚOlmoForCausalLMrl   N©r8   r9   r:   r;   r=   rl   r!   r   r·   r·   ¸   ó   † Ûr!   r·   c                   ó   € ] tR t^¼tRtR# )ÚOlmoForSequenceClassificationrl   Nr¸   rl   r!   r   r»   r»   ¼   r¹   r!   r»   )é   )r·   r»   r¬   ÚOlmoPreTrainedModel).Úcollections.abcr   r,   Útorch.nnrE   Útorch.nn.functionalÚ
functionalr1   Úcache_utilsr   Úintegrationsr   Úmodeling_rope_utilsr   Úmodeling_utilsr   Úutilsr   Úutils.genericr	   Úllama.modeling_llamar
   r   r   r   r   r   r   r   r   Úconfiguration_olmor   Ú
get_loggerr8   ÚloggerÚModuler   rB   rO   ry   r{   r¢   r¬   r·   r»   Ú__all__rl   r!   r   Ú<module>rÎ      sÜ   ðõ( %ã Ý ß Ð å  Ý 7Ý 6Ý 5Ý Ý +÷
÷ 
õ 
õ +ð 
×	Ò	˜HÓ	%€ô
�B—I‘Iô 
ôYˆhô YôÐ.ô ñ  Ð-Ó.ó2ó /ð2ô40)�Nô 0)ôfKÐ(ô Kô6�
ô 6ô	Ð&ô 	ô	Ð$Bô 	ò‚r!   