Ë
    È:jžv  ã                    óâ  — d dl Z d dlZd dlZd dl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ZddlmZmZmZmZmZmZmZ ddlmZmZ ddlmZ ddlmZmZmZ ddlm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z' erdd	l(m)Z) dd
ddddddddddddœddde	e*ejV                  ejX                  f   dee-   de	e.ee.df   f   dee.   dee.   dee.   de-dee*   de-d e-d!e*d"e*d#e	e*ee.   f   d$ee.   fd%„Z/d&„ Z0e1d'k(  r e0«        yy)(é    N)ÚTYPE_CHECKINGÚListÚOptionalÚTupleÚUnioné   )ÚFRAMES_PER_SECONDÚ
HOP_LENGTHÚN_FRAMESÚ	N_SAMPLESÚSAMPLE_RATEÚlog_mel_spectrogramÚpad_or_trim)ÚDecodingOptionsÚDecodingResult)Úadd_word_timestamps)Ú	LANGUAGESÚTO_LANGUAGE_CODEÚget_tokenizer)Ú	exact_divÚformat_timestampÚget_endÚ
get_writerÚ	make_safeÚoptional_floatÚoptional_intÚstr2bool)ÚWhisper)ç        çš™™™™™É?gš™™™™™Ù?ç333333ã?gš™™™™™é?ç      ð?ç333333@ç      ð¿r!   TFõ   "'â€œÂ¿([{-õ   "'.ã€‚,ï¼Œ!ï¼�?ï¼Ÿ:ï¼šâ€�)]}ã€�Ú0)ÚverboseÚtemperatureÚcompression_ratio_thresholdÚlogprob_thresholdÚno_speech_thresholdÚcondition_on_previous_textÚinitial_promptÚcarry_initial_promptÚword_timestampsÚprepend_punctuationsÚappend_punctuationsÚclip_timestampsÚhallucination_silence_thresholdÚmodelr   Úaudior(   r)   .r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   c                óž  ‡ ‡‡‡‡‡‡U‡V‡W‡X— ‰j                  dd«      rt        j                  nt        j                  }‰ j                  t        j                  d«      k(  rkt        j
                  j                  «       rt        j                  d«       |t        j                  k(  r%t        j                  d«       t        j                  }|t        j                  k(  rd‰d<   t        |‰ j                  j                  t        ¬«      }|j                  d   t        z
  }t        |t         z  t"        z  «      }‰j                  d	d
«      €­‰ j$                  sd‰d	<   n›|rt'        d«       t)        |t        «      j+                  ‰ j                  «      j+                  |«      }‰ j-                  |«      \  }}t/        ||j                   ¬«      ‰d	<   |�&t'        dt0        ‰d	      j3                  «       › �«       ‰d	   }‰j                  dd«      }t5        ‰ j$                  ‰ j6                  ||¬«      ŠWt9        |t:        «      r+|r|j=                  d«      ng D �cg c]  }t        |«      ‘Œ }}|D �cg c]  }t?        |t@        z  «      ‘Œ }}tC        |«      dk(  r|jE                  d«       tC        |«      dz  dk(  r|jE                  |«       tG        tI        |d
d
d…   |dd
d…   «      «      }dŠU|
r|dk(  rt        j                  d«       dt        jJ                  dtL        fˆˆˆˆ ˆˆfd„}d}||   d   ŠVtO        t        ‰ j                  jP                  «      }|t         z  t"        z  }g } g }!d}"‰ j                  jR                  dz  dz
  }#|�B‰WjU                  d|jW                  «       z   «      }$| jY                  |$«       |#tC        |$«      z  }#ng }$dt        dt        dt        jJ                  d tL        fˆVˆWfd!„}%t[        jZ                  |d"|du¬#«      5 }&d$}'|tC        |«      k  �rV||   \  }(})‰V|(k  r|(ŠV‰V|)k\  r|dz  }|tC        |«      k  r||   d   ŠVŒ?t        ‰Vt         z  t"        z  «      }*t        ‰Vt        z   t         z  t"        z  «      }+t]        t        |‰Vz
  |)‰Vz
  «      },|d
d
…‰V‰V|,z   …f   }|,t         z  t"        z  }-t)        |t        «      j+                  ‰ j                  «      j+                  |«      }|	r't/        tC        |$«      |"«      }.| |.d
 |# d
 }/|$|/z   ‰d%<   n| |"d
 ‰d%<    ||«      }0t        j^                  |0j`                  «      }1‰�+|0jb                  ‰kD  }2‰�|0jd                  ‰kD  rd}2|2r‰V|,z  ŠV�Œj‰V}3g }4d&tf        dt        fd'„ŠXdth        tf           dtj        fˆUˆXfd(„}5d)tl        tf           dth        tf           fd*„}6|1jo                  ‰Wjp                  «      }7|7d+d
 js                  «       ddgk(  }8t        jt                  |7d
d |7dd
 z  «      d   }9|9jw                  d«       tC        |9«      dkD  r×|9js                  «       }:|8r|:jE                  tC        |1«      «       d};|:D ]p  }<|1|;|< }=|=d   jy                  «       ‰Wjp                  z
  }>|=d   jy                  «       ‰Wjp                  z
  }?|4jE                   |%|*|>|z  z   |*|?|z  z   |=|0¬,«      «       |<};Œr |8r‰V|,z  ŠVnÅ|1|;dz
     jy                  «       ‰Wjp                  z
  }@‰V|@|z  z  ŠVn™|-}A|1|7j{                  «       j}                  «          }BtC        |B«      dkD  rEBd   jy                  «       ‰Wjp                  k7  r%Bd   jy                  «       ‰Wjp                  z
  }@|@|z  }A|4jE                   |%|*|*Az   |1|0¬,«      «       ‰V|,z  ŠV|
�r‹t        |4‰ ‰W||,|||'¬-«       |8s$t�        |4«      }C|C�C|*kD  rt?        Ct@        z  «      ŠV|��@|}D|8s4t�        |4«      }C|C�'C|*kD  r"|+Cz
  }E|EDkD  rt?        Ct@        z  «      ŠVn|3|,z   ŠV |6|4«      }F|F�, |5F«      r$Fd   |*z
  }G|GDkD  r|3t?        Gt@        z  «      z   ŠV�ŒF|'}Htƒ        tC        |4«      «      D ]¹  }I|4|I   }J|Jd.   sŒ |5J«      rŸ |6|4Idz   d
 «      }K|K�Kd.   d   d   }Ln|*|-z   }LJd   Hz
  DkD  xs Jd   Dk  xs Jd   |*z
  d/k  }MLJd   z
  DkD  xs  |5K«      xs |+Jd   z
  d/k  }NMr8Nr6t?        t/        |*dz   Jd   «      t@        z  «      ŠV||Jd   z
  Dk  r|ŠVg |4Id
  nJd   }HŒ» t�        |4«      }C|C�C}'|rG|4D ]B  }J|Jd   |Jd   |Jd0   }Q}P}Od1t…        |O«      › d2t…        |P«      › d3|Q› �}Rt'        t‡        |R«      «       ŒD t‰        |4«      D ]6  \  }S}J|Jd   |Jd   k(  sJd0   jW                  «       d4k(  sŒ(d4Jd0<   g |Jd<   g |Jd.<   Œ8 |!jY                  t‰        |4tC        |!«      ¬5«      D �S�Jcg c]  \  }S}Jd6|Si|J¥‘Œ c}J}S«       | jY                  |4D �J�Tcg c]  }J|Jd   D ]  }T|T‘Œ Œ c}T}J«       |r|0jŠ                  d7kD  rtC        | «      }"|&j�                  t]        |‰V«      |3z
  «       |tC        |«      k  r�ŒVd
d
d
«       tg        ‰Wj�                  | tC        |$«      d
 «      |!|¬8«      S c c}w c c}w c c}J}Sw c c}T}Jw # 1 sw Y   ŒHxY w)9a‚  
    Transcribe an audio file using Whisper

    Parameters
    ----------
    model: Whisper
        The Whisper model instance

    audio: Union[str, np.ndarray, torch.Tensor]
        The path to the audio file to open, or the audio waveform

    verbose: bool
        Whether to display the text being decoded to the console. If True, displays all the details,
        If False, displays minimal details. If None, does not display anything

    temperature: Union[float, Tuple[float, ...]]
        Temperature for sampling. It can be a tuple of temperatures, which will be successively used
        upon failures according to either `compression_ratio_threshold` or `logprob_threshold`.

    compression_ratio_threshold: float
        If the gzip compression ratio is above this value, treat as failed

    logprob_threshold: float
        If the average log probability over sampled tokens is below this value, treat as failed

    no_speech_threshold: float
        If the no_speech probability is higher than this value AND the average log probability
        over sampled tokens is below `logprob_threshold`, consider the segment as silent

    condition_on_previous_text: bool
        if True, the previous output of the model is provided as a prompt for the next window;
        disabling may make the text inconsistent across windows, but the model becomes less prone to
        getting stuck in a failure loop, such as repetition looping or timestamps going out of sync.

    word_timestamps: bool
        Extract word-level timestamps using the cross-attention pattern and dynamic time warping,
        and include the timestamps for each word in each segment.

    prepend_punctuations: str
        If word_timestamps is True, merge these punctuation symbols with the next word

    append_punctuations: str
        If word_timestamps is True, merge these punctuation symbols with the previous word

    initial_prompt: Optional[str]
        Optional text to provide as a prompt for the first window. This can be used to provide, or
        "prompt-engineer" a context for transcription, e.g. custom vocabularies or proper nouns
        to make it more likely to predict those word correctly.

    carry_initial_prompt: bool
        If carry_initial_prompt is True, `initial_prompt` is prepended to the prompt of each internal
        `decode()` call. If there is not enough context space at the start of the prompt, it is
        left-sliced to make space.

    decode_options: dict
        Keyword arguments to construct `DecodingOptions` instances

    clip_timestamps: Union[str, List[float]]
        Comma-separated list start,end,start,end,... timestamps (in seconds) of clips to process.
        The last end timestamp defaults to the end of the file.

    hallucination_silence_threshold: Optional[float]
        When word_timestamps is True, skip silent periods longer than this threshold (in seconds)
        when a possible hallucination is detected

    Returns
    -------
    A dictionary containing the resulting text ("text") and segment-level details ("segments"), and
    the spoken language ("language"), which is detected when `decode_options["language"]` is None.
    Úfp16TÚcpuz2Performing inference on CPU when CUDA is availablez0FP16 is not supported on CPU; using FP32 insteadF)ÚpaddingéÿÿÿÿÚlanguageNÚenz]Detecting language using up to the first 30 seconds. Use `--language` to specify the language)ÚkeyzDetected language: ÚtaskÚ
transcribe)Únum_languagesr<   r?   ú,r   é   r   u*   "'â€œÂ¿([{-"'.ã€‚,ï¼Œ!ï¼�?ï¼Ÿ:ï¼šâ€�)]}ã€�Ú	translatez:Word-level timestamps on translations may not be reliable.ÚsegmentÚreturnc                 ó´  •— t        ‰t        t        f«      r‰gn‰}d }|D ]´  }i ‰¥}|dkD  r%|j                  dd «       |j                  dd «       n|j                  dd «       t	        di |¤d|i¤Ž}‰
j                  | |«      }d}‰�|j                  ‰kD  rd}‰	�|j                  ‰	k  rd}‰�"|j                  ‰kD  r‰	�|j                  ‰	k  rd}|rŒ³ |S  |S )	Nr   Ú	beam_sizeÚpatienceÚbest_ofr)   FT© )	Ú
isinstanceÚintÚfloatÚpopr   ÚdecodeÚcompression_ratioÚavg_logprobÚno_speech_prob)rE   ÚtemperaturesÚdecode_resultÚtÚkwargsÚoptionsÚneeds_fallbackr*   Údecode_optionsr+   r5   r,   r)   s          €€€€€€úg/home/mcse/projects/srt_converter/srt-converter-venv/lib/python3.12/site-packages/whisper/transcribe.pyÚdecode_with_fallbackz(transcribe.<locals>.decode_with_fallback¸   s  ø€ ä'¨´c¼5°\ÔBˆ[‰MÈð 	ð ˆàò  	ˆAØ'˜Ð'ˆFØ�1Šuà—
‘
˜;¨Ô-Ø—
‘
˜: tÕ,ð —
‘
˜9 dÔ+ä%Ñ>¨Ñ>¸AÒ>ˆGØ!ŸL™L¨°'Ó:ˆMà"ˆNà+Ð7Ø!×3Ñ3Ð6QÒQà!%�à!Ð-Ø!×-Ñ-Ð0AÒAà!%�à#Ð/Ø!×0Ñ0Ð3FÒFØ%Ð1Ø!×-Ñ-Ð0AÒAà!&�Ú!ØàÐðE 	ðD Ðó    ú ÚstartÚendÚtokensÚresultc           
      óò   •— |j                  «       }|D �cg c]  }|‰j                  k  sŒ|‘Œ }}‰| |‰j                  |«      ||j                  |j                  |j
                  |j                  dœ	S c c}w )N)	Úseekr_   r`   Útextra   r)   rR   rQ   rS   )ÚtolistÚeotrP   r)   rR   rQ   rS   )r_   r`   ra   rb   ÚtokenÚtext_tokensrd   Ú	tokenizers         €€r[   Únew_segmentztranscribe.<locals>.new_segmentö   s|   ø€ ð —‘“ˆØ*0ÖJ °E¸I¿M¹MÓ4I’uÐJˆÐJàØØØ×$Ñ$ [Ó1ØØ!×-Ñ-Ø!×-Ñ-Ø!'×!9Ñ!9Ø$×3Ñ3ñ

ð 
	
ùò Ks
   –A4«A4Úframes)ÚtotalÚunitÚdisabler   ÚpromptÚwordc                 ó’   — | j                  dd«      }| d   | d   z
  }d}|dk  r|dz  }|dk  r|d|z
  dz  z  }|d	kD  r||d	z
  z  }|S )
NÚprobabilityr   r`   r_   g333333Ã?r"   g /Ý$Á?é   ç       @)Úget)rq   rs   ÚdurationÚscores       r[   Úword_anomaly_scorez&transcribe.<locals>.word_anomaly_score<  sp   € Ø"Ÿh™h }°cÓ:�Ø ™;¨¨g©Ñ6�Ø�Ø Ò%Ø˜S‘L�EØ˜eÒ#Ø˜e hÑ.°"Ñ4Ñ4�EØ˜c’>Ø˜X¨™^Ñ+�EØ�r]   c                 ó´   •— | �| d   sy| d   D �cg c]  }|d   ‰vsŒ|‘Œ }}|d d }t        ˆfd„|D «       «      }|dk\  xs |dz   t        |«      k\  S c c}w )NÚwordsFrq   é   c              3   ó.   •K  — | ]  } ‰|«      –— Œ y ­w)NrK   )Ú.0Úwry   s     €r[   ú	<genexpr>z9transcribe.<locals>.is_segment_anomaly.<locals>.<genexpr>M  s   øè ø€ ÒA°aÑ.¨q×1ÑAùs   ƒé   g{®Gáz„?)ÚsumÚlen)rE   r   r{   rx   Úpunctuationry   s       €€r[   Úis_segment_anomalyz&transcribe.<locals>.is_segment_anomalyH  sr   ø€ Ø�?¨'°'Ò*:Ø Ø$+¨GÑ$4ÖU˜q¸¸&¹	ÈÒ8TšÐU�ÐUØ˜b˜q˜	�ÜÓA¸5ÔAÓA�Ø ‘zÒ? U¨T¡\´S¸³ZÑ%?Ð?ùò Vs
   ‘AžAÚsegmentsc                 ó(   — t        d„ | D «       d «      S )Nc              3   ó,   K  — | ]  }|d    sŒ	|–— Œ y­w)r{   NrK   )r~   Úss     r[   r€   z9transcribe.<locals>.next_words_segment.<locals>.<genexpr>Q  s   è ø€ Ò? 1°A°g³JœQÑ?ùs   ‚
�)Únext)r†   s    r[   Únext_words_segmentz&transcribe.<locals>.next_words_segmentP  s   € ÜÑ?¨Ô?ÀÓFÐFr]   éþÿÿÿ)r_   r`   ra   rb   )r†   r5   rj   ÚmelÚ
num_framesr1   r2   Úlast_speech_timestampr{   ru   re   ú[z --> z] Ú )r_   Úidg      à?)re   r†   r<   )Hrv   ÚtorchÚfloat16Úfloat32ÚdeviceÚcudaÚis_availableÚwarningsÚwarnr   ÚdimsÚn_melsr   Úshaper   rN   r
   r   Úis_multilingualÚprintr   ÚtoÚdetect_languageÚmaxr   Útitler   rA   rL   ÚstrÚsplitÚroundr	   rƒ   ÚappendÚlistÚzipÚTensorr   r   Ún_audio_ctxÚ
n_text_ctxÚencodeÚstripÚextendÚtqdmÚminÚtensorra   rS   rR   Údictr   Úboolr   ÚgeÚtimestamp_beginrf   ÚwhereÚadd_ÚitemÚnonzeroÚflattenr   r   Úranger   r   Ú	enumerater)   ÚupdaterP   )Yr5   r6   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   rZ   Údtyper�   Úcontent_framesÚcontent_durationÚmel_segmentÚ_Úprobsr<   r?   ÚtsÚseek_pointsÚ
seek_clipsr\   Úclip_idxÚinput_strideÚtime_precisionÚ
all_tokensÚall_segmentsÚprompt_reset_sinceÚremaining_prompt_lengthÚinitial_prompt_tokensrk   Úpbarr�   Úseek_clip_startÚseek_clip_endÚtime_offsetÚwindow_end_timeÚsegment_sizeÚsegment_durationÚnignoredÚremaining_promptrb   ra   Úshould_skipÚprevious_seekÚcurrent_segmentsr…   r‹   Útimestamp_tokensÚsingle_timestamp_endingÚconsecutiveÚslicesÚ
last_sliceÚcurrent_sliceÚsliced_tokensÚstart_timestamp_posÚend_timestamp_posÚlast_timestamp_posrw   Ú
timestampsÚlast_word_endÚ	thresholdÚremaining_durationÚfirst_segmentÚgapÚhal_last_endÚsirE   Únext_segmentÚhal_next_startÚsilence_beforeÚsilence_afterr_   r`   re   ÚlineÚirh   r„   rd   rj   ry   sY   `  ````        `                                                                     @@@@r[   r@   r@   &   s'  ÿù€ ðr ,×/Ñ/°¸Ô=ŒE�MŠMÄ5Ç=Á=€EØ‡|�|”u—|‘| EÓ*Ò*Ü�:‰:×"Ñ"Ô$Ü�M‰MÐNÔOØ”E—M‘MÒ!Ü�M‰MÐLÔMÜ—M‘MˆEà”—‘ÒØ!&ˆ�vÑô ˜e U§Z¡Z×%6Ñ%6Ä	Ô
J€CØ—Y‘Y˜r‘]¤XÑ-€NÜ˜^¬jÑ8¼;ÑFÓGÐà×Ñ˜* dÓ+Ð3Ø×$Ò$Ø)-ˆN˜:Ò&áÜØsôô & c¬8Ó4×7Ñ7¸¿¹ÓE×HÑHÈÓOˆKØ×,Ñ,¨[Ó9‰HˆAˆuÜ),¨U¸¿	¹	Ô)BˆN˜:Ñ&ØÐ"ÜØ)¬)°NÀ:Ñ4NÑ*O×*UÑ*UÓ*WÐ)XÐYôð # :Ñ.€HØ×"Ñ" 6¨<Ó8€DÜØ×ÑØ×)Ñ)ØØô	€Iô �/¤3Ô'á?N ×!6Ñ!6°sÔ!;ÐTVö
ØŒE�"�Ið
ˆð 
ð GVÖVÀœe BÔ):Ñ$:Õ;ÐV€KÐVÜ
ˆ;Ó˜1ÒØ×Ñ˜1ÔÜ
ˆ;Ó˜!Ñ˜qÒ Ø×Ñ˜>Ô*Ü(,¬S°¹S¸q¸SÑ1AÀ;ÈqÈtÐRSÈtÑCTÓ-UÓ(V€Jà@€Ká˜4 ;Ò.Ü�‰ÐRÔSð(¤e§l¡lð (´~÷ (ò (ðT €HØ�hÑ Ñ"€DÜÜ�%—*‘*×(Ñ(ó€Lð 	”zÑ!¤KÑ/ð ð €JØ€LØÐà#Ÿj™j×3Ñ3°qÑ8¸1Ñ<ÐØÐ!Ø )× 0Ñ 0°°~×7KÑ7KÓ7MÑ1MÓ NÐØ×ÑÐ/Ô0Ø¤3Ð'<Ó#=Ñ=Ñà "Ðð
Üð
Ü#ð
Ü-2¯\©\ð
ÜCQö
ô$ 
�‰Ø 8°WÀEÐ5Iô
ð tCà	Ø #Ðð
 œ˜Z›Ó(Ø-7¸Ñ-AÑ*ˆO˜]Ø�oÒ%Ø&�Ø�}Ò$Ø˜A‘�Øœc *›oÒ-Ø% hÑ/°Ñ2�DØÜ ¤zÑ 1´KÑ ?Ó@ˆKÜ# T¬H¡_¼
Ñ$BÄ[Ñ$PÓQˆOÜœx¨¸$Ñ)>ÀÐPTÑ@TÓUˆLØša ¨¨|Ñ(;Ð!;Ð;Ñ<ˆKØ+¬jÑ8¼;ÑFÐÜ% k´8Ó<×?Ñ?ÀÇÁÓM×PÑPÐQVÓWˆKá#ÜœsÐ#8Ó9Ð;MÓN�Ø#-¨h¨iÐ#8Ð:QÐ9QÐ9RÐ#SÐ Ø+@ÐCSÑ+S�˜xÒ(à+5Ð6HÐ6IÐ+J�˜xÑ(á%9¸+Ó%FˆFÜ—\‘\ &§-¡-Ó0ˆFà"Ð.à$×3Ñ3Ð6IÑI�à%Ð1Ø×*Ñ*Ð->Ò>ð #(�KáØ˜LÑ(�DÙà ˆMØ!Ðð
¬ð 
´%ó 
ð@¬H´T©Nð @¼tö @ðG¬T´$©Zð G¼HÄT¹Nó Gð .4¯Y©Y°y×7PÑ7PÓ-QÐØ&6°r°sÐ&;×&BÑ&BÓ&DÈÐPTÈÑ&UÐ#äŸ+™+Ð&6°s¸Ð&;Ð>NÈqÈrÐ>RÑ&RÓSÐTUÑVˆKØ×Ñ˜QÔÜ�;Ó !Ò#à$×+Ñ+Ó-�Ù*Ø—M‘M¤# f£+Ô.à�
Ø%+ò /�MØ$*¨:°mÐ$D�Mà% aÑ(×-Ñ-Ó/°)×2KÑ2KÑKð (ð & bÑ)×.Ñ.Ó0°9×3LÑ3LÑLð &ð %×+Ñ+Ù#Ø"-Ð0CÀnÑ0TÑ"TØ +Ð.?À.Ñ.PÑ PØ#0Ø#)ô	ôð "/‘Jð!/ñ$ +à˜LÑ(‘Dð ˜z¨A™~Ñ.×3Ñ3Ó5¸	×8QÑ8QÑQð 'ð Ð.°Ñ=Ñ=‘Dà+�Ø#Ð$4×$<Ñ$<Ó$>×$FÑ$FÓ$HÑI�
ä˜
“O aÒ'Ø" 2™×+Ñ+Ó-°×1JÑ1JÒJð # 2™×+Ñ+Ó-°	×0IÑ0IÑIð 'ð  2°NÑB�Hà ×'Ñ'ÙØ)Ø'¨(Ñ2Ø%Ø%ô	ôð ˜Ñ$�âÜ#Ø-ØØ'Ø#Ø+Ø)=Ø(;Ø*?õ	ñ /Ü$+Ð,<Ó$=�MØ$Ð0°]À[Ò5PÜ$ ]Ô5FÑ%FÓG˜ð 3Ñ>Ø ?�IÙ2Ü(/Ð0@Ó(A˜Ø(Ð4¸ÈÒ9TØ1@À=Ñ1PÐ.Ø1°IÒ=Ü',¨]Ô=NÑ-NÓ'O¡à'4°|Ñ'C ñ %7Ð7GÓ$H�MØ$Ð0Ñ5GÈÔ5VØ+¨GÑ4°{ÑB˜Ø š?Ø#0´5¸Ô?PÑ9PÓ3QÑ#Q˜DÙ$ð $9�LÜ#¤CÐ(8Ó$9Ó:ò 6˜Ø"2°2Ñ"6˜Ø& wÒ/Ø$Ù-¨gÔ6Ù+=Ø 0°°a±°Ð :ó,˜Lð  ,Ð7Ø1=¸gÑ1FÀqÑ1IÈ'Ñ1R¡à1<Ð?OÑ1O à '¨Ñ 0°<Ñ ?À)Ñ Kò !HØ#*¨7Ñ#3°iÑ#?ò!Hà#*¨7Ñ#3°kÑ#AÀCÑ#Gð +ð !/°¸±Ñ ?À)Ñ Kò !JÙ#5°lÓ#Cò!Jà#2°W¸U±^Ñ#CÀcÑ#Ið *ñ
  .±-Ü',Ü$'¨°a©¸ÀÑ9IÓ$JÜ&7ñ%8ó(" ð $4°g¸e±nÑ#DÀyÒ#PØ+9 DØ8:Ð 0°°Ð 5Ù %Ø'.¨u¡~™ð?6ôB !(Ð(8Ó 9�Ø Ð,Ø,9Ð)áØ/ò +�GØ'.¨wÑ'7¸À¹ÈÐQWÉ ˜3�EØÔ/°Ó6Ð7°uÔ=MÈcÓ=RÐ<SÐSUÐVZÐU[Ð\�DÜœ) D›/Õ*ð+ô (Ð(8Ó9ò *‘
��7Ø˜7Ñ# w¨u¡~Ò5¸À¹×9NÑ9NÓ9PÐTVÓ9VØ&(�G˜F‘OØ(*�G˜HÑ%Ø')�G˜GÒ$ð	*ð ×Ñô '0Ø(´°LÓ0Aô'÷á"˜˜7ð ˜1Ð( Ò(óôð ×ÑØ&6×V˜7ÀGÈHÑDUÒV¸5’ÐV�ÓVôñ .°×1CÑ1CÀcÒ1Iä%(¨£_Ð"ð �K‰Kœ˜N¨DÓ1°MÑAÔBðY œ˜Z›Ô(÷tCôl Ø×Ñ˜j¬Ð-BÓ)CÐ)EÐFÓGØØôð ùòk

ùò Wùó@
ùó W÷YtCð tCús>   Éj-É/j2ÐV%kæ:5kç/j7ç?kèj=è*Akê7këkc                  ó¢  ‡— ddl mŠ ˆfd„} t        j                  t        j                  ¬«      }|j                  ddt        d¬«       |j                  d	d
| d¬«       |j                  dt        d d¬«       |j                  dt        j                  j                  «       rdndd¬«       |j                  ddt        dd¬«       |j                  ddt        dg d¢d¬«       |j                  dt        d d!¬«       |j                  d"t        d#d#d$gd%¬«       |j                  d&t        d t        t        j                  «       «      t        t        j                  «       D �cg c]  }|j                  «       ‘Œ c}«      z   d'¬«       |j                  d(t         d)d*¬«       |j                  d+t"        d,d-¬«       |j                  d.t"        d,d/¬«       |j                  d0t         d d1¬«       |j                  d2t         d d3¬«       |j                  d4t        d5d6¬«       |j                  d7t        d d8¬«       |j                  d9t        d:d;¬«       |j                  d<t        d d=¬«       |j                  d>t        d d?¬«       |j                  d@t$        dAdB¬«       |j                  dCt$        dDdE¬«       |j                  dFt$        dGdH¬«       |j                  dIt$        dJdK¬«       |j                  dLt        d:dM¬«       |j                  dNt        dOdP¬«       |j                  dQt        dRdS¬«       |j                  dTt        d:dU¬«       |j                  dVt"        d dW¬«       |j                  dXt"        d dY¬«       |j                  dZt"        d d[¬«       |j                  d\t"        d)d]¬«       |j                  d^t        d_d`¬«       |j                  dat$        db¬c«       |j'                  «       j(                  }|j+                  dd«      }|j+                  de«      }|j+                  df«      }|j+                  dg«      }|j+                  dh«      }t-        j.                  |d ¬i«       |j1                  dj«      r/|dk   dlvr(|dk   �t3        j4                  |› dm|dk   › dn�«       do|dk<   |j+                  dp«      }	|j+                  dq«      x}
�!t7        t9        j:                  |	dr|
«      «      }	n|	g}	|j+                  ds«      x}d)kD  rt        j<                  |«       ddtl m}  ||||¬u«      }tA        ||«      }g dv¢}|dw   s"|D ]  }||   sŒ	|jC                  dx|› dy�«       Œ |dz   r|d{   st3        j4                  d|«       |d}   r|d{   rt3        j4                  d~«       |D �ci c]  }||j+                  |«      “Œ }}|j+                  d«      D ]  }	 tE        ||fdp|	i|¤Ž} |||fi |¤Ž Œ y c c}w c c}w # tF        $ rN}tI        jJ                  «        tM        d|› d€tO        |«      jP                  › d�t        |«      › �«       Y d }~Œ|d }~ww xY w)‚Nr   )Úavailable_modelsc                 ó€   •— |  ‰«       v st         j                  j                  | «      r| S t        d ‰«       › d�«      ‚)Nzmodel should be one of z or path to a model checkpoint)ÚosÚpathÚexistsÚ
ValueError)Únamerõ   s    €r[   Úvalid_model_namezcli.<locals>.valid_model_name  sB   ø€ ØÑ#Ó%Ñ%¬¯©¯©¸Ô)=ØˆKÜØ%Ñ&6Ó&8Ð%9Ð9WÐXó
ð 	
r]   )Úformatter_classr6   ú+zaudio file(s) to transcribe)ÚnargsÚtypeÚhelpz--modelÚturboz name of the Whisper model to use)Údefaultr   r  z--model_dirz>the path to save model files; uses ~/.cache/whisper by default)r   r  r  z--devicer—   r9   z#device to use for PyTorch inference)r  r  z--output_dirz-oú.zdirectory to save the outputsz--output_formatz-fÚall)ÚtxtÚvttÚsrtÚtsvÚjsonr  zSformat of the output file; if not specified, all available formats will be produced)r   r  Úchoicesr  z	--verboseTz4whether to print out the progress and debug messagesz--taskr@   rD   zawhether to perform X->X speech recognition ('transcribe') or X->English translation ('translate')z
--languagezHlanguage spoken in the audio, specify None to perform language detectionz--temperaturer   ztemperature to use for samplingz	--best_ofé   z<number of candidates when sampling with non-zero temperaturez--beam_sizezHnumber of beams in beam search, only applicable when temperature is zeroz
--patiencez”optional patience value to use in beam decoding, as in https://arxiv.org/abs/2204.05424, the default (1.0) is equivalent to conventional beam searchz--length_penaltyz…optional token length penalty coefficient (alpha) as in https://arxiv.org/abs/1609.08144, uses simple length normalization by defaultz--suppress_tokensz-1z„comma-separated list of token ids to suppress during sampling; '-1' will suppress most special characters except common punctuationsz--initial_promptz:optional text to provide as a prompt for the first window.z--carry_initial_promptFz{if True, prepend initial_prompt to every internal decode() call. May reduce the effectiveness of condition_on_previous_textz--condition_on_previous_textzÏif True, provide the previous output of the model as a prompt for the next window; disabling may make the text inconsistent across windows, but the model becomes less prone to getting stuck in a failure loopz--fp16z5whether to perform inference in fp16; True by defaultz#--temperature_increment_on_fallbackr    zhtemperature to increase when falling back when the decoding fails to meet either of the thresholds belowz--compression_ratio_thresholdr#   zUif the gzip compression ratio is higher than this value, treat the decoding as failedz--logprob_thresholdr$   zUif the average log probability is lower than this value, treat the decoding as failedz--no_speech_thresholdr!   zžif the probability of the <|nospeech|> token is higher than this value AND the decoding has failed due to `logprob_threshold`, consider the segment as silencez--word_timestampszQ(experimental) extract word-level timestamps and refine the results based on themz--prepend_punctuationsr%   zNif word_timestamps is True, merge these punctuation symbols with the next wordz--append_punctuationsr&   zRif word_timestamps is True, merge these punctuation symbols with the previous wordz--highlight_wordszT(requires --word_timestamps True) underline each word as it is spoken in srt and vttz--max_line_widthze(requires --word_timestamps True) the maximum number of characters in a line before breaking the linez--max_line_countzJ(requires --word_timestamps True) the maximum number of lines in a segmentz--max_words_per_linezk(requires --word_timestamps True, no effect with --max_line_width) the maximum number of words in a segmentz	--threadsz]number of threads used by torch for CPU inference; supercedes MKL_NUM_THREADS/OMP_NUM_THREADSz--clip_timestampsr'   z–comma-separated list start,end,start,end,... timestamps (in seconds) of clips to process, where the last end timestamp defaults to the end of the filez!--hallucination_silence_thresholdz‡(requires --word_timestamps True) skip silent periods longer than this threshold (in seconds) when a possible hallucination is detected)r   r  r5   Ú	model_dirÚ
output_dirÚoutput_formatr–   )Úexist_okz.enr<   >   r=   ÚEnglishz) is an English-only model but receipted 'z'; using English instead.r=   r)   Ú!temperature_increment_on_fallbackgzo ð?Úthreads)Ú
load_model)r–   Údownload_root)Úhighlight_wordsÚmax_line_countÚmax_line_widthÚmax_words_per_liner0   z--z  requires --word_timestamps Truer  r  z7--max_line_count has no effect without --max_line_widthr  z8--max_words_per_line has no effect with --max_line_widthz	Skipping z due to z: ))r‘   rõ   ÚargparseÚArgumentParserÚArgumentDefaultsHelpFormatterÚadd_argumentr¤   r“   r—   r˜   r   Úsortedr   Úkeysr   r£   rN   r   r   Ú
parse_argsÚ__dict__rO   r÷   ÚmakedirsÚendswithr™   rš   ÚtupleÚnpÚarangeÚset_num_threadsr  r   Úerrorr@   Ú	ExceptionÚ	tracebackÚ	print_excrŸ   r   Ú__name__)rü   ÚparserÚkÚargsÚ
model_namer  r  r  r–   r)   Ú	incrementr  r  r5   ÚwriterÚword_optionsÚoptionÚargÚwriter_argsÚ
audio_pathrb   Úerõ   s                         @r[   Úclir9    s  ø€ Ý"ô
ô ×$Ñ$´X×5[Ñ5[Ô\€FØ
×Ñ˜ s´Ð;XÐÔYØ
×Ñ˜	¨7Ð9IÐPrÐÔsØ
×Ñ˜¬C¸ð  EEÐô  FØ
×Ñ˜
´e·j±j×6MÑ6MÔ6O©FÐUZð  bGÐô  HØ
×Ñ˜¨´3ÀÐJiÐÔjØ
×ÑÐ)¨4´cÀ5ÒR}ð  EZÐô  [Ø
×Ñ˜¬(¸DÐG}ÐÔ~à
×Ñ˜¤s°LÈ<ÐYdÐJeð  mPÐô  QØ
×Ñ˜¬3¸ÄfÌYÏ^É^ÓM]ÓF^Ôagô  }M÷  }Rñ  }Ró  }Tö  iUÐwxÐij×ipÑipÕirò  iUó  bVñ  GVð  ]gÐô  hà
×Ñ˜¬e¸QÐEfÐÔgØ
×Ñ˜¬,Àð  IGÐô  HØ
×Ñ˜¬LÀ!ð  KUÐô  VØ
×Ñ˜¬5¸$ð  F\Ðô  ]Ø
×ÑÐ*´Àð  LSÐô  Tà
×ÑÐ+´#¸tð  KQÐô  RØ
×ÑÐ*´¸dð  JFÐô  GØ
×ÑÐ0´xÈð  VSÐô  Tà
×ÑÐ6¼XÈtð  [lÐô  mØ
×Ñ˜¤x¸ÐD{ÐÔ|à
×ÑÐ=ÄNÐ\_ð  gQÐô  RØ
×ÑÐ7¼nÐVYð  axÐô  yØ
×ÑÐ-´NÈDð  XoÐô  pØ
×ÑÐ/´nÈcð  YyÐô  zØ
×ÑÐ+´(ÀEð  QdÐô  eØ
×ÑÐ0´sÀOð  [kÐô  lØ
×ÑÐ/´cÐCfð  nBÐô  CØ
×ÑÐ+´(ÀEð  QgÐô  hØ
×ÑÐ*´Àtð  SzÐô  {Ø
×ÑÐ*´Àtð  S_Ðô  `Ø
×ÑÐ.´\È4ð  WDÐô  EØ
×Ñ˜¬,Àð  IhÐô  iØ
×ÑÐ+´#¸sð  JbÐô  cØ
×ÑÐ;Ä.ð  XaÐô  bð ×ÑÓ×'Ñ'€DØ—h‘h˜wÓ'€JØ—X‘X˜kÓ*€IØ—h‘h˜|Ó,€JØŸ™ /Ó2€MØ—(‘(˜8Ó$€FÜ‡K�K�
 TÕ*à×Ñ˜5Ô! d¨:Ñ&6Ð>OÑ&OØ�
ÑÐ'Ü�M‰MØ�,ÐGÈÈZÑHXÐGYÐYrÐsôð  ˆˆZÑà—(‘(˜=Ó)€KØ—X‘XÐAÓBÐBˆ	ÐOÜœBŸI™I k°:¸yÓIÓJ‰à"�mˆà—8‘8˜IÓ&Ð&ˆ¨!Ò+Ü×Ñ˜gÔ&åá�z¨&À	ÔJ€Eä˜ zÓ2€Fò€Lð Ð!Ò"Ø"ò 	LˆFØ�F‹|Ø—‘˜r & Ð)IÐJÕKð	Lð ÐÒ dÐ+;Ò&<Ü�‰ÐOÔPØÐ Ò! dÐ+;Ò&<Ü�‰ÐPÔQØ1=Ö>¨#�3˜Ÿ™ ›Ñ%Ð>€KÐ>Ø—h‘h˜wÓ'ò Pˆ
ð	PÜ  zÑS¸{ÐSÈdÑSˆFÙ�6˜:Ñ5¨Ó5ñPùòW iUùòT ?øô
 ò 	PÜ×ÑÔ!Ü�I˜j˜\¨´$°q³'×2BÑ2BÐ1CÀ2ÄcÈ!ÃfÀXÐN×OÑOûð	Pús%   Å!W-Ö!W2×W7×7	YØ AY	Ù	YÚ__main__)2r  r÷   r*  r™   Útypingr   r   r   r   r   Únumpyr%  r“   r°   r6   r	   r
   r   r   r   r   r   Údecodingr   r   Útimingr   rj   r   r   r   Úutilsr   r   r   r   r   r   r   r   r5   r   r¤   Úndarrayrª   r´   rN   r@   r9  r,  rK   r]   r[   ú<module>rA     sŽ  ðÛ Û 	Û Û ß >Õ >ã Û Û ÷÷ ñ ÷ 6Ý 'ß AÑ A÷	÷ 	ó 	ñ Ýð #Ø3QØ36Ø)-Ø+.Ø'+Ø$(Ø!&Ø!Ø .ØAØ/2Ø7;ò!\Øð\à��b—j‘j %§,¡,Ð.Ñ/ð\ð �d‰^ð	\ð
 �u˜e E¨3 JÑ/Ð/Ñ0ð\ð "*¨%¡ð\ð   ‘ð\ð " %™ð\ð !%ð\ð ˜S‘Mð\ð ð\ð ð\ð ð\ð ð\ð ˜3  U¡Ð+Ñ,ð\ð  &.¨e¡_ó!\ò~fPðR ˆzÒÙ…Eð r]   