� <��g�� �z�ddlZddlZddlZddlmZmZddlZddlZddlm Z idd�dd�dd �d d �d d �dd�dd�dd�dd�dd�dd�dd�dd�dd�dd �d!d"�d#d$�d%d$i�Z d&ee fd'�Z d(�Z d)�Z d9d+e d,ee d-ed.ee fd/�Z d:d1ed2ed3e d&e fd4�ZGd5�d6e ��Zd7eed&eefd8�ZdS);�N)�List�Optional)�tqdmztiny.enzSystran/faster-whisper-tiny.en�tinyzSystran/faster-whisper-tinyzbase.enzSystran/faster-whisper-base.en�basezSystran/faster-whisper-basezsmall.enzSystran/faster-whisper-small.en�smallzSystran/faster-whisper-smallz medium.enz Systran/faster-whisper-medium.en�mediumzSystran/faster-whisper-mediumzlarge-v1zSystran/faster-whisper-large-v1zlarge-v2zSystran/faster-whisper-large-v2zlarge-v3zSystran/faster-whisper-large-v3�largezdistil-large-v2z&Systran/faster-distil-whisper-large-v2zdistil-medium.enz'Systran/faster-distil-whisper-medium.enzdistil-small.enz&Systran/faster-distil-whisper-small.enzdistil-large-v3z&Systran/faster-distil-whisper-large-v3zlarge-v3-turboz,mobiuslabsgmbh/faster-whisper-large-v3-turbo�turbo�returnc�N�tt�����S)z&Returns the names of available models.)�list�_MODELS�keys���d/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/faster_whisper/utils.py�available_modelsr"s�� �� � ��� � �rc���tj�tj�tj�t ����d��S)z)Returns the path to the assets directory.�assets)�os�path�join�dirname�abspath�__file__rrr�get_assets_pathr's4�� �7�<�<����������(A�(A�B�B�H� M� M�Mrc�*�tjd��S)zReturns the module logger.�faster_whisper)�logging� getLoggerrrr� get_loggerr",s�� � �-� .� .�.rF� size_or_id� output_dir�local_files_only� cache_dirc �X�tjd|��r|}n[t�|��}|�?t d|�dd�t����������gd�}||td�}|� ||d<d |d <|�||d < tj |fi|��S#tj j tj jf$r[}t��}|�d ||��|�d ��d|d<tj |fi|��cYd}~Sd}~wwxYw)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. Returns: The path to the downloaded model. Raises: ValueError: if the model size is invalid. z.*/.*NzInvalid model size 'z', expected one of: z, )z config.jsonzpreprocessor_config.jsonz model.binztokenizer.jsonz vocabulary.*)r%�allow_patterns� tqdm_class� local_dirF�local_dir_use_symlinksr&zOAn error occured while synchronizing the model %s from the Hugging Face Hub: %szETrying to load the model directly from the local cache, if it exists.Tr%)�re�matchr�get� ValueErrorrr� disabled_tqdm�huggingface_hub�snapshot_download�utils�HfHubHTTPError�requests� exceptions�ConnectionErrorr"�warning) r#r$r%r&�repo_idr(�kwargs� exception�loggers r�download_modelr=1s���4 �x��*�%�%������+�+�j�)�)�� �?��*��:�:�t�y�y������8�8�8�:��� � ���N�-�(�#���F� ��(��{��+0��'�(���'��{��D��0��C�C�F�C�C�C����,���+� �D�D�D�������� ^� � � � � � ��� S� � � �&*��!�"��0��C�C�F�C�C�C�C�C�C�C�C�����D���s�B)�)%D)�AD$�D)�$D)�.�seconds�always_include_hours�decimal_markerc���|dks Jd���t|dz��}|dz}||dzz}|dz}||dzz}|dz}||dzz}|s|dkr|d�d�nd }|�|d�d|d�|�|d ��S) Nrznon-negative timestamp expectedg@�@i��6i`�i��02d�:��03d)�round)r?r@rA� milliseconds�hours�minutes� hours_markers r�format_timestamprL~s��� �a�<�<�<�:�<�<�<���6�)�*�*�L� �I� %�E��E�I�%�%�L��f�$�G��G�f�$�$�L��e�#�G��G�e�O�#�L�&:�O�e�a�i�i�e�?�?�?�?�?�R�L� �V��V�V�V�w�V�V�N�V�L�V�V�V�rc���eZdZ�fd�Z�xZS)r0c�D��d|d<t��j|i|��dS)NT�disable)�super�__init__)�self�argsr:� __class__s �rrQzdisabled_tqdm.__init__�s/��� ��y�������$�)�&�)�)�)�)�)r)�__name__� __module__� __qualname__rQ� __classcell__)rTs@rr0r0�s8�������*�*�*�*�*�*�*�*�*rr0�segmentsc�p�td�t|��D��|r|ddnd��S)Nc3�VK�|]$}t|d��D] }|dV�� �%dS)�words�endN)�reversed)�.0�s�ws r� <genexpr>zget_end.<locals>.<genexpr>�s?����L�L�a�x��'� �7K�7K�L�L�!��5��L�L�L�L�L�L�Lr�����r])�nextr^)rYs r�get_endre�sC�� �L�L�8�H�-�-�L�L�L�'�1��� �U���T� � �r)NFN)Fr>)r rr,�typingrrr1r5� tqdm.autorr�strrrr"�boolr=�floatrLr0�dictrerrr�<module>rls������� � � � � � � � �!�!�!�!�!�!�!�!��������������� � �/� � � )� ��/� � � )�  � �1�  �  � +�  ��3� � �-� ��1� ��1� ��1� � � .� ��?� ��A� ��?� � �?�! �"�D�# �$ � ;�% � ��, �$�s�)� � � � � N�N�N� /�/�/�!%�"�#� JD�JD��JD��� �JD��JD���}� JD�JD�JD�JD�^"'���� ������ � ����.*�*�*�*�*�D�*�*�*� �d�4�j��X�e�_������r
Memory