+
    œ°³jW‹  ã                   ó(  € ^ RI Ht ^ RIHt ^ RIt^ RIHt ^ RIHt ^RI	H
t
 ^RIHtHtHt ^RIHt ^RIHt ^R	IHtHt ^R
IHt ^RIHt ^RIHtHtHtHtHt ^RI H!t! ^RI"H#t#H$t$ ^RI%H&t& ^RI'H(t(H)t)H*t*H+t+ ^RI,H-t- ^RI.H/t/H0t0 ^RI1H2t2H3t3H4t4 ^RI5H6t6H7t7H8t8 ^RI9H:t:H;t; ]+Px                  ! ]=4      t>])! RR7      ] ! R R]4      4       4       t?])! RR7      ] ! R R]4      4       4       t@ ! R R]P‚                  4      tB ! R  R!]P‚                  4      tC ! R" R#]34      tD ! R$ R%]24      tE ! R& R']64      tF ! R( R)]4      tG]) ! R* R+]$4      4       tH ! R, R-]H4      tI ! R. R/]74      tJ ! R0 R1]:4      tK])! R2R7       ! R3 R4]H]4      4       tL. R5OtMR# )6é    )ÚCallable)Ú	dataclassN)Ústrict)ÚACT2FN)ÚCacheÚDynamicCacheÚEncoderDecoderCache)ÚPreTrainedConfig)ÚGenerationMixin)Úcreate_bidirectional_maskÚcreate_causal_mask)ÚFlashAttentionKwargs)ÚGradientCheckpointingLayer)ÚBaseModelOutputÚBaseModelOutputWithPastÚ)BaseModelOutputWithPastAndCrossAttentionsÚSeq2SeqLMOutputÚSeq2SeqModelOutput)ÚRopeParameters)ÚALL_ATTENTION_FUNCTIONSÚPreTrainedModel)ÚUnpack)ÚTransformersKwargsÚauto_docstringÚcan_return_tupleÚlogging)Úmerge_with_config_defaults)ÚOutputRecorderÚcapture_outputs)ÚGlmAttentionÚGlmRotaryEmbeddingÚapply_rotary_pos_emb)ÚLlamaDecoderLayerÚ
LlamaModelÚeager_attention_forward)ÚWhisperModelÚshift_tokens_rightzUsefulSensors/moonshine-tiny)Ú
checkpointc                   óÀ   a a€ ] tR t^2t oRtRtR.tRRRRRR	R
R/tRtRt	Rt
^t^t^t^tRtRtRtRtRtRtRt^tRtRtRtRtRt^t^tRtRtV 3R lt V3R lt!Rt"Vt#V ;t$# )ÚMoonshineConfiga	  
encoder_num_key_value_heads (`int`, *optional*):
    This is the number of key_value heads that should be used to implement Grouped Query Attention. If
    `encoder_num_key_value_heads=encoder_num_attention_heads`, the model will use Multi Head Attention (MHA), if
    `encoder_num_key_value_heads=1` the model will use Multi Query Attention (MQA) otherwise GQA is used. When
    converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
    by meanpooling all the original heads within that group. For more details, check out [this
    paper](https://huggingface.co/papers/2305.13245). If it is not specified, will default to
    `num_attention_heads`.
decoder_num_key_value_heads (`int`, *optional*):
    This is the number of key_value heads that should be used to implement Grouped Query Attention. If
    `decoder_num_key_value_heads=decoder_num_attention_heads`, the model will use Multi Head Attention (MHA), if
    `decoder_num_key_value_heads=1` the model will use Multi Query Attention (MQA) otherwise GQA is used. When
    converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
    by meanpooling all the original heads within that group. For more details, check out [this
    paper](https://huggingface.co/papers/2305.13245). If it is not specified, will default to
    `decoder_num_attention_heads`.
pad_head_dim_to_multiple_of (`int`, *optional*):
    Pad head dimension in encoder and decoder to the next multiple of this value. Necessary for using certain
    optimized attention implementations.
encoder_hidden_act (`str` or `function`, *optional*, defaults to `"gelu"`):
    The non-linear activation function (function or string) in the encoder.
decoder_hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
    The non-linear activation function (function or string) in the decoder.

Example:

```python
>>> from transformers import MoonshineModel, MoonshineConfig

>>> # Initializing a Moonshine style configuration
>>> configuration = MoonshineConfig().from_pretrained("UsefulSensors/moonshine-tiny")

>>> # Initializing a model from the configuration
>>> model = MoonshineModel(configuration)

>>> # Accessing the model configuration
>>> configuration = model.config
```Ú	moonshineÚpast_key_valuesÚnum_key_value_headsÚdecoder_num_key_value_headsÚnum_attention_headsÚdecoder_num_attention_headsÚnum_hidden_layersÚdecoder_num_hidden_layersÚ
hidden_actÚdecoder_hidden_acti €  i   i€  NÚgeluÚsilui   g{®Gáz”?TFç        c                óÈ   <€ V P                   f   V P                  V n         V P                  f   V P                  V n        VP	                  RR4       \
        SV `  ! R/ VB  R # )NÚpartial_rotary_factorgÍÌÌÌÌÌì?© )Úencoder_num_key_value_headsÚencoder_num_attention_headsr.   r0   Ú
setdefaultÚsuperÚ__post_init__)ÚselfÚkwargsÚ	__class__s   &,€Úp/home/luca/screen-checking/.venv/lib/python3.14/site-packages/transformers/models/moonshine/modular_moonshine.pyr?   ÚMoonshineConfig.__post_init__   sX   ø€ Ø×+Ñ+Ò3Ø/3×/OÑ/OˆDÔ,à×+Ñ+Ò3Ø/3×/OÑ/OˆDÔ,à×ÑÐ1°3Ô7Ü‰ÒÑ' Ô'ó    c                óÜ  <€ V ^8„  d   Qh/ S[ ;R&   S[ ;R&   S[ ;R&   S[ ;R&   S[ ;R&   S[ ;R&   S[ ;R&   S[ R,          ;R	&   S[ R,          ;R
&   S[ R,          ;R&   S[;R&   S[;R&   S[ ;R&   S[;R&   S[ ;R&   S[;R&   S[S[,          R,          ;R&   S[;R&   S[;R&   S[S[ ,          ;R&   S[ R,          ;R&   S[ S[S[ ,          ,          R,          ;R&   S[ R,          ;R&   S[;R&   # )é   Ú
vocab_sizeÚhidden_sizeÚintermediate_sizeÚencoder_num_hidden_layersr2   r<   r0   Nr;   r.   Úpad_head_dim_to_multiple_ofÚencoder_hidden_actr4   Úmax_position_embeddingsÚinitializer_rangeÚdecoder_start_token_idÚ	use_cacheÚrope_parametersÚis_encoder_decoderÚattention_biasÚattention_dropoutÚbos_token_idÚeos_token_idÚpad_token_idÚtie_word_embeddings)ÚintÚstrÚfloatÚboolr   ÚdictÚlist)ÚformatÚ__classdict__s   "€rC   Ú__annotate__ÚMoonshineConfig.__annotate__2   sœ  ø‡ ‚ ñh Ññi ñj Ññk ñl Ñ!ñm ñn  #Ñ&ño ñp  #Ñ&ñq ñr "%Ñ(ñs ñt "%Ñ(ñu ñv "% t¥Ñ2ñw ñx "% t¥Ñ2ñy ñz "% t¥Ñ2ñ{ ñ| Ñ$ñ} ñ~ Ñ$ñ ñ@ !Ñ&ñA ñB Ñ#ñC ñD  Ñ#ñE ñF ÑñG ñH $¡dÕ*¨TÕ1Ñ8ñI ñJ Ñ#ñK ñL Ñ ñM ñN ™s•{Ñ(ñO ñP ˜•*Ñ ñQ ñR ™™S�	•/ DÕ(Ñ,ñS ñT ˜•*Ñ#ñU ñV Ñ$òW rE   )r.   r;   )%Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú
model_typeÚkeys_to_ignore_at_inferenceÚattribute_maprH   rI   rJ   rK   r2   r<   r0   r;   r.   rL   rM   r4   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   r?   Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__Ú__classcell__©rB   ra   s   @@rC   r*   r*   2   sÑ   ù‡ € ñ&ðP €JØ#4Ð"5ÐàÐ<ØÐ<ØÐ8ØÐ*ð	€Mð €JØ€KØ!ÐØ%&ÐØ%&ÐØ'(ÐØ'(ÐØ.2ÐØ.2ÐØ.2ÐØ$ÐØ$ÐØ#&ÐØ#ÐØ"#ÐØ€IØ48€OØ#ÐØ €NØ%(ÐØ €LØ+,€LØ#€LØ $Ðõ(÷[ … rE   r*   z™
    Extends [~modeling_outputs.BaseModelOutput] to include the output attention mask since sequence length is not preserved in the model's forward.
    )Úcustom_introc                   ó4   a € ] tR t^Št o RtRtV 3R ltRtV tR# )ÚMoonshineEncoderModelOutputa~  
attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
    Mask to avoid performing attention on padding token indices after sequence compression. Returned because the
    sequence length may differ from the input sequence length. Mask values selected in `[0, 1]`:

    - 1 for tokens that are **not masked**,
    - 0 for tokens that are **masked**.
Nc                óH   <€ V ^8„  d   Qh/ S[ P                  R,          ;R&   # )rG   NÚattention_mask©ÚtorchÚTensor)r`   ra   s   "€rC   rb   Ú(MoonshineEncoderModelOutput.__annotate__Š   s   ø‡ ‚ ñ  —L‘L 4Õ'Ñ.ò! rE   r:   )	rd   re   rf   rg   rh   ru   rl   rm   rn   ©ra   s   @rC   rs   rs   Š   s   ø‡ € ñð +/€N÷! ƒ rE   rs   c                   óD   a a€ ] tR t^�t oV 3R ltV3R lR ltRtVtV ;t# )ÚMoonshineEncoderMLPc                ó  <€ \         SV `  4        Wn        \        V,          V n        \
        P                  ! VP                  VP                  4      V n	        \
        P                  ! VP                  VP                  4      V n
        R # ©N©r>   Ú__init__Úconfigr   Úactivation_fnÚnnÚLinearrI   rJ   Úfc1Úfc2©r@   r�   r3   rB   s   &&&€rC   r€   ÚMoonshineEncoderMLP.__init__ž   s\   ø€ Ü‰ÑÔØŒÜ# JÕ/ˆÔÜ—9’9˜V×/Ñ/°×1IÑ1IÓJˆŒÜ—9’9˜V×5Ñ5°v×7IÑ7IÓJˆŽrE   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# ©rG   Úhidden_statesÚreturnrv   )r`   ra   s   "€rC   rb   Ú MoonshineEncoderMLP.__annotate__¥   s#   ø€ ÷ ñ ¡U§\¡\ð ±e·l±lñ rE   c                ól   € V P                  V4      pV P                  V4      pV P                  V4      pV# r~   )r…   r‚   r†   )r@   r‹   s   &&rC   ÚforwardÚMoonshineEncoderMLP.forward¥   s4   € ØŸ™ Ó/ˆØ×*Ñ*¨=Ó9ˆØŸ™ Ó/ˆØÐrE   ©r‚   r�   r…   r†   ©	rd   re   rf   rg   r€   r�   rm   rn   ro   rp   s   @@rC   r|   r|   �   s   ù‡ € õK÷÷ ð rE   r|   c                   óD   a a€ ] tR t^¬t oV 3R ltV3R lR ltRtVtV ;t# )ÚMoonshineDecoderMLPc                ó"  <€ \         SV `  4        Wn        \        V,          V n        \
        P                  ! VP                  VP                  ^,          4      V n	        \
        P                  ! VP                  VP                  4      V n
        R# )rG   Nr   r‡   s   &&&€rC   r€   ÚMoonshineDecoderMLP.__init__­   sa   ø€ Ü‰ÑÔØŒÜ# JÕ/ˆÔÜ—9’9˜V×/Ñ/°×1IÑ1IÈAÕ1MÓNˆŒÜ—9’9˜V×5Ñ5°v×7IÑ7IÓJˆŽrE   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# rŠ   rv   )r`   ra   s   "€rC   rb   Ú MoonshineDecoderMLP.__annotate__´   s#   ø€ ÷ ñ ¡U§\¡\ð ±e·l±lñ rE   c                ó¤   € V P                  V4      pVP                  ^RR7      w  rV P                  V4      V,          pV P                  V4      pV# )rG   )Údiméÿÿÿÿ)r…   Úchunkr‚   r†   )r@   r‹   Úgates   && rC   r�   ÚMoonshineDecoderMLP.forward´   sQ   € ØŸ™ Ó/ˆØ+×1Ñ1°!¸Ð1Ó<ÑˆØ×*Ñ*¨4Ó0°=Õ@ˆØŸ™ Ó/ˆØÐrE   r‘   r’   rp   s   @@rC   r”   r”   ¬   s   ù‡ € õK÷÷ ð rE   r”   c                   ó   € ] tR t^¼tRtR# )ÚMoonshineRotaryEmbeddingr:   N)rd   re   rf   rg   rm   r:   rE   rC   r    r    ¼   s   † ÛrE   r    c                   óT   a a€ ] tR t^Àt oV3R lV 3R lltRV3R lR lltRtVtV ;t# )ÚMoonshineAttentionc          
      ó8   <€ V ^8„  d   QhRS[ RS[RS[RS[RS[/# )rG   r�   Ú	layer_idxÚ	is_causalr/   r-   )r*   rZ   r]   )r`   ra   s   "€rC   rb   ÚMoonshineAttention.__annotate__Á   s=   ø€ ÷ &ñ &áð&ñ ð&ñ ð	&ñ
 !ð&ñ !ñ&rE   c                ó   <€ VP                  R VRV/4       \        SV `	  W4       W0n        \	        VRVP
                  VP                  ,          4      V n        V P                  P                  eW   V P                  P                  pW`P                  V,           ^,
          V,          ,          pWpP                  ,
          V n
        R# ^ V n
        R# )r/   r-   Úhead_dimN)Úupdater>   r€   r¥   ÚgetattrrI   r/   r¨   r�   rL   Úhead_dim_padding)	r@   r�   r¤   r¥   r/   r-   Útarget_multipleÚtarget_head_dimrB   s	   &&&&&&  €rC   r€   ÚMoonshineAttention.__init__Á   s¦   ø€ ð 	�‰Ð,Ð.AÐCXÐZmÐnÔoÜ‰Ñ˜Ô+Ø"ŒÜ ¨
°F×4FÑ4FÈ&×JdÑJdÕ4dÓeˆŒð �;‰;×2Ñ2Ò>Ø"Ÿk™k×EÑEˆOØ-·-±-À/Õ2QÐTUÕ2UÐZiÕ1iÕjˆOØ$3·m±mÕ$CˆDÖ!à$%ˆDÖ!rE   c                óˆ  <€ V ^8„  d   QhRS[ P                  RS[S[ P                  S[ P                  3,          R,          RS[ P                  R,          RS[R,          RS[ P                  R,          RS[S[,          RS[S[ P                  S[ P                  R,          S[S[ P                  ,          R,          3,          /# )	rG   r‹   Úposition_embeddingsNru   r,   Úkey_value_statesrA   rŒ   )rw   rx   Útupler   r   r   )r`   ra   s   "€rC   rb   r¦   Ö   s¸   ø€ ÷ O)ñ O)á—|‘|ðO)ñ #¡5§<¡<±·±Ð#=Õ>ÀÕEðO)ñ Ÿ™ tÕ+ð	O)ñ
  �ðO)ñ  Ÿ,™,¨Õ-ðO)ñ Ñ-Õ.ðO)ñ 
‰u�|‰|™UŸ\™\¨DÕ0±%¹¿¹Õ2EÈÕ2LÐLÕ	MñO)rE   c           	     óÊ  € VP                   R R w  rxV P                  V4      P                  WxV P                  P                  V P
                  4      P                  ^^4      p	VR Jp
Ve`   VP                  P                  V P                  4      pV
'       d'   RVP                  V P                  &   VP                  pMVP                  pVe   TMTpV
'       d`   V'       dX   X'       dP   VP                  V P                  ,          P                  pVP                  V P                  ,          P                  pMÌV P                  V4      P                  VRV P                  P                  V P
                  4      P                  ^^4      pV P!                  V4      P                  VRV P                  P                  V P
                  4      P                  ^^4      pV
'       d#   Ve   VP#                  WÞV P                  4      w  rÞV
'       g7   Vw  pp\%        W�VV4      w  r�Ve   VP#                  WÞV P                  4      w  rÞ\&        P(                  ! V P                  P*                  \,        4      pV P.                  ;'       d    VR J ;'       d    V^8„  pV P0                  ^ 8”  d£   \2        P4                  P6                  P9                  V	^ V P0                  34      p	\2        P4                  P6                  P9                  V^ V P0                  34      p\2        P4                  P6                  P9                  V^ V P0                  34      pT! V V	VVV3RV P:                  '       g   RMV P<                  RV P>                  RV/VB w  ppV P0                  ^ 8”  d   VRR V P0                  ) 13,          pVPA                  WxR4      PC                  4       pV PE                  V4      pVV3# )NTÚdropoutr7   Úscalingr¥   .r›   )#ÚshapeÚq_projÚviewr�   r-   r¨   Ú	transposeÚ
is_updatedÚgetr¤   Úcross_attention_cacheÚself_attention_cacheÚlayersÚkeysÚvaluesÚk_projÚv_projr©   r"   r   Úget_interfaceÚ_attn_implementationr%   r¥   r«   rw   rƒ   Ú
functionalÚpadÚtrainingrU   rµ   ÚreshapeÚ
contiguousÚo_proj)r@   r‹   r°   ru   r,   r±   rA   ÚbszÚq_lenÚquery_statesÚis_cross_attentionrº   Úcurrent_statesÚ
key_statesÚvalue_statesÚcosÚsinÚattention_interfacer¥   Úattn_outputÚattn_weightss   &&&&&&,              rC   r�   ÚMoonshineAttention.forwardÖ   sa  € ð #×(Ñ(¨¨"Ð-‰
ˆð �K‰K˜Ó&×+Ñ+¨C¸¿¹×8WÑ8WÐY]×YfÑYfÓg×qÑqÐrsÐuvÓwð 	ð .°TÐ9ÐØÒ&Ø(×3Ñ3×7Ñ7¸¿¹ÓGˆJß!à=A�×*Ñ*¨4¯>©>Ñ:Ø"1×"GÑ"G‘à"1×"FÑ"F�ð .>Ò-IÑ)È}ˆß§/·jØ(×/Ñ/°·±Õ?×DÑDˆJØ*×1Ñ1°$·.±.ÕA×HÑH‰Lð —‘˜NÓ+ß‘�c˜2˜tŸ{™{×>Ñ>ÀÇÁÓNß‘˜1˜a“ð ð —‘˜NÓ+ß‘�c˜2˜tŸ{™{×>Ñ>ÀÇÁÓNß‘˜1˜a“ð ÷
 " oÒ&AØ+:×+AÑ+AÀ*Ð\`×\jÑ\jÓ+kÑ(�
ç!Ø*‰HˆC�Ü';¸LÐVYÐ[^Ó'_Ñ$ˆLàÒ*Ø+:×+AÑ+AÀ*Ð\`×\jÑ\jÓ+kÑ(�
ä(?×(MÒ(MØ�K‰K×,Ñ,Ô.Eó)
Ðð —N‘N×KÐK ~¸Ð'=×KÐKÀ%È!Á)ˆ	à× Ñ  1Ô$Ü Ÿ8™8×.Ñ.×2Ñ2°<À!ÀT×EZÑEZÐA[Ó\ˆLÜŸ™×,Ñ,×0Ñ0°¸aÀ×AVÑAVÐ=WÓXˆJÜ Ÿ8™8×.Ñ.×2Ñ2°<À!ÀT×EZÑEZÐA[Ó\ˆLá$7ØØØØØñ
%
ð  $Ÿ}Ÿ}˜}‘C°$×2HÑ2Hð
%
ð —L‘Lð
%
ð  ð
%
ð ñ
%
Ñ!ˆ�\ð × Ñ  1Ô$Ø% cÐ+C¨d×.CÑ.CÐ-CÐ+CÐ&CÕDˆKà!×)Ñ)¨#°bÓ9×DÑDÓFˆØ—k‘k +Ó.ˆØ˜LÐ(Ð(rE   )r¨   r«   r¥   )NNNNr’   rp   s   @@rC   r¢   r¢   À   s!   ù‡ € ÷&ó &÷*O)÷ O)ò O)rE   r¢   c                   ó>   a a€ ] tR tRt oV3R lV 3R lltRtVtV ;t# )ÚMoonshineEncoderLayeri(  c                ó&   <€ V ^8„  d   QhRS[ RS[/# )rG   r�   r¤   ©r*   rZ   )r`   ra   s   "€rC   rb   Ú"MoonshineEncoderLayer.__annotate__)  s   ø€ ÷ Uñ U™ð U¹3ñ UrE   c                óH  <€ \         SV `  W4       \        VVR VP                  VP                  R7      V n        \        WP                  4      V n        \        P                  ! VP                  R R7      V n        \        P                  ! VP                  R R7      V n        R# )F©r�   r¤   r¥   r/   r-   ©ÚbiasN)r>   r€   r¢   r<   r;   Ú	self_attnr|   rM   Úmlprƒ   Ú	LayerNormrI   Úinput_layernormÚpost_attention_layernorm©r@   r�   r¤   rB   s   &&&€rC   r€   ÚMoonshineEncoderLayer.__init__)  s}   ø€ Ü‰Ñ˜Ô+ä+ØØØØ &× BÑ BØ &× BÑ Bô
ˆŒô ' v×/HÑ/HÓIˆŒÜ!Ÿ|š|¨F×,>Ñ,>ÀUÔKˆÔÜ(*¯ª°V×5GÑ5GÈeÔ(TˆÖ%rE   )rä   râ   rå   rá   )rd   re   rf   rg   r€   rm   rn   ro   rp   s   @@rC   rÙ   rÙ   (  s   ù‡ € ÷U÷ Uó UrE   rÙ   c                   óX   a a€ ] tR tRt oRV3R lV 3R llltRV3R lR lltRtVtV ;t# )	ÚMoonshineDecoderLayeri9  c                ó4   <€ V ^8„  d   QhRS[ RS[R,          /# )rG   r�   r¤   NrÛ   )r`   ra   s   "€rC   rb   Ú"MoonshineDecoderLayer.__annotate__:  s#   ø€ ÷ Lñ L™ð L¹3À½:ñ LrE   c                ó  <€ \         SV `  4        VP                  V n        \        VVR VP                  VP
                  R7      V n        \        VVRVP                  VP
                  R7      V n        \        WP                  4      V n
        \        P                  ! VP                  RR7      V n        \        P                  ! VP                  RR7      V n        \        P                  ! VP                  RR7      V n        R# )TrÞ   Frß   N)r>   r€   rI   r¢   r/   r-   rá   Úencoder_attnr”   r3   râ   rƒ   rã   rä   rå   Úfinal_layernormræ   s   &&&€rC   r€   ÚMoonshineDecoderLayer.__init__:  sÌ   ø€ Ü‰ÑÔØ!×-Ñ-ˆÔä+ØØØØ &× :Ñ :Ø &× :Ñ :ô
ˆŒô /ØØØØ &× :Ñ :Ø &× :Ñ :ô
ˆÔô ' v×/@Ñ/@ÓAˆŒÜ!Ÿ|š|¨F×,>Ñ,>ÀUÔKˆÔÜ(*¯ª°V×5GÑ5GÈeÔ(TˆÔ%Ü!Ÿ|š|¨F×,>Ñ,>ÀUÔKˆÖrE   c                óZ  <€ V ^8„  d   QhRS[ P                  RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[R,          R	S[R,          R
S[S[ P                  S[ P                  3,          R,          RS[S[ P                  S[ P                  3,          R,          RS[S[,          RS[S[ P                  S[S[ P                  S[ P                  3,          R,          3,          /# )rG   r‹   ru   NÚencoder_hidden_statesÚencoder_attention_maskÚposition_idsÚencoder_position_idsr,   rQ   r°   Úencoder_position_embeddingsrA   rŒ   )	rw   rx   Ú
LongTensorr   r]   r²   r   r   ÚFloatTensor)r`   ra   s   "€rC   rb   rë   R  s   ø€ ÷ ,ñ ,á—|‘|ð,ñ Ÿ™ tÕ+ð,ñ  %Ÿ|™|¨dÕ2ð	,ñ
 !&§¡¨tÕ 3ð,ñ ×&Ñ&¨Õ-ð,ñ $×.Ñ.°Õ5ð,ñ  �ð,ñ ˜$•;ð,ñ #¡5§<¡<±·±Ð#=Õ>ÀÕEð,ñ &+©5¯<©<¹¿¹Ð+EÕ%FÈÕ%Mð,ñ Ñ+Õ,ð,ñ 
‰u× Ñ ¡%©×(9Ñ(9¹5×;LÑ;LÐ(LÕ"MÐPTÕ"TÐTÕ	Uñ,rE   c                óB  € TpV P                  V4      pV P                  ! RR VRVRVRVRVRV	/VB w  rWÁ,           pVe4   TpV P                  V4      pV P                  VVVVVR7      w  rWÁ,           pTpV P	                  V4      pV P                  V4      pWÁ,           pV# )r‹   ru   ró   r,   rQ   r°   )r‹   r±   ru   r,   rQ   r:   )rä   rá   rå   rí   rî   râ   )r@   r‹   ru   rñ   rò   ró   rô   r,   rQ   r°   rõ   rA   ÚresidualÚ_s   &&&&&&&&&&&,  rC   r�   ÚMoonshineDecoderLayer.forwardR  só   € ð !ˆØ×,Ñ,¨]Ó;ˆàŸ>š>ñ 
Ø'ð
à)ð
ð &ð
ð ,ð	
ð
  ð
ð !4ð
ð ñ
Ñˆð !Õ0ˆà Ò,Ø$ˆHØ ×9Ñ9¸-ÓHˆMØ#×0Ñ0Ø+Ø!6Ø5Ø /Ø#ð  1ó  ÑˆMð %Õ4ˆMà ˆØ×,Ñ,¨]Ó;ˆØŸ™ Ó/ˆØ Õ0ˆØÐrE   )rí   rî   rI   rä   râ   rå   rá   r~   )	NNNNNNFNNr’   rp   s   @@rC   ré   ré   9  s    ù‡ € ÷Lõ L÷0,÷ ,ò ,rE   ré   c                   ób   a € ] tR tRt o RtRtRtRtRR.tRt	Rt
RtV 3R lR	 ltV 3R
 ltRtV tR# )ÚMoonshinePreTrainedModeli�  ÚmodelÚinput_valuesÚaudioTrÙ   ré   c                ó4   <€ V ^8„  d   QhRS[ P                  /# )rG   Úinput_lengths)rw   rö   )r`   ra   s   "€rC   rb   Ú%MoonshinePreTrainedModel.__annotate__�  s   ø€ ÷ #ñ #¹e×>NÑ>Nñ #rE   c                óÆ   € \        V^,
          ^@,          ^,           4      p\        V^,
          ^,          ^,           4      p\        V^,
          ^,          ^,           4      pV# )z8
Computes the output length of the convolutional layers
)rZ   )r@   r  Úoutput_conv1_lengthÚoutput_conv2_lengthÚoutput_conv3_lengths   &&   rC   Ú _get_feat_extract_output_lengthsÚ9MoonshinePreTrainedModel._get_feat_extract_output_lengths�  sZ   € ô " =°3Õ#6¸"Õ"<¸qÕ"@ÓAÐÜ!Ð#6¸Õ#:¸aÕ"?À!Õ"CÓDÐÜ!Ð#6¸Õ#:¸aÕ"?À!Õ"CÓDÐà"Ð"rE   c                ó&   <€ V ^8„  d   Qh/ S[ ;R&   # ©rG   r�   ©r*   )r`   ra   s   "€rC   rb   r  �  s   ø‡ ‚ áÑò rE   r:   N)rd   re   rf   rg   Úbase_model_prefixÚmain_input_nameÚinput_modalitiesÚsupports_gradient_checkpointingÚ_no_split_modulesÚ_supports_flash_attnÚ_supports_sdpaÚ_can_compile_fullgraphr  rl   rm   rn   rz   s   @rC   rý   rý   �  sL   ø‡ € ð  ÐØ$€OØÐØ&*Ð#Ø0Ð2IÐJÐØÐØ€Nà!Ð÷#ð #÷ ƒ rE   rý   c                   ó    a a€ ] tR tRt oRtRtR]R]/tV3R lV 3R llt	V3R lR	 lt
V3R
 lR lt]]RV3R lR ll4       4       tRtVtV ;t# )ÚMoonshineEncoderiš  z“
Transformer encoder consisting of *config.num_hidden_layers* layers. Each layer is a [`MoonshineEncoderLayer`]

Args:
    config: MoonshineConfig
rÿ   Ú
attentionsr‹   c                ó    <€ V ^8„  d   QhRS[ /# r  r  )r`   ra   s   "€rC   rb   ÚMoonshineEncoder.__annotate__¨  s   ø€ ÷ ñ ™ñ rE   c           	     ó€  <€ \         SV `  V4       Wn        VP                  p\        P
                  ! ^V^^@RR7      V n        \        P
                  ! V^V,          ^^R7      V n        \        P
                  ! ^V,          V^^R7      V n        \        P                  ! ^VRR7      V n
        \        P                  ! \        VP                  4       Uu. uF  p\        W4      NK  	  up4      V n        \        P                   ! VRR7      V n        \%        VR7      V n        RV n        V P+                  4        R# u upi )	é   F)Úkernel_sizeÚstriderà   )r  r  gñhãˆµøä>)Ú
num_groupsÚnum_channelsÚepsrß   ©r�   N)r>   r€   r�   rI   rƒ   ÚConv1dÚconv1Úconv2Úconv3Ú	GroupNormÚ	groupnormÚ
ModuleListÚrangerK   rÙ   r¾   rã   Ú
layer_normr    Ú
rotary_embÚgradient_checkpointingÚ	post_init)r@   r�   Ú	embed_dimÚidxrB   s   &&  €rC   r€   ÚMoonshineEncoder.__init__¨  sî   ø€ Ü‰Ñ˜Ô ØŒØ×&Ñ&ˆ	ä—Y’Y˜q )¸ÀRÈeÔTˆŒ
Ü—Y’Y˜y¨!¨i­-ÀQÈqÔQˆŒ
Ü—Y’Y˜q 9�}¨iÀQÈqÔQˆŒ
ÜŸš°ÀÐPTÔUˆŒä—m’mÜ;@À×AaÑAaÔ;bÓcÑ;b°CÔ" 6Ö/Ñ;bÑcó
ˆŒô Ÿ,š, y°uÔ=ˆŒÜ2¸&ÔAˆŒØ&+ˆÔ#Ø�‰Öùò ds   ÃD;c                ó4   <€ V ^8„  d   QhRS[ P                  /# ©rG   rŒ   ©rƒ   ÚModule)r`   ra   s   "€rC   rb   r  º  s   ø€ ÷ ñ ¡b§i¡iñ rE   c                ó   € V P                   # r~   ©r#  ©r@   s   &rC   Úget_input_embeddingsÚ%MoonshineEncoder.get_input_embeddingsº  s   € Ø�z‰zÐrE   c                ó4   <€ V ^8„  d   QhRS[ P                  /# )rG   Úvaluer3  )r`   ra   s   "€rC   rb   r  ½  s   ø€ ÷ ñ ©"¯)©)ñ rE   c                ó   € Wn         R # r~   r6  )r@   r;  s   &&rC   Úset_input_embeddingsÚ%MoonshineEncoder.set_input_embeddings½  s   € ØŽ
rE   c          	      óˆ   <€ V ^8„  d   QhRS[ P                  RS[ P                  R,          RS[S[,          RS[S[,          /# )rG   rÿ   ru   NrA   rŒ   )rw   r÷   rx   r   r   r²   r   )r`   ra   s   "€rC   rb   r  Â  sN   ø€ ÷ <
ñ <
á×'Ñ'ð<
ñ Ÿ™ tÕ+ð<
ñ Ñ+Õ,ð	<
ñ
 
Ñ(Õ	(ñ<
rE   c           
     ó˜  € VP                  ^4      p\        P                  P                  V P	                  V4      4      pV P                  V4      p\        P                  P                  V P                  V4      4      p\        P                  P                  V P                  V4      4      pVP                  ^ ^^4      pRpVe@   V P                  VP                  R
,          4      pRpVRRRV13,          RRV13,          pTp\        V P                  VVVR7      p\        P                  ! ^ VP                  ^,          VP                   R7      P                  ^ 4      pV P#                  WHR7      p	V P$                   F  p
V
! V3RVRVRV	/VB pK  	  V P'                  V4      p\)        TVe   VP+                  4       R	7      # RR	7      # )a¾  
Args:
    input_values (`torch.FloatTensor` of shape `(batch_size, audio_length)`):
        Float values of the raw speech waveform. Raw speech waveform can be
        obtained by loading a `.flac` or `.wav` audio file into an array of type `list[float]`, a
        `numpy.ndarray` or a `torch.Tensor`, *e.g.* via the torchcodec library (`pip install torchcodec`) or
        the soundfile library (`pip install soundfile`). To prepare the array into
        `input_values`, the [`AutoFeatureExtractor`] should be used for padding
        and conversion into a tensor of type `torch.FloatTensor`.
    attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
        Mask to avoid performing attention on padding indices in `input_values`. Mask values selected in `[0, 1]`:
        - 1 for tokens that are **not masked**,
        - 0 for tokens that are **masked**.
        [What are attention masks?](../glossary#attention-mask)
N.©r�   Úinputs_embedsru   rñ   ©Údevice©ró   ru   ró   r°   )Úlast_hidden_stateru   r›   i€  )Ú	unsqueezerƒ   rÅ   Útanhr#  r'  r5   r$  r%  Úpermuter  r¶   r   r�   rw   ÚarangerD  r+  r¾   r*  rs   rZ   )r@   rÿ   ru   rA   r‹   Úoutput_attention_maskÚmask_lenÚdownsample_strideró   r°   Úencoder_layers   &&&,       rC   r�   ÚMoonshineEncoder.forwardÀ  sÂ  € ð. $×-Ñ-¨aÓ0ˆÜŸ™×*Ñ*¨4¯:©:°lÓ+CÓDˆØŸ™ }Ó5ˆÜŸ™×*Ñ*¨4¯:©:°mÓ+DÓEˆÜŸ™×*Ñ*¨4¯:©:°mÓ+DÓEˆØ%×-Ñ-¨a°°AÓ6ˆð !%ÐØÒ%Ø×<Ñ<¸^×=QÑ=QÐRTÕ=UÓVˆHØ *ÐØ+¨CÑ1DÐ3DÐ1DÐ,DÕEÀcÈ9ÈHÈ9ÀnÕUˆNØ$2Ð!ä2Ø—;‘;Ø'Ø)Ø"/ô	
ˆô —|’| A }×':Ñ':¸1Õ'=Àm×FZÑFZÔ[×eÑeÐfgÓhˆØ"Ÿo™o¨m˜oÓWÐà!Ÿ[œ[ˆMÙ)Øñà-ðð *ðð %8ð	ð
 ñŠMñ )ð Ÿ™¨Ó6ˆä*Ø+Ø:OÒ:[Ð0×4Ñ4Ó6ô
ð 	
àaeô
ð 	
rE   )	r�   r#  r$  r%  r,  r'  r*  r¾   r+  r~   )rd   re   rf   rg   rh   r  r¢   rÙ   Ú_can_record_outputsr€   r8  r=  r   r   r�   rm   rn   ro   rp   s   @@rC   r  r  š  si   ù‡ € ñð %€OàÐ(ØÐ.ðÐ÷
ó ÷$ð ÷ð ð  Ø÷<
ñ <
ó ó  ÷<
ð <
rE   r  c                   ó    a a€ ] tR tRt oRtR]! ]^RR7      R]R]! ]^RR7      /tV3R	 lV 3R
 llt	]
]RV3R lR ll4       4       tRtVtV ;t# )ÚMoonshineDecoderi  Ú	input_idsr  rá   )ÚindexÚ
layer_namer‹   Úcross_attentionsrí   c                ó    <€ V ^8„  d   QhRS[ /# r  r  )r`   ra   s   "€rC   rb   ÚMoonshineDecoder.__annotate__	  s   ø€ ÷ uñ u™ñ urE   c           	     ó  <€ \         SV `  V4       \        P                  ! VP                  R R7      V n        \        P                  ! \        VP                  4       Uu. uF  p\        W4      NK  	  up4      V n
        R# u upi ©Frß   N)r>   r€   rƒ   rã   rI   Únormr(  r)  r1   ré   r¾   )r@   r�   r/  rB   s   && €rC   r€   ÚMoonshineDecoder.__init__	  s_   ø€ Ü‰Ñ˜Ô Ü—L’L ×!3Ñ!3¸%Ô@ˆŒ	Ü—m’mÔSXÐY_×YqÑYqÔSrÓ$sÑSrÈCÔ%:¸6Ö%GÑSrÑ$sÓtˆŽùÒ$ss   ÁBc                ó^  <€ V ^8„  d   QhRS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[R,          RS[ P                  R,          RS[R,          RS[ P                  R,          R	S[ P                  R,          R
S[S[,          RS[S[	,          /
# )rG   rS  Nru   ró   r,   rB  rQ   rñ   rò   rA   rŒ   )
rw   rö   rx   r   r÷   r]   r   r   r²   r   )r`   ra   s   "€rC   rb   rX    sÍ   ø€ ÷ G
ñ G
á×#Ñ# dÕ*ðG
ñ Ÿ™ tÕ+ðG
ñ ×&Ñ&¨Õ-ð	G
ñ
  �ðG
ñ ×(Ñ(¨4Õ/ðG
ñ ˜$•;ðG
ñ  %×0Ñ0°4Õ7ðG
ñ !&§¡¨tÕ 3ðG
ñ Ñ+Õ,ðG
ñ 
Ñ(Õ	(ñG
rE   c	                óê  € VRJ VRJ,          '       d   \        R4      hVf   V P                  V4      pV'       d9   Vf5   \        \        V P                  R7      \        V P                  R7      4      pVfb   Ve   VP                  4       M^ p
\        P                  ! VP                  ^,          VP                  R7      V
,           pVP                  ^ 4      p\        V P                  VVVVR7      p\        V P                  VVVR7      pTpV P                  WÃR7      pV P                   F  pV! VVV3RVR	VR
VRVRV/V	B pK  	  V P                  V4      p\!        TV'       d   VR7      # RR7      # )a\  
encoder_hidden_states (`torch.FloatTensor` of shape `(batch_size, encoder_sequence_length, hidden_size)`, *optional*):
    Sequence of hidden-states at the output of the last layer of the encoder. Used in the cross-attention
    of the decoder.
encoder_attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
    Mask to avoid performing attention on padding indices in `encoder_hidden_states`. Mask values selected in `[0, 1]`:
    - 1 for tokens that are **not masked**,
    - 0 for tokens that are **masked**.
    [What are attention masks?](../glossary#attention-mask)
Nz:You must specify exactly one of input_ids or inputs_embedsr!  rC  )r�   rB  ru   r,   ró   rA  rE  rò   ró   r,   rQ   r°   )rF  r,   )Ú
ValueErrorÚembed_tokensr	   r   r�   Úget_seq_lengthrw   rJ  r¶   rD  rG  r   r   r+  r¾   r[  r   )r@   rS  ru   ró   r,   rB  rQ   rñ   rò   rA   Úpast_seen_tokensÚcausal_maskr‹   r°   Údecoder_layers   &&&&&&&&&,     rC   r�   ÚMoonshineDecoder.forward  sš  € ð0 ˜Ð -°tÐ";×<Ô<ÜÐYÓZÐZàÒ Ø ×-Ñ-¨iÓ8ˆMç˜Ò0Ü1´,ÀdÇkÁkÔ2RÔT`Ðhl×hsÑhsÔTtÓuˆOàÒØCRÒC^˜×=Ñ=Ô?ÐdeÐÜ Ÿ<š<¨×(;Ñ(;¸AÕ(>À}×G[ÑG[Ô\Ð_oÕoˆLØ'×1Ñ1°!Ó4ˆLä(Ø—;‘;Ø'Ø)Ø+Ø%ô
ˆô ";Ø—;‘;Ø'Ø1Ø"7ô	"
Ðð &ˆØ"Ÿo™o¨m˜oÓWÐà!Ÿ[œ[ˆMÙ)ØØØ%ñ
ð (>ð	
ð
 *ð
ð !0ð
ð $ð
ð %8ð
ð ñ
ŠMñ )ð Ÿ	™	 -Ó0ˆä8Ø+ß/8˜Oô
ð 	
à>Bô
ð 	
rE   )r¾   r[  )NNNNNNNN)rd   re   rf   rg   r  r   r¢   ré   rP  r€   r   r   r�   rm   rn   ro   rp   s   @@rC   rR  rR    sm   ù‡ € Ø!€Oà‘nÐ%7¸qÈ[ÔYØÐ.Ø™NÐ+=ÀQÐSaÔbðÐ÷uó uð
  Ø÷G
ñ G
ó ó  ÷G
ð G
rE   rR  c                   óP   a € ] tR tRt o R t]]RV 3R lR ll4       4       tRtV t	R# )ÚMoonshineModeliZ  c                ó   € \        R 4      h)zNot needed for Moonshine)ÚAttributeErrorr7  s   &rC   Ú_mask_input_featuresÚ#MoonshineModel._mask_input_features[  s   € ÜÐ7Ó8Ð8rE   Nc                ó¶  <€ V ^8„  d   QhRS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[S[S[ P                  ,          ,          R,          RS[R,          RS[S[ P                  ,          R,          R	S[S[ P                  ,          R,          R
S[R,          RS[S[,          RS[/# )rG   rÿ   Nru   Údecoder_input_idsÚdecoder_attention_maskÚencoder_outputsr,   Údecoder_inputs_embedsÚdecoder_position_idsrQ   rA   rŒ   )	rw   r÷   rö   r²   r	   r]   r   r   r   )r`   ra   s   "€rC   rb   ÚMoonshineModel.__annotate__`  sö   ø€ ÷ C
ñ C
á×'Ñ'¨$Õ.ðC
ñ ×(Ñ(¨4Õ/ðC
ñ !×+Ñ+¨dÕ2ð	C
ñ
 !&× 0Ñ 0°4Õ 7ðC
ñ ™u¡U×%6Ñ%6Õ7Õ8¸4Õ?ðC
ñ -¨tÕ3ðC
ñ  %¡U×%6Ñ%6Õ7¸$Õ>ðC
ñ $¡E×$4Ñ$4Õ5¸Õ<ðC
ñ ˜$•;ðC
ñ Ñ+Õ,ðC
ñ 
ñC
rE   c
                óf  € Vf   V P                   ! V3RV/V
B pV P                  ! R
RVRVRVP                  RVP                  RVRVRVRV	/V
B p\	        VP                  VP
                  VP                  VP                  VP                  VP                  VP                  VP                  R	7      # )a:  
input_values (`torch.FloatTensor` of shape `(batch_size, audio_length)`):
    Float values of the raw speech waveform. Raw speech waveform can be
    obtained by loading a `.flac` or `.wav` audio file into an array of type `list[float]`, a
    `numpy.ndarray` or a `torch.Tensor`, *e.g.* via the torchcodec library (`pip install torchcodec`) or
    the soundfile library (`pip install soundfile`). To prepare the array into
    `input_values`, the [`AutoFeatureExtractor`] should be used for padding
    and conversion into a tensor of type `torch.FloatTensor`.
decoder_position_ids (`torch.LongTensor` of shape `(batch_size, target_sequence_length)`):
    Indices of positions of each input sequence tokens in the position embeddings.
    Used to calculate the position embeddings up to `config.decoder_config.max_position_embeddings`

Example:

```python
>>> import torch
>>> from transformers import AutoFeatureExtractor, MoonshineModel
>>> from datasets import load_dataset

>>> model = MoonshineModel.from_pretrained("UsefulSensors/moonshine-tiny")
>>> feature_extractor = AutoFeatureExtractor.from_pretrained("UsefulSensors/moonshine-tiny")
>>> ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
>>> inputs = feature_extractor(ds[0]["audio"]["array"], return_tensors="pt")
>>> input_values = inputs.input_values
>>> decoder_input_ids = torch.tensor([[1, 1]]) * model.config.decoder_start_token_id
>>> last_hidden_state = model(input_values, decoder_input_ids=decoder_input_ids).last_hidden_state
>>> list(last_hidden_state.shape)
[1, 2, 288]
```
ru   rS  rñ   rò   r,   rB  ró   rQ   )rF  r,   Údecoder_hidden_statesÚdecoder_attentionsrV  Úencoder_last_hidden_staterñ   Úencoder_attentionsr:   )	ÚencoderÚdecoderrF  ru   r   r,   r‹   r  rV  )r@   rÿ   ru   rm  rn  ro  r,   rp  rq  rQ   rA   Údecoder_outputss   &&&&&&&&&&, rC   r�   ÚMoonshineModel.forward^  sö   € ðZ Ò"Ø/3¯|ª|¸LÑ/rÐYgÐ/rÐkqÑ/rˆOàEIÇ\Â\ñ 
F
Ø'ð
F
à1ð
F
ð #2×"CÑ"Cð
F
ð $3×#AÑ#Að	
F
ð
 ,ð
F
ð 0ð
F
ð .ð
F
ð  ð
F
ð ñ
F
ˆô "Ø-×?Ñ?Ø+×;Ñ;Ø"1×"?Ñ"?Ø.×9Ñ9Ø,×=Ñ=Ø&5×&GÑ&GØ"1×"?Ñ"?Ø.×9Ñ9ô	
ð 		
rE   r:   )	NNNNNNNNN)
rd   re   rf   rg   rj  r   r   r�   rm   rn   rz   s   @rC   rg  rg  Z  s.   ø‡ € ò9ð Ø÷C
ñ C
ó ó öC
rE   rg  zj
    The Moonshine Model with a language modeling head. Can be used for automatic speech recognition.
    c                   óŽ   a a€ ] tR tRt oRR/tV3R lV 3R lltR tR tV3R lR	 lt]	]
RV3R
 lR ll4       4       tRtVtV ;t# )Ú!MoonshineForConditionalGenerationi¦  zproj_out.weightz!model.decoder.embed_tokens.weightc                ó    <€ V ^8„  d   QhRS[ /# r  r  )r`   ra   s   "€rC   rb   Ú.MoonshineForConditionalGeneration.__annotate__®  s   ø€ ÷ ñ ™ñ rE   c                óÊ   <€ \         SV `  V4       \        V4      V n        \        P
                  ! VP                  VP                  R R7      V n        V P                  4        R# rZ  )
r>   r€   rg  rþ   rƒ   r„   rI   rH   Úproj_outr-  )r@   r�   rB   s   &&€rC   r€   Ú*MoonshineForConditionalGeneration.__init__®  sH   ø€ Ü‰Ñ˜Ô Ü# FÓ+ˆŒ
ÜŸ	š	 &×"4Ñ"4°f×6GÑ6GÈeÔTˆŒð 	�‰ÖrE   c                ó   € V P                   # r~   ©r�  r7  s   &rC   Úget_output_embeddingsÚ7MoonshineForConditionalGeneration.get_output_embeddings¶  s   € Ø�}‰}ÐrE   c                ó   € Wn         R # r~   r„  )r@   Únew_embeddingss   &&rC   Úset_output_embeddingsÚ7MoonshineForConditionalGeneration.set_output_embeddings¹  s   € Ø&ŽrE   c                ó4   <€ V ^8„  d   QhRS[ P                  /# r2  r3  )r`   ra   s   "€rC   rb   r  ¼  s   ø€ ÷ 1ñ 1¡b§i¡iñ 1rE   c                ó6   € V P                   P                  4       # r~   )rþ   r8  r7  s   &rC   r8  Ú6MoonshineForConditionalGeneration.get_input_embeddings¼  s   € Ø�z‰z×.Ñ.Ó0Ð0rE   c                óÞ  <€ V ^8„  d   QhRS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[S[S[ P                  ,          ,          R,          RS[R,          RS[S[ P                  ,          R,          R	S[S[ P                  ,          R,          R
S[R,          RS[ P                  R,          RS[S[,          RS[/# )rG   rÿ   Nru   rm  rn  ro  r,   rp  rq  rQ   ÚlabelsrA   rŒ   )	rw   r÷   rö   r²   r	   r]   r   r   r   )r`   ra   s   "€rC   rb   r  Á  s  ø€ ÷ `
ñ `
á×'Ñ'¨$Õ.ð`
ñ ×(Ñ(¨4Õ/ð`
ñ !×+Ñ+¨dÕ2ð	`
ñ
 !&× 0Ñ 0°4Õ 7ð`
ñ ™u¡U×%6Ñ%6Õ7Õ8¸4Õ?ð`
ñ -¨tÕ3ð`
ñ  %¡U×%6Ñ%6Õ7¸$Õ>ð`
ñ $¡E×$4Ñ$4Õ5¸Õ<ð`
ñ ˜$•;ð`
ñ × Ñ  4Õ'ð`
ñ Ñ+Õ,ð`
ñ 
ñ`
rE   c                óJ  € VP                  RR4      pV
e=   Vf9   Vf5   \        W P                  P                  V P                  P                  4      pV P
                  ! V3RVRVRVRVRVRVR	VR
V	/VB pV P                  VP                  4      pRpV
e5   V P                  ! RRTRRRV P                  P                  RVe   TMT
/VB p\        VVVP                  VP                  VP                  VP                  VP                  VP                   VP"                  R7	      # )ah  
input_values (`torch.FloatTensor` of shape `(batch_size, audio_length)`):
    Float values of the raw speech waveform. Raw speech waveform can be
    obtained by loading a `.flac` or `.wav` audio file into an array of type `list[float]`, a
    `numpy.ndarray` or a `torch.Tensor`, *e.g.* via the torchcodec library (`pip install torchcodec`) or
    the soundfile library (`pip install soundfile`). To prepare the array into
    `input_values`, the [`AutoFeatureExtractor`] should be used for padding
    and conversion into a tensor of type `torch.FloatTensor`.
decoder_position_ids (`torch.LongTensor` of shape `(batch_size, target_sequence_length)`):
    Indices of positions of each input sequence tokens in the position embeddings.
    Used to calculate the position embeddings up to `config.decoder_config.max_position_embeddings`

Example:

```python
>>> import torch
>>> from transformers import AutoProcessor, MoonshineForConditionalGeneration
>>> from datasets import load_dataset

>>> processor = AutoProcessor.from_pretrained("UsefulSensors/moonshine-tiny")
>>> model = MoonshineForConditionalGeneration.from_pretrained("UsefulSensors/moonshine-tiny")

>>> ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")

>>> inputs = processor(ds[0]["audio"]["array"], return_tensors="pt")
>>> input_values = inputs.input_values

>>> generated_ids = model.generate(input_values, max_new_tokens=100)

>>> transcription = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
>>> transcription
'Mr. Quilter is the apostle of the middle classes, and we are glad to welcome his gospel.'
```Úshift_labelsNru   rm  ro  rn  r,   rp  rq  rQ   Úlogitsr�  rH   )	Úlossr’  r,   rt  ru  rV  rv  rñ   rw  r:   )Úpopr'   r�   rX   rP   rþ   r�  rF  Úloss_functionrH   r   r,   rt  ru  rV  rv  rñ   rw  )r@   rÿ   ru   rm  rn  ro  r,   rp  rq  rQ   r�  rA   r‘  Úoutputsr’  r“  s   &&&&&&&&&&&,    rC   r�   Ú)MoonshineForConditionalGeneration.forward¿  s|  € ðh —z‘z .°$Ó7ˆàÒØ Ò(Ð-BÒ-JÜ$6ØŸK™K×4Ñ4°d·k±k×6XÑ6Xó%Ð!ð '+§j¢jØñ'
à)ð'
ð 0ð'
ð ,ð	'
ð
 $:ð'
ð ,ð'
ð #8ð'
ð "6ð'
ð  ð'
ð ñ'
ˆð —‘˜w×8Ñ8Ó9ˆàˆØÒð
 ×%Ò%ñ Øðàðð  Ÿ;™;×1Ñ1ðð .:Ò-E™\È6ð	ð
 ñˆDô ØØØ#×3Ñ3Ø")×"?Ñ"?Ø&×9Ñ9Ø$×5Ñ5Ø&-×&GÑ&GØ")×"?Ñ"?Ø&×9Ñ9ô

ð 
	
rE   )rþ   r�  )
NNNNNNNNNN)rd   re   rf   rg   Ú_tied_weights_keysr€   r…  r‰  r8  r   r   r�   rm   rn   ro   rp   s   @@rC   r}  r}  ¦  s[   ù‡ € ð ,Ð-PÐQÐ÷ó òò'÷1ð 1ð Ø÷`
ñ `
ó ó ÷`
ð `
rE   r}  )r*   rg  rý   r}  )NÚcollections.abcr   Údataclassesr   rw   Útorch.nnrƒ   Úhuggingface_hub.dataclassesr   Úactivationsr   Úcache_utilsr   r   r	   Úconfiguration_utilsr
   Ú
generationr   Úmasking_utilsr   r   Úmodeling_flash_attention_utilsr   Úmodeling_layersr   Úmodeling_outputsr   r   r   r   r   Úmodeling_rope_utilsr   Úmodeling_utilsr   r   Úprocessing_utilsr   Úutilsr   r   r   r   Úutils.genericr   Úutils.output_capturingr   r   Úglm.modeling_glmr    r!   r"   Úllama.modeling_llamar#   r$   r%   Úwhisper.modeling_whisperr&   r'   Ú
get_loggerrd   Úloggerr*   rs   r4  r|   r”   r    r¢   rÙ   ré   rý   r  rR  rg  r}  Ú__all__r:   rE   rC   Ú<module>r±     s¤  ðõ %Ý !ã Ý Ý .å !ß CÑ CÝ 3Ý )ß JÝ BÝ 9÷õ õ 2ß FÝ &ß RÓ RÝ 7ß Eß UÑ Uß YÑ Yß Gð 
×	Ò	˜HÓ	%€ñ Ð9Ô:ØôS(Ð&ó S(ó ó ;ðS(ñl ðôð
 ô
/ /ó 
/ó óð
/ô˜"Ÿ)™)ô ô˜"Ÿ)™)ô ô 	Ð1ô 	ôe)˜ô e)ôPUÐ-ô Uô"EÐ6ô EðP ô#˜ó #ó ð#ô0d
Ð/ô d
ôNV
�zô V
ôrI
�\ô I
ñX ðôô
v
Ð(@À/ó v
óð
v
òr‚rE   