Ë
    T^(hô”  ã                   óÖ  — d Z ddlZddlmZ ddlmZmZmZmZm	Z	 ddl
Z
ddlZ
ddl
mZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZmZmZmZmZ ddlmZmZm Z  ddl!m"Z"  ejF                  e$«      Z% e «       rddl&m'Z' ndZ' e«       rddl(m)Z)m*Z* ddl+m,Z, nd\  Z,Z*Z) e«       r	ddl-m.Z.m/Z/ nd\  Z/Z. e0e,e*e.e/e)f«      Z1dZ2dZ3 G d„ dejh                  «      Z5 G d„ dejh                  «      Z6 G d„ dejh                  «      Z7 G d„ de«      Z8e G d „ d!e«      «       Z9e G d"„ d#e«      «       Z:d$Z;d%Z< ed&e;«       G d'„ d(e8«      «       Z= ed)e;«       G d*„ d+e8e«      «       Z>g d,¢Z?y)-zPyTorch MAMBA model.é    N)Ú	dataclass)ÚAnyÚDictÚOptionalÚTupleÚUnion)Únn)ÚCrossEntropyLossé   )ÚACT2FN)Ú
MambaCache)ÚGenerationMixin)ÚPreTrainedModel)ÚModelOutputÚadd_code_sample_docstringsÚadd_start_docstringsÚ%add_start_docstrings_to_model_forwardÚlogging)Úis_causal_conv1d_availableÚis_mamba_ssm_availableÚis_mambapy_availableé   )ÚMambaConfig)Úpscan)Úmamba_inner_fnÚselective_scan_fn)Úselective_state_update©NNN)Úcausal_conv1d_fnÚcausal_conv1d_update)NNzstate-spaces/mamba-130m-hfr   c            
       ó@  ‡ — e Zd ZdZdedefˆ fd„Z	 	 	 ddej                  de	e
   de	ej                     de	ej                     fd	„Zdde	e
   de	ej                     de	ej                     fd
„Z	 	 	 dde	e
   de	ej                     de	ej                     fd„Zˆ xZS )Ú
MambaMixeruƒ  
    Compute âˆ†, A, B, C, and D the state space parameters and compute the `contextualized_states`.
    A, D are input independent (see Mamba paper [1] Section 3.5.2 "Interpretation of A" for why A isn't selective)
    âˆ†, B, C are input-dependent (this is a key difference between Mamba and the linear time invariant S4,
    and is why Mamba is called **selective** state spaces)
    ÚconfigÚ	layer_idxc           	      ó|  •— t         ‰| �  «        || _        |j                  | _        |j                  | _        |j                  | _        |j                  | _        t        |j                  «      | _
        || _        |j                  | _        t        j                  | j                  | j                  |j                  |j                  | j                  |j                  dz
  ¬«      | _        |j                   | _        t$        |j                      | _        |j(                  | _        t        j*                  | j                  | j                  dz  |j,                  ¬«      | _        t        j*                  | j                  | j                  | j
                  dz  z   d¬«      | _        t        j*                  | j                  | j                  d¬«      | _        t5        j6                  d| j
                  dz   t4        j8                  ¬«      d d d …f   }|j;                  | j                  d«      j=                  «       }t        j>                  t5        j@                  |«      «      | _!        t        j>                  t5        jD                  | j                  «      «      | _#        t        j*                  | j                  | j                  |j,                  ¬«      | _$        |j,                  | _        tJ        sM| j(                  r+tM        «       rtN        jQ                  d	«       y tS        d
«      ‚tN        jQ                  d«       y y )Nr   )Úin_channelsÚout_channelsÚbiasÚkernel_sizeÚgroupsÚpaddingé   ©r(   FT©Údtypeéÿÿÿÿa7  The fast path is not available because one of `(selective_state_update, selective_scan_fn, causal_conv1d_fn, causal_conv1d_update, mamba_inner_fn)` is None. Falling back to the mamba.py backend. To install follow https://github.com/state-spaces/mamba/#installation and https://github.com/Dao-AILab/causal-conv1dzuse_mambapy is set to True but the mambapy package is not installed. To install it follow https://github.com/alxndrTL/mamba.py.a±  The fast path is not available because one of `(selective_state_update, selective_scan_fn, causal_conv1d_fn, causal_conv1d_update, mamba_inner_fn)` is None. Falling back to the sequential implementation of Mamba, as use_mambapy is set to False. To install follow https://github.com/state-spaces/mamba/#installation and https://github.com/Dao-AILab/causal-conv1d. For the mamba.py backend, follow https://github.com/alxndrTL/mamba.py.)*ÚsuperÚ__init__r#   Úhidden_sizeÚ
state_sizeÚssm_state_sizeÚconv_kernelÚconv_kernel_sizeÚintermediate_sizeÚintÚtime_step_rankr$   Úuse_conv_biasr	   ÚConv1dÚconv1dÚ
hidden_actÚ
activationr   ÚactÚuse_mambapyÚLinearÚuse_biasÚin_projÚx_projÚdt_projÚtorchÚarangeÚfloat32ÚexpandÚ
contiguousÚ	ParameterÚlogÚA_logÚonesÚDÚout_projÚis_fast_path_availabler   ÚloggerÚwarning_onceÚImportError)Úselfr#   r$   ÚAÚ	__class__s       €úf/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/models/mamba/modeling_mamba.pyr2   zMambaMixer.__init__K   s{  ø€ Ü‰ÑÔØˆŒØ!×-Ñ-ˆÔØ$×/Ñ/ˆÔØ &× 2Ñ 2ˆÔØ!'×!9Ñ!9ˆÔÜ! &×"7Ñ"7Ó8ˆÔØ"ˆŒØ#×1Ñ1ˆÔÜ—i‘iØ×.Ñ.Ø×/Ñ/Ø×%Ñ%Ø×*Ñ*Ø×)Ñ)Ø×&Ñ&¨Ñ*ô
ˆŒð !×+Ñ+ˆŒÜ˜&×+Ñ+Ñ,ˆŒà!×-Ñ-ˆÔô —y‘y ×!1Ñ!1°4×3IÑ3IÈAÑ3MÐTZ×TcÑTcÔdˆŒä—i‘i × 6Ñ 6¸×8KÑ8KÈd×NaÑNaÐdeÑNeÑ8eÐlqÔrˆŒä—y‘y ×!4Ñ!4°d×6LÑ6LÐSWÔXˆŒô �L‰L˜˜D×/Ñ/°!Ñ3¼5¿=¹=ÔIÈ$ÒPQÈ'ÑRˆØ�H‰H�T×+Ñ+¨RÓ0×;Ñ;Ó=ˆä—\‘\¤%§)¡)¨A£,Ó/ˆŒ
Ü—‘œeŸj™j¨×)?Ñ)?Ó@ÓAˆŒÜŸ	™	 $×"8Ñ"8¸$×:JÑ:JÐQW×Q`ÑQ`ÔaˆŒØŸ™ˆŒå%Ø×ÒÜ'Ô)Ü×'Ñ'ðFõô &ð Zóð ô ×#Ñ#ðJõð &ó    Úhidden_statesÚcache_paramsÚcache_positionÚattention_maskc                 óÈ	  — | j                  |«      j                  dd«      }| j                  �r%|�€"t        || j                  j
                  | j                  r| j                  j                  nd | j                  j
                  | j                  j
                  | j                  j
                  | j                  r$| j                  j                  j                  «       nd t        j                  | j                  j                  «       «       d d | j                   j                  «       | j                  j                  j                  «       d¬«      }|S |j#                  dd¬«      \  }}|�||j%                  d«      z  }| j                  j
                  j'                  | j                  j
                  j)                  d«      | j                  j
                  j)                  d«      «      }|�m|d   dkD  ret+        |j-                  d«      |j.                  | j0                     || j                  j                  | j2                  «      }|j%                  d«      }nˆ|�Yt4        j6                  j9                  || j:                  |j<                  d   z
  df«      }	|j?                  | j0                  |	|«       tA        ||| j                  j                  | j2                  ¬«      }|�||j%                  d«      z  }| j                  |j                  dd«      «      }
t        jB                  |
| jD                  | jF                  | jF                  gd¬«      \  }}}| j                  j
                  |j                  dd«      z  }t        j                  | j                  j                  «       «       }tI        | j                  d	«      r$| j                  j                  j                  «       nd }|�e|d   dkD  r]tK        |jL                  | j0                     |d
   |d
   ||d d …df   |d d …df   | j                   |d
   |d¬«
      j%                  d«      }nptO        ||||j                  dd«      |j                  dd«      | j                   j                  «       ||dd¬«
      \  }}|�|�|jQ                  | j0                  |«       | j                  |j                  dd«      «      }|S )Nr   r,   T)Ú
delta_biasÚdelta_softplus©Údimr   r0   )r?   r(   ).r   )Údt_softplus)ra   Úreturn_last_state))rD   Ú	transposeÚtrainingr   r=   Úweightr;   r(   rE   rF   rQ   rC   ÚfloatrG   ÚexprN   rP   ÚchunkÚ	unsqueezeÚviewÚsizer    ÚsqueezeÚconv_statesr$   r?   r	   Ú
functionalÚpadr7   ÚshapeÚupdate_conv_stater   Úsplitr:   r5   Úhasattrr   Ú
ssm_statesr   Úupdate_ssm_state)rV   r[   r\   r]   r^   Úprojected_statesÚcontextualized_statesÚgateÚconv_weightsrp   Ússm_parametersÚ	time_stepÚBÚCÚdiscrete_time_steprW   Útime_proj_biasÚscan_outputsÚ	ssm_states                      rY   Úcuda_kernels_forwardzMambaMixer.cuda_kernels_forward‡   s7  € ð  Ÿ<™<¨Ó6×@Ñ@ÀÀAÓFÐà�=‹=˜\Ñ1Ü$2Ø Ø—‘×"Ñ"Ø$(×$6Ò$6�—‘× Ò ¸DØ—‘×"Ñ"Ø—‘×#Ñ#Ø—‘×$Ñ$Ø.2¯mªm�—‘×"Ñ"×(Ñ(Ô*ÀÜ—‘˜4Ÿ:™:×+Ñ+Ó-Ó.Ð.ØØØ—‘—‘“ØŸ<™<×,Ñ,×2Ñ2Ó4Ø#ô%Ð!ðp %Ð$ðO #3×"8Ñ"8¸ÀÐ"8Ó"BÑˆM˜4àÐ)Ø -°×0HÑ0HÈÓ0KÑ K�ð  Ÿ;™;×-Ñ-×2Ñ2°4·;±;×3EÑ3E×3JÑ3JÈ1Ó3MÈtÏ{É{×OaÑOa×OfÑOfÐghÓOiÓjˆLØÐ'¨N¸1Ñ,=ÀÒ,AÜ 4Ø!×)Ñ)¨"Ó-Ø ×,Ñ,¨T¯^©^Ñ<Ø Ø—K‘K×$Ñ$Ø—O‘Oó!�ð !.× 7Ñ 7¸Ó ;‘àÐ+Ü"$§-¡-×"3Ñ"3Ø%¨×(=Ñ(=À×@SÑ@SÐTVÑ@WÑ(WÐYZÐ'[ó#�Kð !×2Ñ2°4·>±>À;ÐP^Ô_Ü 0Ø! <°·±×1AÑ1AÈdÏoÉoô!�ð Ð)Ø -°×0HÑ0HÈÓ0KÑ K�ð "Ÿ[™[¨×)@Ñ)@ÀÀAÓ)FÓGˆNÜ#Ÿk™kØ ×!4Ñ!4°d×6IÑ6IÈ4×K^ÑK^Ð _Ðegô‰OˆI�q˜!ð "&§¡×!4Ñ!4°y×7JÑ7JÈ1ÈaÓ7PÑ!PÐä—‘˜4Ÿ:™:×+Ñ+Ó-Ó.Ð.ˆAä:AÀ$Ç,Á,ÐPVÔ:W˜TŸ\™\×.Ñ.×4Ñ4Ô6Ð]aˆNØÐ'¨N¸1Ñ,=ÀÒ,AÜ5Ø ×+Ñ+¨D¯N©NÑ;Ø! &Ñ)Ø& vÑ.ØØ’a˜�d‘GØ’a˜�d‘GØ—F‘FØ˜‘LØ"Ø $ô ÷ ‘)˜B“-ñ ô +<Ø!Ø&ØØ—K‘K  1Ó%Ø—K‘K  1Ó%Ø—F‘F—L‘L“NØØ"Ø#'Ø&*ô+Ñ'�˜ið Ð(¨\Ð-EØ ×1Ñ1°$·.±.À)ÔLð %)§M¡M°,×2HÑ2HÈÈAÓ2NÓ$OÐ!Ø$Ð$rZ   c           	      óX  — |j                   \  }}}|j                  }| j                  |«      j                  dd«      }	|	j	                  dd¬«      \  }
}|�|
|j                  d«      z  }
|��¹|j                  | j                     j                  «       }|j                  |
j                  «      }|j                   d   | j                  k(  r‚t        j                  j                  |
| j                  |
j                   d   z
  df«      }|j                  | j                  ||«       | j!                  | j#                  |
«      dd |…f   «      }
�n9|j                  | j                  |
|«      }|j                  | j"                  j$                  j                  «      }t'        j(                  || j"                  j$                  d d …dd d …f   z  d¬«      }
| j*                  r|
| j"                  j,                  z  }
| j!                  |
«      j                  |«      j                  d«      }
n`t'        j.                  || j0                  | j2                  f|
j                  |¬«      }| j!                  | j#                  |
«      dd |…f   «      }
|�|
|j                  d«      z  }
| j5                  |
j                  dd«      «      }t'        j6                  || j8                  | j2                  | j2                  gd¬«      \  }}}| j;                  |«      }t        j                  j=                  |«      j                  dd«      }t'        j>                  | j@                  jC                  «       «       }t'        j>                  |d d d …d d d …f   |d d …d d …d d …d f   z  «      }|d d …d d …d d …d f   |d d …d d d …d d …f   jC                  «       z  }||
d d …d d …d d …d f   jC                  «       z  }| jD                  rœ| jF                  r�|€ŽtI        |j                  dd«      |j                  dd«      «      }||j                  d«      z  jK                  d«      j                  dd«      }||
| jL                  d d d …d f   z  z   }|| j!                  |«      z  }nüg }tO        |«      D ]}  }|d d …d d …|d d …f   |z  |d d …d d …|d d …f   z   }t'        jP                  |j                  |«      |d d …|d d …f   j                  d«      «      }|jS                  |d d …d d …df   «       Œ t'        jT                  |d¬«      }||
| jL                  d d d …d f   z  z   }|| j!                  |«      z  }|�(|j                  | j                     jW                  |«       | jY                  |j                  dd«      «      }|S )	Nr   r,   rb   r   r0   .©Údevicer/   r   )-rs   r/   rD   rf   rk   rl   rw   r$   ÚcloneÚtorˆ   r7   r	   rq   rr   rt   r@   r=   rh   rG   Úsumr;   r(   Úzerosr8   r5   rE   ru   r:   rF   Úsoftplusrj   rN   ri   rA   rg   r   ro   rP   ÚrangeÚmatmulÚappendÚstackÚcopy_rQ   )rV   Úinput_statesr\   r]   r^   Ú
batch_sizeÚseq_lenÚ_r/   ry   r[   r{   r„   Ú
conv_stater}   r~   r   r€   r�   rW   Ú
discrete_AÚ
discrete_BÚdeltaB_uÚhsÚscan_outputrƒ   Úirz   s                               rY   Úslow_forwardzMambaMixer.slow_forwardí   s  € Ø!-×!3Ñ!3Ñˆ
�G˜QØ×"Ñ"ˆàŸ<™<¨Ó5×?Ñ?ÀÀ1ÓEÐØ.×4Ñ4°Q¸AÐ4Ó>Ñˆ�tàÐ%Ø)¨N×,DÑ,DÀQÓ,GÑGˆMð Ñ#Ø$×/Ñ/°·±Ñ?×EÑEÓGˆIØ!Ÿ™ ]×%9Ñ%9Ó:ˆIð ×#Ñ# AÑ&¨$×*?Ñ*?Ò?ÜŸ]™]×.Ñ.Ø!Ø×*Ñ*¨]×-@Ñ-@ÀÑ-DÑDÀaÐHó�
ð
 ×.Ñ.¨t¯~©~¸zÈ>ÔZØ $§¡¨¯©°]Ó)CÀCÈÈ'ÈÀMÑ)RÓ S’à)×;Ñ;¸D¿N¹NÈMÐ[iÓj�
Ø'Ÿ]™]¨4¯;©;×+=Ñ+=×+DÑ+DÓE�
Ü %§	¡	¨*°t·{±{×7IÑ7IÊ!ÈQÒPQÈ'Ñ7RÑ*RÐXZÔ [�Ø×%Ò%Ø! T§[¡[×%5Ñ%5Ñ5�MØ $§¡¨Ó 7× :Ñ :¸5Ó A× KÑ KÈBÓ O‘äŸ™Ø˜T×3Ñ3°T×5HÑ5HÐIØ$×+Ñ+°5ôˆIð !ŸH™H T§[¡[°Ó%?ÀÀXÀgÀXÀÑ%NÓOˆMàÐ%Ø)¨N×,DÑ,DÀQÓ,GÑGˆMð Ÿ™ ]×%<Ñ%<¸QÀÓ%BÓCˆÜŸ+™+Ø˜T×0Ñ0°$×2EÑ2EÀt×GZÑGZÐ[Ðacô
‰ˆ	�1�að "Ÿ\™\¨)Ó4ÐÜŸ]™]×3Ñ3Ð4FÓG×QÑQÐRSÐUVÓWÐô �Y‰Y�t—z‘z×'Ñ'Ó)Ó*Ð*ˆÜ—Y‘Y˜q ¢q¨$²Ð!1Ñ2Ð5GÊÊ1ÊaÐQUÈÑ5VÑVÓWˆ
Ø'ªª1ªa°¨Ñ6¸º1¸dÂAÂq¸=Ñ9I×9OÑ9OÓ9QÑQˆ
Ø ªa²²A°t¨mÑ <× BÑ BÓ DÑDˆð ×Ò §¢°,Ð2FÜ�z×+Ñ+¨A¨qÓ1°8×3EÑ3EÀaÈÓ3KÓLˆBà §¡¨B£Ñ/×8Ñ8¸Ó;×EÑEÀaÈÓKˆKØ%¨¸¿¹¸tÂQÈ¸}Ñ8MÑ(MÑMˆKØ%¨¯©°«Ñ6‰KàˆLÜ˜7“^ò :�Ø&¢qª!¨Q² zÑ2°YÑ>ÀÊ!ÊQÐPQÒSTÈ*ÑAUÑU�	Ü#Ÿl™l¨9¯<©<¸Ó+>ÀÂ!ÀQÊÀ'Á
×@TÑ@TÐUWÓ@XÓY�Ø×#Ñ# K²²1°a°Ñ$8Õ9ð:ô  Ÿ+™+ l¸Ô;ˆKØ%¨¸¿¹ÀÂaÈÀÑ9NÑ)NÑOˆKØ&¨¯©°$«Ñ7ˆKàÐ'Ø×'Ñ'¨¯©Ñ7×=Ñ=¸iÔHð !%§¡¨k×.CÑ.CÀAÀqÓ.IÓ JÐØ$Ð$rZ   c                 óò   — t         r^d| j                  j                  j                  j                  v r2t
        j                  j                  «       s| j                  ||||«      S | j                  ||||«      S )NÚcuda)
rR   rE   rh   rˆ   ÚtyperG   Ú_dynamoÚis_compilingr…   rž   )rV   r[   r\   r]   r^   s        rY   ÚforwardzMambaMixer.forward?  se   € õ " f°·±×0BÑ0B×0IÑ0I×0NÑ0NÑ&NÔW\×WdÑWd×WqÑWqÔWsØ×,Ñ,¨]¸LÈ.ÐZhÓiÐiØ× Ñ  °¸nÈnÓ]Ð]rZ   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r9   r2   rG   ÚTensorr   r   Ú
LongTensorr…   rž   r¤   Ú__classcell__©rX   s   @rY   r"   r"   C   s  ø„ ñð:˜{ð :°sõ :ð~ .2Ø59Ø59ñc%à—|‘|ðc%ð ˜zÑ*ðc%ð ! ×!1Ñ!1Ñ2ð	c%ð
 ! ×!1Ñ!1Ñ2óc%ñLO%°xÀ
Ñ7Kð O%ÐaiÐjo×jzÑjzÑa{ð O%ð  S[ð  \a÷  \lñ  \lñ  Smó O%ðj .2Ø59Ø59ñ	^ð ˜zÑ*ð	^ð ! ×!1Ñ!1Ñ2ð		^ð
 ! ×!1Ñ!1Ñ2÷	^rZ   r"   c                   ó,   ‡ — e Zd Zdˆ fd„	Zd„ Zd„ Zˆ xZS )ÚMambaRMSNormc                 óŠ   •— t         ‰| �  «        t        j                  t	        j
                  |«      «      | _        || _        y)zL
        MambaRMSNorm is equivalent to T5LayerNorm and LlamaRMSNorm
        N)r1   r2   r	   rL   rG   rO   rh   Úvariance_epsilon)rV   r3   ÚepsrX   s      €rY   r2   zMambaRMSNorm.__init__L  s1   ø€ ô 	‰ÑÔÜ—l‘l¤5§:¡:¨kÓ#:Ó;ˆŒØ #ˆÕrZ   c                 ó"  — |j                   }|j                  t        j                  «      }|j	                  d«      j                  dd¬«      }|t        j                  || j                  z   «      z  }| j                  |j                  |«      z  S )Nr,   r0   T)Úkeepdim)	r/   rŠ   rG   rI   ÚpowÚmeanÚrsqrtr°   rh   )rV   r[   Úinput_dtypeÚvariances       rY   r¤   zMambaRMSNorm.forwardT  sy   € Ø#×)Ñ)ˆØ%×(Ñ(¬¯©Ó7ˆØ ×$Ñ$ QÓ'×,Ñ,¨R¸Ð,Ó>ˆØ%¬¯©°H¸t×?TÑ?TÑ4TÓ(UÑUˆØ�{‰{˜]×-Ñ-¨kÓ:Ñ:Ð:rZ   c                 óR   — | j                   j                  d   › d| j                  › �S )Nr   z, eps=)rh   rs   r°   ©rV   s    rY   Ú
extra_reprzMambaRMSNorm.extra_repr[  s*   € Ø—+‘+×#Ñ# AÑ&Ð' v¨d×.CÑ.CÐ-DÐEÐErZ   )g�íµ ÷Æ°>)r¥   r¦   r§   r2   r¤   r»   r«   r¬   s   @rY   r®   r®   K  s   ø„ õ$ò;öFrZ   r®   c                   ót   ‡ — e Zd Zˆ fd„Z	 	 	 ddee   deej                     deej                     fd„Zˆ xZ	S )Ú
MambaBlockc                 óÐ   •— t         ‰| �  «        || _        || _        |j                  | _        t        |j                  |j                  ¬«      | _        t        ||¬«      | _
        y )N©r±   ©r$   )r1   r2   r#   r$   Úresidual_in_fp32r®   r3   Úlayer_norm_epsilonÚnormr"   Úmixer)rV   r#   r$   rX   s      €rY   r2   zMambaBlock.__init__`  sR   ø€ Ü‰ÑÔØˆŒØ"ˆŒØ &× 7Ñ 7ˆÔÜ  ×!3Ñ!3¸×9RÑ9RÔSˆŒ	Ü °)Ô<ˆ�
rZ   r\   r]   r^   c                 ó  — |}| j                  |j                  | j                   j                  j                  ¬«      «      }| j                  r|j                  t
        j                  «      }| j                  ||||¬«      }||z   }|S )Nr.   ©r\   r]   r^   )rÃ   rŠ   rh   r/   rÁ   rG   rI   rÄ   )rV   r[   r\   r]   r^   Úresiduals         rY   r¤   zMambaBlock.forwardh  s   € ð !ˆØŸ	™	 -×"2Ñ"2¸¿¹×9IÑ9I×9OÑ9OÐ"2Ó"PÓQˆØ× Ò Ø—{‘{¤5§=¡=Ó1ˆHàŸ
™
Ø¨À^Ðdrð #ó 
ˆð ! =Ñ0ˆØÐrZ   r   )
r¥   r¦   r§   r2   r   r   rG   rª   r¤   r«   r¬   s   @rY   r½   r½   _  sQ   ø„ ô=ð .2Ø59Ø59ñð ˜zÑ*ðð ! ×!1Ñ!1Ñ2ð	ð
 ! ×!1Ñ!1Ñ2÷rZ   r½   c                   ó.   — e Zd ZdZeZdZddgZdZdZ	d„ Z
y)ÚMambaPreTrainedModelz†
    An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
    models.
    Úbackboner½   r"   Tc                 óè  — t        |t        «      �rWd|j                  _        d|j                  _        | j
                  j                  dz  | j
                  j                  z  }| j
                  j                  dk(  r5t        j                  j                  |j                  j                  |«       nO| j
                  j                  dk(  r6t        j                  j                  |j                  j                  | |«       t        j                   t        j"                  | j
                  j$                  «      t'        j(                  | j
                  j*                  «      t'        j(                  | j
                  j,                  «      z
  z  t'        j(                  | j
                  j,                  «      z   «      j/                  | j
                  j0                  ¬«      }|t        j(                  t        j2                  | «       «      z   }t        j4                  «       5  |j                  j6                  j9                  |«       ddd«       d|j                  j6                  _        t        |t        j<                  «      rM|j6                  �št?        |j6                  dd«      sƒt        j                  jA                  |j6                  «       nYt        |t        jB                  «      r?t        j                  jE                  |j                  | j
                  jF                  ¬	«       | j
                  jH                  r›|jK                  «       D ]‡  \  }}|d
v sŒt        j                  jM                  |t'        jN                  d«      ¬«       t        j4                  «       5  |t'        jN                  | j
                  jP                  «      z  }ddd«       Œ‰ yy# 1 sw Y   �Œ—xY w# 1 sw Y   Œ¢xY w)zInitialize the weights.Tg      à¿ÚconstantÚrandom)ÚminNÚ
_no_reinitF)Ústd)zout_proj.weighté   )Úa))Ú
isinstancer"   rN   Ú_no_weight_decayrP   r#   r:   Útime_step_scaleÚtime_step_init_schemer	   ÚinitÚ	constant_rF   rh   Úuniform_rG   rj   Úrandr8   ÚmathrM   Útime_step_maxÚtime_step_minÚclampÚtime_step_floorÚexpm1Úno_gradr(   r’   rÏ   rB   ÚgetattrÚzeros_Ú	EmbeddingÚnormal_Úinitializer_rangeÚrescale_prenorm_residualÚnamed_parametersÚkaiming_uniform_ÚsqrtÚnum_hidden_layers)rV   ÚmoduleÚdt_init_stdÚdtÚinv_dtÚnameÚps          rY   Ú_init_weightsz"MambaPreTrainedModel._init_weights‡  s±  € ä�fœjÕ)Ø,0ˆF�L‰LÔ)Ø(,ˆF�H‰HÔ%àŸ+™+×4Ñ4°dÑ:¸T¿[¹[×=XÑ=XÑXˆKØ�{‰{×0Ñ0°JÒ>Ü—‘×!Ñ! &§.¡.×"7Ñ"7¸ÕEØ—‘×2Ñ2°hÒ>Ü—‘× Ñ  §¡×!6Ñ!6¸¸ÀkÔRä—‘Ü—
‘
˜4Ÿ;™;×8Ñ8Ó9Ü—8‘8˜DŸK™K×5Ñ5Ó6¼¿¹À$Ç+Á+×B[ÑB[Ó9\Ñ\ñ^ä—(‘(˜4Ÿ;™;×4Ñ4Ó5ñ6ó÷ ‰e˜Ÿ™×3Ñ3ˆeÓ4ð	 ð œ%Ÿ)™)¤U§[¡[°"°Ó%5Ð$5Ó6Ñ6ˆFÜ—‘“ñ 2Ø—‘×#Ñ#×)Ñ)¨&Ô1÷2à-1ˆF�N‰N×ÑÔ*ä�fœbŸi™iÔ(Ø�{‰{Ð&Ü˜vŸ{™{¨L¸%Ô@Ü—G‘G—N‘N 6§;¡;Õ/Ü˜¤§¡Ô-Ü�G‰G�O‰O˜FŸM™M¨t¯{©{×/LÑ/LˆOÔMà�;‰;×/Ò/ð "×2Ñ2Ó4ò F‘��aØÐ.Ò.ô
 —G‘G×,Ñ,¨Q´$·)±)¸A³,Ð,Ô?ÜŸ™›ñ FØœTŸY™Y t§{¡{×'DÑ'DÓEÑE˜÷Fð FñFð 0÷2ñ 2ú÷2Fð Fús   È &OÎ"-O(ÏO%Ï(O1	N)r¥   r¦   r§   r¨   r   Úconfig_classÚbase_model_prefixÚ_no_split_modulesÚsupports_gradient_checkpointingÚ_is_statefulrò   © rZ   rY   rÉ   rÉ   {  s0   „ ñð
 €LØ"ÐØ% |Ð4ÐØ&*Ð#Ø€Ló-FrZ   rÉ   c                   ó|   — e Zd ZU dZdZeej                     ed<   dZ	ee
   ed<   dZeeej                        ed<   y)ÚMambaOutputa#  
    Class for the MAMBA model outputs.

    Args:
        last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`):
            Sequence of hidden-states at the output of the last layer of the model.
        cache_params (`MambaCache`):
            The state of the model at the last time step. Can be used in a forward method with the next `input_ids` to
            avoid providing the old `input_ids`.

            Includes both the State space model state matrices after the selective scan, and the Convolutional states
        hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
            Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
            one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

            Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
    NÚlast_hidden_stater\   r[   )r¥   r¦   r§   r¨   rû   r   rG   ÚFloatTensorÚ__annotations__r\   r   r[   r   rø   rZ   rY   rú   rú   ·  sH   … ñð$ 6:Ð�x × 1Ñ 1Ñ2Ó9Ø)-€L�(˜:Ñ&Ó-Ø8<€M�8˜E %×"3Ñ"3Ñ4Ñ5Ô<rZ   rú   c                   ó¤   — e Zd ZU dZdZeej                     ed<   dZ	eej                     ed<   dZ
ee   ed<   dZeeej                        ed<   y)ÚMambaCausalLMOutputaü  
    Base class for causal language model (or autoregressive) outputs.

    Args:
        loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
            Language modeling loss (for next-token prediction).
        logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`):
            Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).
        cache_params (`MambaCache`):
            The state of the model at the last time step. Can be used in a forward method with the next `input_ids` to
            avoid providing the old `input_ids`.

            Includes both the State space model state matrices after the selective scan, and the Convolutional states
        hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
            Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
            one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

            Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
    NÚlossÚlogitsr\   r[   )r¥   r¦   r§   r¨   r   r   rG   rü   rý   r  r\   r   r[   r   rø   rZ   rY   rÿ   rÿ   Ð  s\   … ñð( )-€Dˆ(�5×$Ñ$Ñ
%Ó,Ø*.€FˆH�U×&Ñ&Ñ'Ó.Ø)-€L�(˜:Ñ&Ó-Ø8<€M�8˜E %×"3Ñ"3Ñ4Ñ5Ô<rZ   rÿ   a?  

    This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
    library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
    etc.)

    This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
    Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
    and behavior.

    Parameters:
        config ([`MambaConfig`]): Model configuration class with all the parameters of the model.
            Initializing with a config file does not load the weights associated with the model, only the
            configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
aò  
    Args:
        input_ids (`torch.LongTensor` of shape `(batch_size, input_ids_length)`):
            Indices of input sequence tokens in the vocabulary.

            If `cache_params.seqlen_offset>0`, only `input_ids` that do not have their past calculated should be passed as
            `input_ids`.

            Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
            [`PreTrainedTokenizer.__call__`] for details.

            [What are input IDs?](../glossary#input-ids)
        inputs_embeds (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*):
            Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation. This
            is useful if you want more control over how to convert `input_ids` indices into associated vectors than the
            model's internal embedding lookup matrix.
        cache_params (`MambaCache`, *optional*):
            If passed along, the model uses the previous state in all the blocks (which will give the output for the
            `input_ids` provided as if the model add `state_input_ids + input_ids` as context).
        use_cache (`bool`, *optional*):
            If set to `True`, the `cache_params` is returned and can be used to quickly generate the next logits.
        output_hidden_states (`bool`, *optional*):
            Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
            more detail.
        return_dict (`bool`, *optional*):
            Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
        cache_position (`torch.LongTensor` of shape `(sequence_length)`, *optional*):
            Indices depicting the position of the input sequence tokens in the sequence. Contrarily to `position_ids`,
            this tensor is not affected by padding. It is used to update the cache in the correct position and to infer
            the complete sequence length.
z_The bare MAMBA Model transformer outputting raw hidden-states without any specific head on top.c                   ó*  ‡ — e Zd Zˆ fd„Zd„ Zd„ Zd„ Z ee«       e	e
ee¬«      	 	 	 	 	 	 	 	 ddeej                     deej                     dee   d	ee   d
ee   dee   deej                     deej                     deeef   fd„«       «       Zˆ xZS )Ú
MambaModelc           	      óÈ  •— t         ‰| �  |«       t        j                  |j                  |j
                  «      | _        t        j                  t        |j                  «      D �cg c]  }t        ||¬«      ‘Œ c}«      | _        d| _        t        |j
                  |j                  ¬«      | _        | j!                  | j"                  «       | j%                  «        y c c}w )NrÀ   Fr¿   )r1   r2   r	   rä   Ú
vocab_sizer3   Ú
embeddingsÚ
ModuleListrŽ   rë   r½   ÚlayersÚgradient_checkpointingr®   rÂ   Únorm_fÚ"_register_load_state_dict_pre_hookÚ	load_hookÚ	post_init)rV   r#   ÚidxrX   s      €rY   r2   zMambaModel.__init__"  s¡   ø€ Ü‰Ñ˜Ô äŸ,™, v×'8Ñ'8¸&×:LÑ:LÓMˆŒÜ—m‘mÔRWÐX^×XpÑXpÓRqÖ$rÈ3¤Z°À#Ö%FÒ$rÓsˆŒà&+ˆÔ#Ü" 6×#5Ñ#5¸6×;TÑ;TÔUˆŒà×/Ñ/°·±Ô?Ø�‰Õùò %ss   Á&Cc                 óf   — |D ],  }d|v sŒ|j                  |«      ||j                  dd«      <    y  y )Nz
embedding.zembeddings.)ÚpopÚreplace)rV   Ú
state_dictÚprefixÚargsÚks        rY   r  zMambaModel.load_hook.  s;   € Øò 	ˆAØ˜qÒ ØEOÇ^Á^ÐTUÓEV�
˜1Ÿ9™9 \°=ÓAÑBÙñ	rZ   c                 ó   — | j                   S ©N©r  rº   s    rY   Úget_input_embeddingszMambaModel.get_input_embeddings4  s   € Ø�‰ÐrZ   c                 ó   — || _         y r  r  ©rV   Únew_embeddingss     rY   Úset_input_embeddingszMambaModel.set_input_embeddings7  s	   € Ø(ˆ�rZ   ©Ú
checkpointÚoutput_typeró   Ú	input_idsÚinputs_embedsr\   Ú	use_cacheÚoutput_hidden_statesÚreturn_dictr]   r^   Úreturnc	                 ó¨  — |�|n| j                   j                  }|�|n#| j                  s| j                   j                  nd}|�|n| j                   j                  }|d u |d uz  rt        d«      ‚|€| j                  |«      }| j                  r| j                  r|rd}|r‚|€st        | j                   |j                  d«      |j                  |j                  ¬«      }t        j                  d| j                   j                  |j                  ¬«      }n|€t        d«      ‚d }|}	|rdnd }
| j                  D ]O  }| j                  r,| j                  r | j!                  |j"                  |	|||«      }	n ||	|||¬«      }	|sŒJ|
|	fz   }
ŒQ | j%                  |	«      }	|r|
|	fz   }
|st'        d	„ |	||
fD «       «      S t)        |	|r||
¬
«      S d |
¬
«      S )NFz:You must specify exactly one of input_ids or inputs_embedsr   r‡   ©rˆ   zîYou have to specify the `cache_position` manually when `use_cache=True` and `cache_params` is passed, you don't have to pass a `cache_params` if you are in prefilling stage because in that case it will be initialized for you automaticallyrø   rÆ   c              3   ó&   K  — | ]	  }|€Œ|–— Œ y ­wr  rø   )Ú.0Úvs     rY   ú	<genexpr>z%MambaModel.forward.<locals>.<genexpr>„  s   è ø€ Òf˜qÐXYÑXeœÑfùs   ‚Š)rû   r\   r[   )r#   r$  rg   r#  Úuse_return_dictÚ
ValueErrorr  r	  r   rn   rˆ   r/   rG   rH   r6   r  Ú_gradient_checkpointing_funcÚ__call__r
  Útuplerú   )rV   r!  r"  r\   r#  r$  r%  r]   r^   r[   Úall_hidden_statesÚmixer_blocks               rY   r¤   zMambaModel.forward:  s  € ð$ %9Ð$DÑ È$Ï+É+×JjÑJjð 	ð "+Ð!6‘IÐZ^×ZgÒZg¸T¿[¹[×=RÒ=RÐmrˆ	Ø%0Ð%<‘kÀ$Ç+Á+×B]ÑB]ˆà˜Ð -°tÐ";Ò<ÜÐYÓZÐZàÐ Ø ŸO™O¨IÓ6ˆMà×&Ò&¨4¯=ª=¹YØˆIáØÐ#Ü)Ø—K‘K ×!3Ñ!3°AÓ!6¸}×?SÑ?SÐ[h×[nÑ[nô �ô "'§¡¨a°·±×1HÑ1HÐQ^×QeÑQeÔ!f‘ØÐ'ô !ð;óð ð  ˆLà%ˆÙ"6™B¸DÐØŸ;™;ò 	IˆKØ×*Ò*¨t¯}ª}Ø $× AÑ AØ×(Ñ(¨-¸À~ÐWeó!‘ñ !,Ø!Ø!-Ø#1Ø#1ô	!�ò $Ø$5¸Ð8HÑ$HÑ!ð	Ið  Ÿ™ MÓ2ˆáØ 1°]Ð4DÑ DÐáÜÑf ]°LÐBSÐ$TÔfÓfÐfäØ+Ù)2˜Ø+ô
ð 	
à8<Ø+ô
ð 	
rZ   )NNNNNNNN)r¥   r¦   r§   r2   r  r  r  r   ÚMAMBA_INPUTS_DOCSTRINGr   Ú_CHECKPOINT_FOR_DOCrú   Ú_CONFIG_FOR_DOCr   rG   rª   r   Úboolr   r   r¤   r«   r¬   s   @rY   r  r    s  ø„ ô

òòò)ñ +Ð+AÓBÙØ&ØØ$ôð 15Ø48Ø-1Ø$(Ø/3Ø&*Ø59Ø59ñJ
à˜E×,Ñ,Ñ-ðJ
ð   × 0Ñ 0Ñ1ðJ
ð ˜zÑ*ð	J
ð
 ˜D‘>ðJ
ð ' t™nðJ
ð ˜d‘^ðJ
ð ! ×!1Ñ!1Ñ2ðJ
ð ! ×!1Ñ!1Ñ2ðJ
ð 
ˆu�kÐ!Ñ	"òJ
óó CôJ
rZ   r  zˆ
    The MAMBA Model transformer with a language modeling head on top (linear layer with weights tied to the input
    embeddings).
    c                   óà  ‡ — e Zd ZdgZˆ fd„Zd„ Zd„ Zd„ Zd„ Z	 dde	de
eef   d	ed
e
eef   fd„Z	 	 	 	 	 ddee   deej$                     deej$                     fd„Z ee«       eeee¬«      	 	 	 	 	 	 	 	 	 ddeej$                     deej$                     deej4                     dee   deej$                     dee   dee   dee   deej8                     d
eeef   fd„«       «       Zˆ xZ S )ÚMambaForCausalLMzlm_head.weightc                 óÆ   •— t         ‰| �  |«       t        |«      | _        t	        j
                  |j                  |j                  d¬«      | _        | j                  «        y )NFr-   )
r1   r2   r  rÊ   r	   rB   r3   r  Úlm_headr  )rV   r#   rX   s     €rY   r2   zMambaForCausalLM.__init__—  sF   ø€ Ü‰Ñ˜Ô Ü" 6Ó*ˆŒÜ—y‘y ×!3Ñ!3°V×5FÑ5FÈUÔSˆŒà�‰ÕrZ   c                 ó   — | j                   S r  ©r;  rº   s    rY   Úget_output_embeddingsz&MambaForCausalLM.get_output_embeddingsž  s   € Ø�|‰|ÐrZ   c                 ó   — || _         y r  r=  r  s     rY   Úset_output_embeddingsz&MambaForCausalLM.set_output_embeddings¡  s	   € Ø%ˆ�rZ   c                 ó6   — | j                   j                  «       S r  )rÊ   r  rº   s    rY   r  z%MambaForCausalLM.get_input_embeddings¤  s   € Ø�}‰}×1Ñ1Ó3Ð3rZ   c                 ó8   — | j                   j                  |«      S r  )rÊ   r  r  s     rY   r  z%MambaForCausalLM.set_input_embeddings§  s   € Ø�}‰}×1Ñ1°.ÓAÐArZ   ÚoutputsÚmodel_kwargsÚnum_new_tokensr&  c                 ó  — |j                  dd «      |d<   |j                  dd«      rd|v r|d   �|d   dd  |z   |d<   d|v r?|d   }t        j                  ||j                  |j                  d   df«      gd¬	«      |d<   |S )
Nr\   r#  Tr]   r0   r^   r   r   rb   )ÚgetrG   ÚcatÚnew_onesrs   )rV   rC  rD  rE  Úkwargsr^   s         rY   Ú#_update_model_kwargs_for_generationz4MambaForCausalLM._update_model_kwargs_for_generationª  s±   € ð (/§{¡{°>À4Ó'Hˆ�^Ñ$à×Ñ˜[¨$Ô/Ø  LÑ0ØÐ-Ñ.Ð:à-9Ð:JÑ-KÈBÈCÐ-PÐSaÑ-aˆLÐ)Ñ*à˜|Ñ+Ø)Ð*:Ñ;ˆNÜ-2¯Y©YØ ×!8Ñ!8¸.×:NÑ:NÈqÑ:QÐSTÐ9UÓ!VÐWÐ]_ô.ˆLÐ)Ñ*ð ÐrZ   r\   r]   r^   c                 ó<  — |rh|€t        d«      ‚|d   dkD  r|d d …df   j                  d«      }|�9d }n6t        j                  d| j                  j
                  |j                  ¬«      }|�|€d|i}nd|j                  «       i}|j                  ||||dœ«       |S )Nzé`cache_position` should not be None as it should have been initialized in `model.generate`, you are responsible for passing in a valid `cache_position` if you are calling `prepare_inputs_for_generation` directly with `use_cache=True`r   r0   r(  r"  r!  )r\   r#  r]   r^   )	r.  rl   rG   rH   r#   r6   rˆ   rK   Úupdate)	rV   r!  r"  r#  r\   r]   r^   rJ  Úmodel_inputss	            rY   Úprepare_inputs_for_generationz.MambaForCausalLM.prepare_inputs_for_generation½  sÇ   € ñ àÐ%Ü ðeóð ð
 ˜aÑ  1Ò$Ø%¢a¨ eÑ,×6Ñ6°rÓ:�	à!Ð-Ø%)‘Nô "'§¡¨a°·±×1HÑ1HÐQZ×QaÑQaÔ!b�àÐ$¨Ð)=Ø+¨]Ð;‰Là'¨×)=Ñ)=Ó)?Ð@ˆLà×Ñà ,Ø&Ø"0Ø"0ñ	ô	
ð ÐrZ   r  r!  r"  Úlabelsr$  r%  r#  c
           
      óœ  — |�|n| j                   j                  }| j                  |||||||	|¬«      }|d   }| j                  |j	                  | j                  j
                  j                  «      «      j                  «       }d}|��|j	                  |j                  «      }|ddd…dd…f   j                  «       }|ddd…f   j                  «       }t        «       } ||j                  d|j                  d«      «      |j                  d«      «      }|s|f|dd z   }|�|f|z   S |S t        |||j                  |j                  ¬«      S )a³  
        labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
            Labels for language modeling. Note that the labels **are shifted** inside the model, i.e. you can set
            `labels = input_ids` Indices are selected in `[-100, 0, ..., config.vocab_size]` All labels set to `-100`
            are ignored (masked), the loss is only computed for labels in `[0, ..., config.vocab_size]`
        N)r\   r"  r$  r%  r#  r]   r^   r   .r0   r   )r   r  r\   r[   )r#   r-  rÊ   r;  rŠ   rh   r/   ri   rˆ   rK   r
   rm   rn   rÿ   r\   r[   )rV   r!  r^   r"  r\   rP  r$  r%  r#  r]   rJ  Úmamba_outputsr[   r  r   Úshift_logitsÚshift_labelsÚloss_fctÚoutputs                      rY   r¤   zMambaForCausalLM.forwardí  s_  € ð2 &1Ð%<‘kÀ$Ç+Á+×B]ÑB]ˆàŸ™ØØ%Ø'Ø!5Ø#ØØ)Ø)ð &ó 	
ˆð & aÑ(ˆà—‘˜m×.Ñ.¨t¯|©|×/BÑ/B×/HÑ/HÓIÓJ×PÑPÓRˆàˆØÐà—Y‘Y˜vŸ}™}Ó-ˆFà! # s¨ sªA +Ñ.×9Ñ9Ó;ˆLØ! # q¡r '™?×5Ñ5Ó7ˆLä'Ó)ˆHÙ˜L×-Ñ-¨b°,×2CÑ2CÀBÓ2GÓHÈ,×J[ÑJ[Ð\^ÓJ_Ó`ˆDáØ�Y ¨q¨rÐ!2Ñ2ˆFØ)-Ð)9�T�G˜fÑ$ÐE¸vÐEä"ØØØ&×3Ñ3Ø'×5Ñ5ô	
ð 	
rZ   )r   )NNNNN)	NNNNNNNNN)!r¥   r¦   r§   Ú_tied_weights_keysr2   r>  r@  r  r  r   r   Ústrr   r9   rK  r   r   rG   rª   rO  r   r4  r   r5  rÿ   r6  rü   r7  r©   r   r   r¤   r«   r¬   s   @rY   r9  r9  �  sµ  ø„ ð +Ð+Ðôòò&ò4òBð YZñØ"ðØ26°s¸C°x±.ðØRUðà	ˆc�3ˆh‰óð, ØØ-1Ø59Ø59ñ.ð
 ˜zÑ*ð.ð ! ×!1Ñ!1Ñ2ð.ð ! ×!1Ñ!1Ñ2ó.ñ` +Ð+AÓBÙØ&Ø'Ø$ôð 15Ø59Ø59Ø-1Ø-1Ø/3Ø&*Ø$(Ø15ñ7
à˜E×,Ñ,Ñ-ð7
ð ! ×!1Ñ!1Ñ2ð7
ð   × 1Ñ 1Ñ2ð	7
ð
 ˜zÑ*ð7
ð ˜×)Ñ)Ñ*ð7
ð ' t™nð7
ð ˜d‘^ð7
ð ˜D‘>ð7
ð ! §¡Ñ.ð7
ð 
ˆuÐ)Ð)Ñ	*ò7
óó Cô7
rZ   r9  )r9  r  rÉ   )@r¨   rÛ   Údataclassesr   Útypingr   r   r   r   r   rG   Útorch.utils.checkpointr	   Útorch.nnr
   Úactivationsr   Úcache_utilsr   Ú
generationr   Úmodeling_utilsr   Úutilsr   r   r   r   r   Úutils.import_utilsr   r   r   Úconfiguration_mambar   Ú
get_loggerr¥   rS   Úmambapy.pscanr   Ú&mamba_ssm.ops.selective_scan_interfacer   r   Ú+mamba_ssm.ops.triton.selective_state_updater   Úcausal_conv1dr   r    ÚallrR   r5  r6  ÚModuler"   r®   r½   rÉ   rú   rÿ   ÚMAMBA_START_DOCSTRINGr4  r  r9  Ú__all__rø   rZ   rY   ú<module>rm     s³  ðñ ã Ý !ß 4Õ 4ã Û Ý Ý %å !Ý %Ý )Ý -÷õ ÷ kÑ jÝ ,ð 
ˆ×	Ñ	˜HÓ	%€áÔÞ#à€EáÔßXÞRà@PÑ=ÐÐ-¨~áÔßDÐDà-7Ñ*ÐÐ*áØÐ.Ð0@ÐBVÐXfÐgóÐ ð 3Ð Ø€ôE^�—‘ô E^ôPF�2—9‘9ô Fô(�—‘ô ô89F˜?ô 9Fðx ô=�+ó =ó ð=ð0 ô=˜+ó =ó ð=ð6Ð ð Ð ñB ØeØóôi
Ð%ó i
ó	ði
ñX ðð óôV
Ð+¨_ó V
óðV
òr E�rZ   