§
    ãóÉj¤  ã                   óh   — d dl Z d dlZd dlZd dlZd dlmZ d dlmZmZ  G d„ de j	        ¦  «        Z
dS )é    N)ÚOptional)ÚACCEPTED_MODEL_TYPESÚ	ModelSpecc                   ó¼   — e Zd ZdZedej        dej        fd„¦   «         Zdej        de	fd„Z
	 	 	 dd	e	d
ee	         dee	         dede	f
d„Zej        d„ ¦   «         ZdS )Ú	Converterz Base class for model converters.ÚparserÚreturnc                 óÒ   — |                       ddd¬¦  «         |                       ddd¬¦  «         |                       d	dt          d
¬¦  «         |                       ddd¬¦  «         | S )z‡Adds common conversion options to the command line parser.

        Arguments:
          parser: Command line argument parser.
        z--output_dirTzOutput model directory.)ÚrequiredÚhelpz--vocab_mappingNz#Vocabulary mapping file (optional).)Údefaultr   z--quantizationzWeight quantization type.)r   Úchoicesr   z--forceÚ
store_truez=Force conversion even if the output directory already exists.)Úactionr   )Úadd_argumentr   )r   s    ú…/home/lighthouse/badge-speaker-benchmark/.benchmark-venv-community/lib64/python3.11/site-packages/ctranslate2/converters/converter.pyÚdeclare_argumentszConverter.declare_arguments   sª   € ð 	×ÒØ TÐ0Ið 	ñ 	
ô 	
ð 	
ð 	×ÒØ tÐ2Wð 	ñ 	
ô 	
ð 	
ð 	×ÒØØÝ(Ø,ð	 	ñ 	
ô 	
ð 	
ð 	×ÒØØØPð 	ñ 	
ô 	
ð 	
ð
 ˆó    Úargsc                 ó\   — |                       |j        |j        |j        |j        ¬¦  «        S )a  Helper function to call :meth:`ctranslate2.converters.Converter.convert`
        with the parsed command line options.

        Arguments:
          args: Namespace containing parsed arguments.

        Returns:
          Path to the output directory.
        )ÚvmapÚquantizationÚforce)ÚconvertÚ
output_dirÚvocab_mappingr   r   )Úselfr   s     r   Úconvert_from_argszConverter.convert_from_args(   s5   € ð �|Š|ØŒOØÔ#ØÔ*Ø”*ð	 ñ 
ô 
ð 	
r   NFr   r   r   r   c                 óð  — t           j                             |¦  «        r|st          d|z  ¦  «        ‚|                      ¦   «         }|€t          d¦  «        ‚|�|                     |¦  «         |                     ¦   «          |                     |¬¦  «         t           j                             |¦  «        rt          j
        |¦  «         t          j        |¦  «         |                     |¦  «         |S )a)  Converts the model to the CTranslate2 format.

        Arguments:
          output_dir: Output directory where the CTranslate2 model is saved.
          vmap: Optional path to a vocabulary mapping file that will be included
            in the converted model directory.
          quantization: Weight quantization scheme (possible values are: int8, int8_float32,
            int8_float16, int8_bfloat16, int16, float16, bfloat16, float32).
          force: Override the output directory if it already exists.

        Returns:
          Path to the output directory.

        Raises:
          RuntimeError: If the output directory already exists and :obj:`force`
            is not set.
          NotImplementedError: If the converter cannot convert this model to the
            CTranslate2 format.
        z;output directory %s already exists, use --force to overrideNz<This model is not supported by CTranslate2 or this converter)r   )ÚosÚpathÚexistsÚRuntimeErrorÚ_loadÚNotImplementedErrorÚregister_vocabulary_mappingÚvalidateÚoptimizeÚshutilÚrmtreeÚmakedirsÚsave)r   r   r   r   r   Ú
model_specs         r   r   zConverter.convert9   sý   € õ4 Œ7�>Š>˜*Ñ%Ô%ð 	¨eð 	ÝØMØññô ð ð
 —Z’Z‘\”\ˆ
ØÐÝ%ØNñô ð ð ÐØ×2Ò2°4Ñ8Ô8Ð8à×ÒÑÔÐØ×Ò¨ÐÑ6Ô6Ð6õ Œ7�>Š>˜*Ñ%Ô%ð 	&ÝŒM˜*Ñ%Ô%Ð%Ý
Œ�JÑÔÐØ�Š˜
Ñ#Ô#Ð#ØÐr   c                 ó   — t          ¦   «         ‚)N)r%   )r   s    r   r$   zConverter._loadk   s   € å!Ñ#Ô#Ð#r   )NNF)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚstaticmethodÚargparseÚArgumentParserr   Ú	NamespaceÚstrr   r   Úboolr   ÚabcÚabstractmethodr$   © r   r   r   r      sí   € € € € € Ø*Ð*àð (Ô"9ð ¸hÔ>Uð ð ð ñ „\ðð2
 hÔ&8ð 
¸Sð 
ð 
ð 
ð 
ð( #Ø&*Øð0ð 0àð0ð �sŒmð0ð ˜s”mð	0ð
 ð0ð 
ð0ð 0ð 0ð 0ðd 	Ôð$ð $ñ Ôð$ð $ð $r   r   )r9   r4   r    r)   Útypingr   Úctranslate2.specs.model_specr   r   ÚABCr   r;   r   r   ú<module>r?      s“   ðØ 
€
€
€
Ø €€€Ø 	€	€	€	Ø €€€à Ð Ð Ð Ð Ð à HÐ HÐ HÐ HÐ HÐ HÐ HÐ Hðb$ð b$ð b$ð b$ð b$�”ñ b$ô b$ð b$ð b$ð b$r   