
    o iR                        d dl Z d dlZd dlZd dlmZmZmZ d dlZd dlm	Z	 i dddddd	d
ddddddddddddddddddddddd d!d"d#d$d%d%d&Z
d'ee         fd(Zd) Zd* Z	 	 	 	 	 d<d,ed-ee         d.ed/ee         d0ee         d1eeeef                  fd2Z	 	 d=d4ed5ed6ed'efd7Z G d8 d9e	          Zd:ee         d'ee         fd;ZdS )>    N)ListOptionalUnion)tqdmztiny.enzSystran/faster-whisper-tiny.entinyzSystran/faster-whisper-tinyzbase.enzSystran/faster-whisper-base.enbasezSystran/faster-whisper-basezsmall.enzSystran/faster-whisper-small.ensmallzSystran/faster-whisper-smallz	medium.enz Systran/faster-whisper-medium.enmediumzSystran/faster-whisper-mediumzlarge-v1zSystran/faster-whisper-large-v1zlarge-v2zSystran/faster-whisper-large-v2zlarge-v3zSystran/faster-whisper-large-v3largezdistil-large-v2z&Systran/faster-distil-whisper-large-v2zdistil-medium.enz'Systran/faster-distil-whisper-medium.enzdistil-small.enz&Systran/faster-distil-whisper-small.enzdistil-large-v3z&Systran/faster-distil-whisper-large-v3zdistil-large-v3.5z$distil-whisper/distil-large-v3.5-ct2z,mobiuslabsgmbh/faster-whisper-large-v3-turbo)zlarge-v3-turboturboreturnc                  N    t          t                                                    S )z&Returns the names of available models.)list_MODELSkeys     T/var/www/html/auto_sub_bot/venv/lib/python3.11/site-packages/faster_whisper/utils.pyavailable_modelsr   "   s    r   c                      t           j                            t           j                            t           j                            t
                              d          S )z)Returns the path to the assets directory.assets)ospathjoindirnameabspath__file__r   r   r   get_assets_pathr   '   s4    7<<(A(ABBHMMMr   c                  *    t          j        d          S )zReturns the module logger.faster_whisper)logging	getLoggerr   r   r   
get_loggerr#   ,   s    -...r   F
size_or_id
output_dirlocal_files_only	cache_dirrevisionuse_auth_tokenc           	      `   t          j        d|           r| }n[t                              |           }|?t	          d| dd                    t                                                              g d}||t          |d}|
||d<   d	|d
<   |||d<   |||d<   t          j	        |fi |S )a|  Downloads a CTranslate2 Whisper model from the Hugging Face Hub.

    Args:
      size_or_id: Size of the model to download from https://huggingface.co/Systran
        (tiny, tiny.en, base, base.en, small, small.en, distil-small.en, medium, medium.en,
        distil-medium.en, large-v1, large-v2, large-v3, large, distil-large-v2,
        distil-large-v3), or a CTranslate2-converted model ID from the Hugging Face Hub
        (e.g. Systran/faster-whisper-large-v3).
      output_dir: Directory where the model should be saved. If not set, the model is saved in
        the cache directory.
      local_files_only:  If True, avoid downloading the file and return the path to the local
        cached file if it exists.
      cache_dir: Path to the folder where cached files are stored.
      revision: An optional Git revision id which can be a branch name, a tag, or a
            commit hash.
      use_auth_token: HuggingFace authentication token or True to use the
            token stored by the HuggingFace config folder.

    Returns:
      The path to the downloaded model.

    Raises:
      ValueError: if the model size is invalid.
    z.*/.*NzInvalid model size 'z', expected one of: z, )zconfig.jsonzpreprocessor_config.jsonz	model.binztokenizer.jsonzvocabulary.*)r&   allow_patterns
tqdm_classr(   	local_dirFlocal_dir_use_symlinksr'   token)
rematchr   get
ValueErrorr   r   disabled_tqdmhuggingface_hubsnapshot_download)	r$   r%   r&   r'   r(   r)   repo_idr+   kwargss	            r   download_modelr9   1   s    @ 
x*%% ++j))?*::tyy888:  
  N -(#	 F ({+0'('{!(w,W?????r   .secondsalways_include_hoursdecimal_markerc                     | dk    s
J d            t          | dz            }|dz  }||dz  z  }|dz  }||dz  z  }|dz  } || dz  z  }|s|dk    r|ddnd	}| |dd| d| |d
S )Nr   znon-negative timestamp expectedg     @@i6 i`  i  02d: 03d)round)r;   r<   r=   millisecondshoursminuteshours_markers          r   format_timestamprH   w   s    
 a<<<:<<<6)**LI%EEI%%Lf$GGf$$Le#GGeO#L&:Oeaiie?????RLVVVVwVVNVLVVVr   c                        e Zd Z fdZ xZS )r4   c                 D    d|d<    t                      j        |i | d S )NTdisable)super__init__)selfargsr8   	__class__s      r   rM   zdisabled_tqdm.__init__   s/     y$)&)))))r   )__name__
__module____qualname__rM   __classcell__)rP   s   @r   r4   r4      s8        * * * * * * * * *r   r4   segmentsc                 p    t          d t          |           D             | r| d         d         nd           S )Nc              3   V   K   | ]$}t          |d                    D ]}|d         V  %dS )wordsendN)reversed).0sws      r   	<genexpr>zget_end.<locals>.<genexpr>   s?      LLax'
7K7KLL!5LLLLLLLr   rY   )nextrZ   )rU   s    r   get_endra      sC    LL8H--LLL'1UT  r   )NFNNN)Fr:   )r!   r   r0   typingr   r   r   r5   	tqdm.autor   r   strr   r   r#   boolr9   floatrH   r4   dictra   r   r   r   <module>rh      s    				 				 ( ( ( ( ( ( ( ( ( (          /
) / )	
 1 + 3 - 1 1 1 . ? A ?  ?!" ?#$ E;'  . $s)        
N N N
/ / / !%"#"15C@ C@C@C@ C@ }	C@
 smC@ U39-.C@ C@ C@ C@P "'   		   .* * * * *D * * *d4j Xe_      r   