+
    n'Ïj¤  ã                   ól   € ^ RI t ^ RIt^ RIt^ RIt^ RIHt ^ RIHtHt  ! R R] P                  4      t
R# )é    N)ÚOptional)ÚACCEPTED_MODEL_TYPESÚ	ModelSpecc                   óŒ   a € ] tR t^t o Rt]V 3R lR l4       tV 3R lR ltRV 3R lR llt]	P                  R	 4       tR
tV tR# )Ú	Converterz Base class for model converters.c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# )é   ÚparserÚreturn)ÚargparseÚArgumentParser)ÚformatÚ__classdict__s   "€ÚZ/opt/data/cache/scratch/pip-target-lhm_ju4v/lib/python/ctranslate2/converters/converter.pyÚ__annotate__ÚConverter.__annotate__   s'   ø€ ÷ ñ ¡(×"9Ñ"9ð ¹h×>UÑ>Uñ ó    c                ó°   € V P                  RRRR7       V P                  RRRR7       V P                  R	R\        R
R7       V P                  RRRR7       V # )zoAdds 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   &r   Údeclare_argumentsÚConverter.declare_arguments   s‚   € ð 	×ÑØ TÐ0Ið 	ô 	
ð 	×ÑØ tÐ2Wð 	ô 	
ð 	×ÑØØÜ(Ø,ð	 	ô 	
ð 	×ÑØØØPð 	ô 	
ð
 ˆr   c                ó:   <€ V ^8„  d   QhRS[ P                  RS[/# )r	   Úargsr   )r   Ú	NamespaceÚstr)r   r   s   "€r   r   r   (   s!   ø€ ÷ 
ñ 
¡h×&8Ñ&8ð 
¹Sñ 
r   c                ó|   € V P                  VP                  VP                  VP                  VP                  R7      # )zÔ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_argsÚConverter.convert_from_args(   s:   € ð �|‰|Ø�O‰OØ×#Ñ#Ø×*Ñ*Ø—*‘*ð	 ó 
ð 	
r   Nc          
      óX   <€ V ^8„  d   QhRS[ RS[S[ ,          RS[S[ ,          RS[RS[ /# )r	   r'   r#   r$   r%   r   )r!   r   Úbool)r   r   s   "€r   r   r   9   sE   ø€ ÷ 0ñ 0áð0ñ ‘s�mð0ñ ™s•mð	0ñ
 ð0ñ 
ñ0r   c                óô  € \         P                  P                  V4      '       d   V'       g   \        RV,          4      hV P	                  4       pVf   \        R4      hVe   VP                  V4       VP                  4        VP                  VR7       \         P                  P                  V4      '       d   \        P                  ! V4       \         P                  ! V4       VP                  V4       V# )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 overridez<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&   ÚConverter.convert9   sÆ   € ô4 �7‰7�>‰>˜*×%Ò%¯eÜØMØõóð ð
 —Z‘Z“\ˆ
ØÒÜ%ØNóð ð ÒØ×2Ñ2°4Ô8à×ÑÔØ×Ñ¨ÐÔ6ô �7‰7�>‰>˜*×%Ò%Ü�MŠM˜*Ô%Ü
�Š�JÔØ�‰˜
Ô#ØÐr   c                ó   € \        4       h)N)r4   )r)   s   &r   r3   ÚConverter._loadk   s   € ä!Ó#Ð#r   © )NNF)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ústaticmethodr   r*   r&   ÚabcÚabstractmethodr3   Ú__static_attributes__Ú__classdictcell__)r   s   @r   r   r      sI   ø‡ € Ù*à÷ó ð÷2
ð 
÷"0ò 0ðd 	×Ññ$ó ö$r   r   )rG   r   r/   r8   Útypingr   Úctranslate2.specs.model_specr   r   ÚABCr   r@   r   r   Ú<module>rN      s)   ðÛ 
Û Û 	Û å ç Hôb$�—‘ö b$r   