ó
    ‰Ž¡jÄ’  ã                   ó0  • S SK Jr  S SKJrJrJr  S SKrS SKrSSK	J
r
  SSKJr  SSKJrJrJrJr  SS	KJr  SS
KJr  \(       a  S SKJr  SSKJr  SSKJr  \R8                  " \5      r\" 5       (       a
  S SKrSSK J!r!  S r"S r#SS jr$S r% " S S\5      r&g)é    )Údefaultdict)ÚTYPE_CHECKINGÚAnyÚUnionNé   )ÚGenerationConfig)ÚPreTrainedTokenizer)Úis_torch_availableÚis_torchaudio_availableÚis_torchcodec_availableÚloggingé   )Úffmpeg_read)ÚChunkPipeline)ÚBeamSearchDecoderCTC)ÚSequenceFeatureExtractor)ÚPreTrainedModel)Ú(MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING_NAMESc                 ó6  • U R                   S:X  a  U $ U R                   S:w  a/  [        SU R                    S[        U R                  5       S35      eU R                  S   nUS:”  a%  [        SU S[        U R                  5       S	35      eU R	                  SS
9$ )a¬  
Reduce a waveform to a single channel, or refuse when the layout is ambiguous.

The pipeline reads audio as `(channels, samples)`, which is what torchcodec returns
and what `datasets` returned before 4.0. Anything else is rejected rather than
guessed at: the shape alone cannot distinguish two-channel audio from a two-sample
recording, and averaging the wrong axis produces a silently wrong transcription
instead of an error.
r   r   zƒAutomaticSpeechRecognitionPipeline expects mono audio shaped `(samples,)` or multi-channel audio shaped `(channels, samples)`, got z dimensions with shape Ú.r   zMAutomaticSpeechRecognitionPipeline reads axis 0 as channels, and it has size z in the input of shape a  . If this array is channels-last `(samples, channels)`, which is what `soundfile.read`, `librosa.load(mono=False)` and `scipy.io.wavfile.read` return, transpose it first. If it genuinely has more than 2 channels, downmix it to mono yourself so the weighting is yours to choose.©Úaxis)ÚndimÚ
ValueErrorÚtupleÚshapeÚmean)ÚinputsÚnum_channelss     ÚÁC:\Users\johnn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\transformers/pipelines/automatic_speech_recognition.pyÚ_to_monor!   )   s´   € ð ‡{�{�aÓØˆà‡{�{�aÓÜðEØEKÇ[Á[ÀMð RÜ §¡Ó-Ð.¨að1ó
ð 	
ð —<‘< ‘?€LØ�aÓÜØ[ØˆnÐ3´E¸&¿,¹,Ó4GÐ3Hð I3ð3ó
ð 	
ð �;‰;˜Aˆ;ÐÐó    c                 óÜ   • / nU  Hc  u  p4n[        [        X1-  5      5      n[        [        XC-  U-  5      5      n[        [        XS-  U-  5      5      nXdU4nUR                  U5        Me     U$ )z‚
Rescales the stride values from audio space to tokens/logits space.

(160_000, 16_000, 16_000) -> (2000, 200, 200) for instance.
)ÚintÚroundÚappend)ÚstrideÚratioÚnew_stridesÚinput_nÚleftÚrightÚtoken_nÚ
new_strides           r    Úrescale_strider/   K   su   € ð €KÛ &Ñˆ�uÜ”e˜G™OÓ,Ó-ˆÜ”5˜™¨'Ñ1Ó2Ó3ˆÜ”E˜%™/¨GÑ3Ó4Ó5ˆØ UÐ+ˆ
Ø×Ñ˜:Ö&ñ !'ð Ðr"   c              #   óX  #   • U R                   S   nX#-
  U-
  n[        SXg5       H€  nX‚-   n	XU	 n
U" U
UR                  SSS9nUb  UR                  US9nUS:X  a  SOUnX–:¬  nU(       a  SOUnU
R                   S   nX,U4nU
R                   S   U:”  a  XßS.UEv •  U(       d  M€    g    g 7f)Nr   ÚptT©Úsampling_rateÚreturn_tensorsÚreturn_attention_mask©Údtype)Úis_lastr'   )r   Úranger3   Úto)r   Úfeature_extractorÚ	chunk_lenÚstride_leftÚstride_rightr7   Ú
inputs_lenÚstepÚchunk_start_idxÚchunk_end_idxÚchunkÚ	processedÚ_stride_leftr8   Ú_stride_rightr'   s                   r    Ú
chunk_iterrG   _   sÒ   é € Ø—‘˜a‘€JØÑ" \Ñ1€DÜ   JÖ5ˆØ'Ñ3ˆØ }Ð5ˆÙ%ØØ+×9Ñ9ØØ"&ñ	
ˆ	ð ÑØ!Ÿ™¨5˜Ð1ˆIØ+¨qÓ0‘q°kˆØÑ-ˆÞ$™¨,ˆà—K‘K ‘Nˆ	Ø¨=Ð9ˆØ�;‰;�q‰>˜LÓ(Ø%ÑE¸9ÐEÒEßˆ7Ùò) 6ùs   ‚BB*Â%B*c           
      óh  • U S   S   R                  5        Vs/ s H  o"UR                  ;  d  M  UPM     nnU SS   HÓ  nUS   R                  5        Vs/ s H  o"UR                  ;  d  M  UPM     nnSnSn[        S[        U5      S-   5       Hi  nUS-  n	[        R
                  " [        R                  " X8* S  5      [        R                  " US U 5      :H  5      n
X¨-  U	-   nU
S:”  d  M^  X·:”  d  Me  UnUnMk     UR                  XVS  5        MÕ     [        R                  " U5      $ s  snf s  snf )Nr   r   g        g     ˆÃ@)ÚtolistÚall_special_idsr9   ÚlenÚnpÚsumÚarrayÚextend)Ú	sequencesÚ	tokenizerÚtok_idÚsequenceÚnew_seqÚnew_sequenceÚindexÚmax_ÚiÚepsÚmatchesÚmatchings               r    Ú_find_longest_common_sequencer\   y   s#  € ð &/¨q¡\°!¡_×%;Ñ%;Ô%=ÓiÒ%=˜6Èy×OhÑOhÑAh—Ñ%=€HÐiØ˜Q˜R“=ˆØ-4°Q©Z×->Ñ->Ô-@ÓlÒ-@ 6ÐR[×RkÑRkÑDkŸÑ-@ˆÐlàˆØˆÜ�qœ#˜lÓ+¨aÑ/Ö0ˆAà�g‘+ˆCÜ—f’fœRŸXšX h¨r¨s mÓ4¼¿ºÀÈbÈqÐAQÓ8RÑRÓSˆGØ‘{ SÑ(ˆHØ˜�{˜x�Ø�Ø’ñ 1ð 	�‰˜ VÐ,Ö-ñ !ô �8Š8�HÓÐùò jùâls   ™D*°D*ÁD/Á,D/c                   óN  ^ • \ rS rSrSrSrSrSrSrSr	\
" SSS9r    SS	S
S\S\4   S-  S\S-  S\S\4   S-  S\\S4   S-  4
U 4S jjjrS\R$                  \-  \-  \-  S\S\\\\4      4U 4S jjr      SS jr\S 5       rS S jrS!S jr S"S\S-  4S jjrSrU =r$ )#Ú"AutomaticSpeechRecognitionPipelineé’   aï  
Pipeline that aims at extracting spoken text contained within some audio.

The input can be either a raw waveform or a audio file. In case of the audio file, ffmpeg should be installed for
to support multiple audio formats

Unless the model you're using explicitly sets these generation parameters in its configuration files
(`generation_config.json`), the following default values will be used:
- max_new_tokens: 256
- num_beams: 5

Example:

```python
>>> from transformers import pipeline

>>> transcriber = pipeline(model="openai/whisper-base")
>>> transcriber("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/1.flac")
{'text': ' He hoped there would be stew for dinner, turnips and carrots and bruised potatoes and fat mutton pieces to be ladled out in thick, peppered flour-fatten sauce.'}
```

Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial)

Arguments:
    model ([`PreTrainedModel`]):
        The model that will be used by the pipeline to make predictions. This needs to be a model inheriting from
        [`PreTrainedModel`].
    feature_extractor ([`SequenceFeatureExtractor`], *optional*):
        The feature extractor that will be used by the pipeline to encode waveform for the model.
    tokenizer ([`PreTrainedTokenizer`], *optional*):
        The tokenizer that will be used by the pipeline to encode data for the model. This object inherits from
        [`PreTrainedTokenizer`].
    decoder (`pyctcdecode.BeamSearchDecoderCTC`, *optional*):
        [PyCTCDecode's
        BeamSearchDecoderCTC](https://github.com/kensho-technologies/pyctcdecode/blob/2fd33dc37c4111417e08d89ccd23d28e9b308d19/pyctcdecode/decoder.py#L180)
        can be passed for language model boosted decoding. See [`Wav2Vec2ProcessorWithLM`] for more information.
    device (Union[`int`, `torch.device`], *optional*):
        Device ordinal for CPU/GPU supports. Setting this to `None` will leverage CPU, a positive will run the
        model on the associated CUDA device id.
TFé   é   )Úmax_new_tokensÚ	num_beamsNÚmodelr   r;   r   rQ   Údecoderr   Údeviceztorch.devicec                 óP  >• UR                   R                  S:X  a  SU l        OoUR                  R                  [
        R                  " 5       ;   a  SU l        O:UR                   R                  S;   a  SU l        OUb  X@l        SU l        OSU l        [        TU ]$  " XU4SU0UD6  g )	NÚwhisperÚseq2seq_whisperÚseq2seq)Úparakeet_tdtÚparakeet_rnntÚnemotron_asr_streamingÚnemotron3_5_asrÚtdtÚctc_with_lmÚctcrf   )
ÚconfigÚ
model_typeÚtypeÚ	__class__Ú__name__r   Úvaluesre   ÚsuperÚ__init__)Úselfrd   r;   rQ   re   rf   Úkwargsru   s          €r    ry   Ú+AutomaticSpeechRecognitionPipeline.__init__Ç   sŽ   ø€ ð �<‰<×"Ñ" iÓ/Ø)ˆD�IØ�_‰_×%Ñ%Ô)Q×)XÒ)XÓ)ZÓZØ!ˆD�IØ�\‰\×$Ñ$Ð(vÓvàˆD�IØÑ Ø"ŒLØ%ˆD�IàˆDŒIä‰Ò˜Ð+<ÑVÀVÐVÈvÓVr"   r   r{   Úreturnc                 ó&   >• [         TU ]  " U40 UD6$ )aÍ  
Transcribe the audio sequence(s) given as inputs to text. See the [`AutomaticSpeechRecognitionPipeline`]
documentation for more information.

Args:
    inputs (`np.ndarray` or `bytes` or `str` or `dict`):
        The inputs is either :
            - `str` that is either the filename of a local audio file, or a public URL address to download the
              audio file. The file will be read at the correct sampling rate to get the waveform using
              *ffmpeg*. This requires *ffmpeg* to be installed on the system.
            - `bytes` it is supposed to be the content of an audio file and is interpreted by *ffmpeg* in the
              same way.
            - (`np.ndarray` of shape (n, ) of type `np.float32` or `np.float64`)
                Raw audio at the correct sampling rate (no further check will be done)
            - `dict` form can be used to pass raw audio sampled at arbitrary `sampling_rate` and let this
              pipeline do the resampling. The dict must be in the format `{"sampling_rate": int, "raw":
              np.array}` with optionally a `"stride": (left: int, right: int)` than can ask the pipeline to
              treat the first `left` samples and last `right` samples to be ignored in decoding (but used at
              inference to provide more context to the model). Only use `stride` with CTC models.
    return_timestamps (*optional*, `str` or `bool`):
        Only available for pure CTC models (Wav2Vec2, HuBERT, etc) and the Whisper model. Not available for
        other sequence-to-sequence models.

        For CTC models, timestamps can take one of two formats:
            - `"char"`: the pipeline will return timestamps along the text for every character in the text. For
                instance, if you get `[{"text": "h", "timestamp": (0.5, 0.6)}, {"text": "i", "timestamp": (0.7,
                0.9)}]`, then it means the model predicts that the letter "h" was spoken after `0.5` and before
                `0.6` seconds.
            - `"word"`: the pipeline will return timestamps along the text for every word in the text. For
                instance, if you get `[{"text": "hi ", "timestamp": (0.5, 0.9)}, {"text": "there", "timestamp":
                (1.0, 1.5)}]`, then it means the model predicts that the word "hi" was spoken after `0.5` and
                before `0.9` seconds.

        For the Whisper model, timestamps can take one of two formats:
            - `"word"`: same as above for word-level CTC timestamps. Word-level timestamps are predicted
                through the *dynamic-time warping (DTW)* algorithm, an approximation to word-level timestamps
                by inspecting the cross-attention weights.
            - `True`: the pipeline will return timestamps along the text for *segments* of words in the text.
                For instance, if you get `[{"text": " Hi there!", "timestamp": (0.5, 1.5)}]`, then it means the
                model predicts that the segment "Hi there!" was spoken after `0.5` and before `1.5` seconds.
                Note that a segment of text refers to a sequence of one or more words, rather than individual
                words as with word-level timestamps.
    generate_kwargs (`dict`, *optional*):
        The dictionary of ad-hoc parametrization of `generate_config` to be used for the generation call. For a
        complete overview of generate, check the [following
        guide](https://huggingface.co/docs/transformers/en/main_classes/text_generation).

Return:
    `Dict`: A dictionary with the following keys:
        - **text** (`str`): The recognized text.
        - **chunks** (*optional(, `list[Dict]`)
            When using `return_timestamps`, the `chunks` will become a list containing all the various text
            chunks identified by the model, *e.g.* `[{"text": "hi ", "timestamp": (0.5, 0.9)}, {"text":
            "there", "timestamp": (1.0, 1.5)}]`. The original full text can roughly be recovered by doing
            `"".join(chunk["text"] for chunk in output["chunks"])`.
)rx   Ú__call__)rz   r   r{   ru   s      €r    r   Ú+AutomaticSpeechRecognitionPipeline.__call__à   s   ø€ ôr ‰wÒ Ñ1¨&Ñ1Ð1r"   c                 óÈ  • 0 n0 n	0 n
UbG  U R                   S;   a3  U(       d,  SnU R                   S:X  a  US-  n[        R                  U5        XS'   Ub  X(S'   SU;   a   U	R                  UR	                  S5      5        U	R                  U5        [        U SS 5      b  U R                  U	S'   [        U S	S 5      b  U R                  U	S
'   U R                  U	S	'   Ub  XJS'   Ub#  U R                   S:w  a  [        S5      eXjS'   XiS'   [        U S5      (       a:  [        U R                  S5      (       a  U=(       d    U R                  R                  nUb�  U R                   S:X  a  U(       a  [        S5      eU R                   S:X  a  US:w  a  [        S5      eU R                   S:X  a  US;  a  [        S5      eU R                   S:X  a  US:X  a  [        S5      eXYS'   XZS'   X‰U
4$ )N)rj   ri   a  Using `chunk_length_s` is very experimental with seq2seq models. The results will not necessarily be entirely accurate and will have caveats. More information: https://github.com/huggingface/transformers/pull/20104. Ignore this warning with pipeline(..., ignore_warning=True).ri   zÕ To use Whisper for long-form transcription, use rather the model's `generate` method directly as the model relies on it's own chunking mechanism (cf. Whisper original paper, section 3.8. Long-form Transcription).Úchunk_length_sÚstride_length_sÚgenerate_kwargsÚassistant_modelÚassistant_tokenizerrQ   Údecoder_kwargsz)Only Whisper can return language for now.Úreturn_languageÚgeneration_configÚreturn_timestampsrj   zEWe cannot return_timestamps yet on non-CTC models apart from Whisper!rp   ÚwordzRCTC with LM can only predict word level timestamps, set `return_timestamps='word'`rq   )Úcharr‹   z–CTC can either predict character level timestamps, or word level timestamps. Set `return_timestamps='char'` or `return_timestamps='word'` as required.rŒ   zžWhisper cannot return `char` timestamps, only word level or segment level timestamps. Use `return_timestamps='word'` or `return_timestamps=True` respectively.)rt   ÚloggerÚwarningÚupdateÚpopÚgetattrr…   rQ   r†   r   Úhasattrr‰   rŠ   )rz   r‚   rƒ   Úignore_warningr‡   rŠ   rˆ   r„   Úpreprocess_paramsÚforward_paramsÚpostprocess_paramsÚtype_warnings               r    Ú_sanitize_parametersÚ7AutomaticSpeechRecognitionPipeline._sanitize_parameters  s,  € ð ÐØˆØÐð Ñ%Ø�y‰yÐ:Ó:Æ>ð-ð ð —9‘9Ð 1Ó1Ø ð4ñ�Lô
 —‘˜|Ô,Ø2@Ð.Ñ/ØÑ&Ø3BÐ/Ñ0ð  Ó/Ø×!Ñ! /×"5Ñ"5Ð6GÓ"HÔIà×Ñ˜oÔ.ä�4Ð*¨DÓ1Ñ=Ø04×0DÑ0DˆNÐ,Ñ-Ü�4Ð.°Ó5ÑAØ*.¯.©.ˆN˜;Ñ'Ø48×4LÑ4LˆNÐ0Ñ1ð Ñ%Ø3AÐ/Ñ0ØÑ&Ø�y‰yÐ-Ó-Ü Ð!LÓMÐMØ4CÐ0Ñ1Ø0?Ð,Ñ-ô �4Ð,×-Ñ-´'¸$×:PÑ:PÐRe×2fÑ2fØ 1× ]°T×5KÑ5K×5]Ñ5]ÐàÑ(à�y‰y˜IÓ%Ö*;Ü Ð!hÓiÐiØ�y‰y˜MÓ)Ð.?À6Ó.IÜ Ð!uÓvÐvØ�y‰y˜EÓ!Ð&7Ð?OÓ&OÜ ð`óð ð �y‰yÐ-Ó-Ð2CÀvÓ2MÜ ð_óð ð 3DÐ.Ñ/Ø6GÐ2Ñ3à Ð2DÐDÐDr"   c                 óÀ   • [        U R                  R                  SS5      nU R                  R                  R                  S:X  a  XR                  R
                  -  nU$ )zSample stride per output.Úinputs_to_logits_ratior   Úlasr_ctc)r‘   rd   rr   rs   r;   Ú
hop_length)rz   Úalign_tos     r    Ú	_align_toÚ,AutomaticSpeechRecognitionPipeline._align_tom  sP   € ô ˜4Ÿ:™:×,Ñ,Ð.FÈÓJˆØ�:‰:×Ñ×'Ñ'¨:Ó5ð ×.Ñ.×9Ñ9Ñ9ˆHØˆr"   c           	   #   ó.  #   • [        U[        5      (       aq  UR                  S5      (       d  UR                  S5      (       a   [        R                  " USS9R
                  nO%[        US5       nUR                  5       nS S S 5        [        U[        5      (       a  [        XR                  R                  5      nS n0 n[        5       (       a<  SS Kn[        XR                  5      (       a  UR                  5       R!                  5       n[#        5       (       a|  SS Kn[        XR&                  R(                  5      (       aT  UR+                  5       n	U	R,                  n
U
R.                  S:X  a  U
R0                  S   S:X  a  U
S   OU
n
X©R2                  S	.n[        U[4        5      (       GaÛ  UR7                  S
S 5      nSU;   a  SU;   d  SU;   d  [9        S5      eUR7                  SS 5      nUc$  UR7                  SS 5        UR7                  SS 5      nUR7                  S5      nUnUn[        U[:        R<                  WR                  45      (       a  [?        U5      nXÀR                  R                  :w  a¡  [A        5       (       a  SSK!J"n  O[G        S5      eURI                  [        U[:        R<                  5      (       a  URJ                  " U5      OUUU R                  R                  5      R!                  5       nU R                  R                  U-  nOSnUbi  US   US   -   UR0                  S   :”  a  [9        S5      eUR0                  S   [M        [O        US   U-  5      5      [M        [O        US   U-  5      5      4n[        U[:        R<                  WR                  45      (       d  [Q        S[S        U5       S35      e[?        U5      nU(       Ga  Uc  US-  n[        U[L        [T        45      (       a  X3/nU RV                  n[M        [O        X R                  R                  -  U-  5      U-  5      n[M        [O        US   U R                  R                  -  U-  5      U-  5      n[M        [O        US   U R                  R                  -  U-  5      U-  5      nUUU-   :  a  [9        S5      e[Y        XR                  UUUU RZ                  5       H  n0 UEUEv •  M     g U RR                  S:X  aP  UR0                  S   U R                  R\                  :”  a)  U R                  UU R                  R                  SSSSS9nO`U RR                  S:X  a*  Uc'  U R                  UU R                  R                  SSS9nO&U R                  UU R                  R                  SSS9nU RZ                  b  UR_                  U RZ                  S9nUb   U RR                  S:X  a  [9        S5      eUUS
'   S S0UEUEv •  g ! , (       d  f       GN‰= f7f)!Nzhttp://zhttps://T)Úfollow_redirectsÚrbr   r   r   )rN   r3   r'   r3   ÚrawrN   zûWhen passing a dictionary to AutomaticSpeechRecognitionPipeline, the dict needs to contain a "raw" key containing the numpy array or torch tensor representing the audio and a "sampling_rate" key, containing the sampling_rate associated with that arrayÚpath)Ú
functionalz¢torchaudio is required to resample audio samples in AutomaticSpeechRecognitionPipeline. The torchaudio package can be installed through: `pip install torchaudio`.zStride is too large for inputz9We expect a numpy ndarray or torch tensor as input, got `Ú`é   z.Chunk length must be superior to stride lengthri   FÚlongestr1   )r3   Ú
truncationÚpaddingr4   r5   r2   r6   rj   z8Stride is only usable with CTC models, try removing it !r8   )0Ú
isinstanceÚstrÚ
startswithÚhttpxÚgetÚcontentÚopenÚreadÚbytesr   r;   r3   r
   ÚtorchÚTensorÚcpuÚnumpyr   Ú
torchcodecÚdecodersÚAudioDecoderÚget_all_samplesÚdatar   r   Úsample_rateÚdictr�   r   rL   Úndarrayr!   r   Ú
torchaudior¦   ÚImportErrorÚresampleÚ
from_numpyr$   r%   Ú	TypeErrorrt   ÚfloatrŸ   rG   r7   Ú	n_samplesr:   )rz   r   r‚   rƒ   Úfr'   Úextrarµ   r¹   Ú_audio_samplesÚ_arrayÚ_inputsÚin_sampling_rateÚFr(   rž   r<   r=   r>   ÚitemrD   s                        r    Ú
preprocessÚ-AutomaticSpeechRecognitionPipeline.preprocess{  s„  é € Ü�fœc×"Ñ"Ø× Ñ  ×+Ñ+¨v×/@Ñ/@À×/LÑ/Lô Ÿš 6¸DÑA×IÑI‘ä˜& $Ô'¨1ØŸV™V›X�F÷ (ô �fœe×$Ñ$Ü  ×)?Ñ)?×)MÑ)MÓNˆFàˆØˆä×ÑÛä˜&§,¡,×/Ñ/ØŸ™›×+Ñ+Ó-�ä"×$Ñ$Ûä˜&×"5Ñ"5×"BÑ"B×CÑCØ!'×!7Ñ!7Ó!9�ð (×,Ñ,�Ø&,§k¡k°QÓ&6¸6¿<¹<È¹?ÈaÓ;O˜ šÐU[�Ø#)×<VÑ<VÑW�ä�fœd×#Ò#Ø—Z‘Z ¨$Ó/ˆFð $ vÓ-°5¸F³?ÀgÐQWÓFWÜ ðNóð ð —j‘j ¨Ó-ˆGØ‰à—
‘
˜6 4Ô(Ø Ÿ*™* W¨dÓ3�Ø%Ÿz™z¨/Ó:ÐØˆEØˆFô ˜&¤2§:¡:¨u¯|©|Ð"<×=Ñ=Ü! &Ó)�Ø×#9Ñ#9×#GÑ#GÓGÜ*×,Ñ,Þ:ä%ðeóð ð
 Ÿ™Ü0:¸6Ä2Ç:Á:×0NÑ0N�E×$Ò$ VÔ,ÐTZØ$Ø×*Ñ*×8Ñ8ó÷ ‘%“'ð	 ð
 ×.Ñ.×<Ñ<Ð?OÑO‘à�ØÑ!Ø˜!‘9˜v a™yÑ(¨6¯<©<¸©?Ó:Ü$Ð%DÓEÐEð !Ÿ,™, q™/¬3¬u°V¸A±YÀÑ5FÓ/GÓ+HÌ#ÌeÐTZÐ[\ÑT]Ð`eÑTeÓNfÓJgÐh�Ü˜&¤2§:¡:¨u¯|©|Ð"<×=Ñ=ÜÐWÔX\Ð]cÓXdÐWeÐefÐgÓhÐhÜ˜&Ó!ˆçØÑ&Ø"0°1Ñ"4�ä˜/¬C´¨<×8Ñ8Ø#2Ð"D�à—~‘~ˆHÜœE .×3IÑ3I×3WÑ3WÑ"WÐZbÑ"bÓcÐfnÑnÓoˆIÜœe O°AÑ$6¸×9OÑ9O×9]Ñ9]Ñ$]Ð`hÑ$hÓiÐltÑtÓuˆKÜœu _°QÑ%7¸$×:PÑ:P×:^Ñ:^Ñ%^ÐaiÑ%iÓjÐmuÑuÓvˆLà˜;¨Ñ5Ó5Ü Ð!QÓRÐRä" 6×+AÑ+AÀ9ÈkÐ[gÐim×isÑisÖt�Ø'˜Ð' Ð'Ô'ò uð �y‰yÐ-Ó-°&·,±,¸q±/ÀD×DZÑDZ×DdÑDdÓ2dØ ×2Ñ2ØØ"&×"8Ñ"8×"FÑ"FØ$Ø%Ø#'Ø*.ð 3ð ‘	ð —9‘9Ð 1Ó1°f±nØ $× 6Ñ 6ØØ&*×&<Ñ&<×&JÑ&JØ'+Ø.2ð	 !7ð !‘Ið !%× 6Ñ 6ØØ&*×&<Ñ&<×&JÑ&JØ'+Ø.2ð	 !7ð !�Ið �z‰zÑ%Ø%ŸL™L¨t¯z©z˜LÐ:�	ØÑ!Ø—9‘9 	Ó)Ü$Ð%_Ó`Ð`à&,�	˜(Ñ#Ø˜dÐ9 iÐ9°5Ð9Ó9÷E (Ö'üs   ‚A.XÁ0XÂVXØ
XØXc                 óˆ	  • UR                  SS 5      nUR                  SS 5      nUR                  SS 5      nUR                  S5      nUb  Ub  [        S5      eU R                  S;   GaÀ  SU;   a  UR                  S5      n	O4SU;   a  UR                  S5      n	O[        S	UR                  5        35      eU=(       d    [	        U R
                  S
S5      nU(       a.  U R                  S:X  a  [        U5      US
'   US:X  a
  SUS'   SUS'   SU;  a  U R
                  US'   [        U R                  S5      (       a  U R                  R                  OSn
X©SU0UEnU(       a  U R                  S:X  a  SUS'   U R                  R                  " S&0 UD6nUS:X  ai  U R                  S:X  aY  SU;  a  US   US   S.nOnUS    VVs/ s H,  n[        R                  " U Vs/ s H  oîS   PM	     sn5      PM.     nnnUS   US.nO'[        U[        5      (       a  SU;   a  SUS   0nOSU0nU R                  S:X  að  Ub  XlS'   U(       aâ  [        U[        5      (       aÍ  SU;   aÇ  US   nU(       a»  US   (       a±  US   S   S   n[        U[        5      (       a  US   OUnUR                  SU R
                  5      n[        US5      (       a]  [!        UR"                  R%                  5       5      nUR'                  5        H&  nUU;   d  M  [        R(                  " U/5      US'     GO‰   GO…U R                  S;   aÌ  U R                  R                  UR                  U R                  R                  5      SU0n	U R                  " S&0 U	D6nUR*                  nU R                  S:X  a  SU0nOSUR-                  S S!90nUbG  S"U R.                  -  n[        U[0        5      (       a  [3        U/U5      S   US'   O¹[3        UU5      US'   O©U R                  S#:X  a€  U R                  R                  UR                  U R                  R                  5      0n	SU;   a  UR                  S5      U	S'   U R                  R                  " S&0 U	D6nSUR4                  0nO[        S$U R                   S%35      eUnSU0UEUE$ s  snf s  snnf )'NÚattention_maskr'   Ú
num_framesr8   z0num_frames must be used only when stride is None¾   rj   ri   Úinput_featuresÚinput_valueszhSeq2Seq speech recognition model requires either a `input_features` or `input_values` key, but only has rŠ   Fri   r‹   TÚreturn_token_timestampsÚreturn_segmentsr‰   Úmain_input_namer   ÚsegmentsrP   Útoken_timestamps)ÚtokensrÜ   rÝ   r   ÚresultÚ
lang_to_idÚlang_id¾   rq   rp   rp   Úlogitséÿÿÿÿ©Údimr   ro   zUnsupported model type r   © )r�   r   rt   Úkeysr‘   r‰   Úboolr’   rd   rÚ   Úgeneraterµ   Úcatr¬   r¿   r°   Úsetrß   rw   rI   Útensorrâ   ÚargmaxrŸ   r   r/   rP   )rz   Úmodel_inputsrŠ   rˆ   r„   rÓ   r'   rÔ   r8   r   rÚ   rÝ   ÚoutÚsegment_listÚsegmentrÜ   rÛ   rÞ   Úfull_seqÚ
gen_configÚlang_idsÚtoken_idÚoutputsrâ   r(   rÉ   s                             r    Ú_forwardÚ+AutomaticSpeechRecognitionPipeline._forward  sÕ  € Ø%×)Ñ)Ð*:¸DÓAˆØ×!Ñ! (¨DÓ1ˆØ!×%Ñ% l°DÓ9ˆ
Ø×"Ñ" 9Ó-ˆàÑ *Ñ"8ÜÐOÓPÐPà�9‰9Ð6Ô6ð   <Ó/Ø%×)Ñ)Ð*:Ó;‘Ø <Ó/Ø%×)Ñ)¨.Ó9‘ä ðLØLX×L]ÑL]ÓL_ÐK`ðbóð ð !2× p´W¸T×=SÑ=SÐUhÐjoÓ5pÐÞ  T§Y¡YÐ2CÓ%CÜ7;Ð<MÓ7N�Ð 3Ñ4Ø$¨Ó.ØAE�OÐ$=Ñ>Ø9=�OÐ$5Ñ6ð #¨/Ó9Ø7;×7MÑ7M�Ð 3Ñ4ä<CÀDÇJÁJÐPa×<bÑ<b˜dŸj™j×8Ò8ÐhpˆOàØ  .ðð "ðˆOö  4§9¡9Ð0AÓ#AØ59�Ð 1Ñ2à—Z‘Z×(Ò(Ñ;¨?Ñ;ˆFð ! FÓ*¨t¯y©yÐ<MÓ/MØ VÓ+Ø%+¨KÑ%8ÈfÐUgÑNhÑi‘Cð -3°:Ò,>ô(â,>˜Lô Ÿ	š	ÉlÓ"[ÊlÀ7Ð+=Ô#>ÉlÑ"[Ö\Ù,>ð %ñ (ð &,¨KÑ%8ÐN^Ñ_‘CÜ˜F¤D×)Ñ)¨k¸VÓ.CØ ¨Ñ!4Ð5‘à Ð(�Ø�y‰yÐ-Ó-ØÑ%Ø$*˜‘MÞ"¤z°&¼$×'?Ñ'?ÀJÐRXÓDXð  & jÑ1�HÞ H¨Q§KØ!)¨!¡¨Q¡°Ñ!9˜Ü:DÀVÌT×:RÑ:R 6¨+Ò#6ÐX^˜Ø%4×%8Ñ%8Ð9LÈd×NdÑNdÓ%e˜
Ü" :¨|×<Ñ<Ü'*¨:×+@Ñ+@×+GÑ+GÓ+IÓ'J˜HØ,4¯O©OÖ,= Ø#+¨xÕ#7Ü5:·\²\À8À*Ó5M C¨	¡NÚ$)ñ ->ùð
 �Y‰YÐ0Ó0à—
‘
×*Ñ*¨L×,<Ñ,<¸T¿Z¹Z×=WÑ=WÓ,XØ  .ðˆFð —j’jÑ* 6Ñ*ˆGØ—^‘^ˆFà�y‰y˜MÓ)Ø Ð(‘à §¡°2 Ð!6Ð7�ØÑ!ð ˜DŸN™NÑ*�Ü˜f¤e×,Ñ,Ü$2°F°8¸UÓ$CÀAÑ$F�C˜’Mä$2°6¸5Ó$A�C˜‘MøØ�Y‰Y˜%Óà—
‘
×*Ñ*¨L×,<Ñ,<¸T¿Z¹Z×=WÑ=WÓ,XðˆFð   <Ó/Ø+7×+;Ñ+;Ð<LÓ+M�Ð'Ñ(Ø—j‘j×)Ò)Ñ3¨FÑ3ˆGØ˜W×.Ñ.Ð/‰CäÐ6°t·y±y°kÀÐCÓDÐDð ˆØ˜7Ð3 cÐ3¨UÐ3Ð3ùò{ #\ùó(s   ÇR>ÇR9Ç*R>Ò9R>r‡   c                 ó°	  • 0 n/ nU R                   S:X  a  SOSnS nU H¾  n	X—   R                  [        R                  [        R                  4;   a0  X—   R                  [        R                  5      R                  5       n
OX—   R                  5       n
U	R                  SS 5      nUb#  U R                   S;   a  Uu  p¼nX½-
  nU
S S 2XÎ24   n
UR                  U
5        MÀ     U(       a'  U R                   S:X  a  [        X`R                  5      n
GO_U R                   S:X  Ga(  U R                  R                  U R                  R                  R                   -  nU R                  R"                  nU H+  nSU;   d  M  US   u  nnnUU-  nUU-  nUU-  nUUU4US'   M-     U(       aƒ  U H}  nSU;   d  M  US   nUR%                  5       S	:X  a  UR'                  S	5      nUR'                  S	5      R                  US   R                  S
9n[        R(                  " UUS   /SS9US'   M     U R                  R+                  UUUUS9u  nnO&[,        R.                  " USS9n
U
R1                  S	5      n
U R                   S:X  a`  Uc  0 nU R2                  R4                  " W
40 UD6nUS	   S	   nU(       a.  US	   S   n/ nU H  u  nu  nnUR                  UUUS.5        M      O´U R                   S:w  a¤  U R                   S:g  nU R                   S:X  a  SS0O0 nU R                  R6                  " W
4SU0UD6nU(       aY  U R                  R6                  " U
4USS.UD6S   nUS:X  a0  U R                  R9                  UU R                  R:                  5      nU(       a‡  U R                   S;  aw  / n U R<                  n!W H^  n"U"S   U!-  n#U#U R                  R"                  -  n#U"S   U!-  n$U$U R                  R"                  -  n$U R                  U"U   U#U$4S.5        M`     U US'   [?        [@        5      n%U H�  nURC                  SS 5        URC                  SS 5        URC                  S S 5        URC                  SS 5        URC                  S!S 5        URC                  SS 5        URE                  5        H  u  n&n'U%U&   R                  U'5        M     MŸ     S"W0UEU%E$ )#Nrp   râ   rÝ   r'   rá   rj   ri   rà   r   r6   rã   rä   )rŠ   rˆ   Útime_precisionr   r   r   )r‹   Ústart_offsetÚ
end_offsetrq   ro   Úgroup_tokensFÚskip_special_tokensT)rþ   Úoutput_char_offsetsÚchar_offsetsr‹   rÕ   rû   rü   )ÚtextÚ	timestampÚchunksr8   rÜ   r  )#rt   r7   rµ   Úbfloat16Úfloat16r:   Úfloat32r¸   r°   r&   r\   rQ   r;   Úchunk_lengthrd   rr   Úmax_source_positionsr3   rå   Ú	unsqueezerê   Ú_decode_asrrL   ÚconcatenateÚsqueezere   Údecode_beamsÚdecodeÚ_get_word_offsetsÚreplace_word_delimiter_charrŸ   r   Úlistr�   Úitems)(rz   Úmodel_outputsr‡   rŠ   rˆ   ÚoptionalÚfinal_itemsÚkeyr'   rö   r  Útotal_nr+   r,   Úright_nrú   r3   Úoutputr<   r=   r>   rà   Ú
lang_tokenr  ÚbeamsÚchunk_offsetÚoffsetsr‹   rû   rü   rþ   Údecode_kwargsr  rž   rÏ   ÚstartÚstoprÉ   ÚkÚvs(                                           r    ÚpostprocessÚ.AutomaticSpeechRecognitionPipeline.postprocess{  sÂ  € ð ˆàˆØŸ)™) }Ó4‰h¸(ˆØˆÛ$ˆGØ‰|×!Ñ!¤e§n¡n´e·m±mÐ%DÓDØ™Ÿ™¬¯©Ó6×<Ñ<Ó>‘à™×*Ñ*Ó,�Ø—[‘[ ¨4Ó0ˆFØÑ! d§i¡iÐ3IÓ&IØ'-Ñ$�˜uð
 "™/�Øša  ˜oÑ.�Ø×Ñ˜uÖ%ñ %ö  �d—i‘i 9Ó,Ü1°+¿~¹~ÓNŠEØ�Y‰YÐ+Ô+Ø!×3Ñ3×@Ñ@À4Ç:Á:×CTÑCT×CiÑCiÑiˆNà ×2Ñ2×@Ñ@ˆMÛ'�Ø˜vÕ%Ø;AÀ(Ñ;KÑ8�I˜{¨Là Ñ.�IØ =Ñ0�KØ  MÑ1�LØ'0°+¸|Ð'K�F˜8Ó$ñ (ö Û+�FØ  FÕ*Ø"(¨Ñ"3˜Ø"Ÿ;™;›=¨AÓ-Ø&-×&7Ñ&7¸Ó&:˜GØ%,×%6Ñ%6°qÓ%9×%<Ñ%<À6È(ÑCS×CYÑCYÐ%<Ð%Z˜
Ü+0¯9ª9°jÀ&ÈÑBRÐ5SÐY[Ñ+\˜˜xÓ(ñ ,ð "Ÿ^™^×7Ñ7ØØ"3Ø /Ø-ð	 8ð ‰NˆD‘(ô —N’N ;°QÑ7ˆEØ—M‘M !Ó$ˆEà�9‰9˜Ó%ØÑ%Ø!#�Ø—L‘L×-Ò-¨eÑF°~ÑFˆEØ˜‘8˜A‘;ˆDÞ ð  % Q™x¨™{�Ø�Û8DÑ4�DÑ4˜<¨Ø—N‘N¨DÀ,Ð^hÑ#iÖjñ 9Eøà�Y‰YÐ+Ó+Ø"&§)¡)¨uÑ"4Ðð 8<·y±yÀEÓ7I˜^¨UÑ3ÈrˆMØ—>‘>×(Ò(¨ÑiÐDWÐiÐ[hÑiˆDÞ ØŸ.™.×/Ò/ØðØ/BÐX\ñØ`mñà ñ"�ð %¨Ó.Ø"Ÿn™n×>Ñ>¸wÈÏÉ×HrÑHrÓs�Gæ §¡Ð2PÓ!PØˆFØ—~‘~ˆHÛ�Ø˜^Ñ,¨xÑ7�Ø˜×/Ñ/×=Ñ=Ñ=�à˜LÑ)¨HÑ4�Ø˜×.Ñ.×<Ñ<Ñ<�à—‘ tÐ,=Ñ'>ÈeÐUYÈ]Ñ[Ö\ñ  ð "(ˆH�XÑäœDÓ!ˆÛ#ˆFØ�J‰J�x Ô&Ø�J‰J�x Ô&Ø�J‰J�y $Ô'Ø�J‰J�x Ô&Ø�J‰JÐ)¨4Ô0Ø�J‰J�y $Ô'ØŸ™ž‘��1Ø�a‘—‘ Ö"ó 'ñ $ð ˜Ð2 Ð2¨EÐ2Ð2r"   )re   rt   )NNNN)NNNNNN)r   N)FN)NNN) rv   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú_pipeline_calls_generateÚ_load_processorÚ_load_image_processorÚ_load_feature_extractorÚ_load_tokenizerr   Ú_default_generation_configr   r­   r	   r$   ry   rL   rÀ   r´   r¿   r   r  r   r˜   ÚpropertyrŸ   rÐ   r÷   r#  Ú__static_attributes__Ú__classcell__)ru   s   @r    r^   r^   ’   s\  ø† ñ'ðR  $ÐØ€OØ!ÐØ"ÐØ€Oá!1ØØñ"Ðð LPØ04Ø=AØ48ñWà ðWð !Ð!;¸SÐ!@ÑAÀDÑHðWð '¨Ñ-ð	Wð
 Ð-¨sÐ2Ñ3°dÑ:ðWð �c˜>Ð)Ñ*¨TÑ1÷Wð Wð292˜rŸz™z¨EÑ1°CÑ7¸$Ñ>ð 92È#ð 92ÐRVÐW[Ð\_ÐadÐ\dÑWeÑRf÷ 92ðz ØØØØØôPEðd ñó ðôI:ôVs4ðl jnñn3Ø-1°D©[÷n3ó n3r"   r^   )N)'Úcollectionsr   Útypingr   r   r   r¯   r¸   rL   Ú
generationr   Útokenization_pythonr	   Úutilsr
   r   r   r   Úaudio_utilsr   Úbaser   Úpyctcdecoder   Ú!feature_extraction_sequence_utilsr   Úmodeling_utilsr   Ú
get_loggerrv   r�   rµ   Úmodels.auto.modeling_autor   r!   r/   rG   r\   r^   ræ   r"   r    Ú<module>r>     sx   ðõ $ß ,Ñ ,ã Û å )Ý 5ß aÓ aÝ $Ý ö Ý0åLÝ0à	×	Ò	˜HÓ	%€á×ÑÛåTòòDô(ò4ô2W	3¨õ W	3r"   