
    fTh)              	           S SK JrJr  S SKJr  S SKJrJrJr  \(       a
  SSK	J
r
JrJr   " S S\5      rSS\S	\S
\S\4S jjrS\S\S\4S jrS\S\\S      4S jrg)    )c_floatsizeof)Enum)TYPE_CHECKINGOptionalUnion   AutoFeatureExtractorAutoProcessorAutoTokenizerc                   0    \ rS rSr\r\S\4S j5       rSr	g)ParameterFormat   returnc                 ,    [        U R                  5      $ )zF
Number of byte required for this data type

Returns:
    Integer > 0
)r   value)selfs    O/var/www/auris/envauris/lib/python3.13/site-packages/transformers/onnx/utils.pysizeParameterFormat.size   s     djj!!     N)
__name__
__module____qualname____firstlineno__r   Floatpropertyintr   __static_attributes__r   r   r   r   r      s     E"c " "r   r   	dimensionfixed_dimensionnum_token_to_addr   c                     U S::  a  Un X-  n U $ )zM

Args:
    dimension:
    fixed_dimension:
    num_token_to_add:

Returns:

r   r   )r"   r#   r$   s      r    compute_effective_axis_dimensionr&   &   s     A~#	!Ir   num_parametersdtypec                     XR                   -  $ )a  
Compute the size taken by all the parameters in the given the storage format when serializing the model

Args:
    num_parameters: Number of parameters to be saved
    dtype: The data format each parameter will be saved

Returns:
    Size (in byte) taken to save all the parameters
)r   )r'   r(   s     r   "compute_serialized_parameters_sizer*   9   s     JJ&&r   
model_name)r   r   r   c                 n   SSK JnJnJn   UR                  " U 5      $ ! [
        [        [        4 a    Su  pE UR                  " U 5      nO! [        [        4 a     Of = f UR                  " U 5      nO! [        [        4 a     Of = fUb  Ub  [        SU  S35      eUc  Uc   gUb  Us $ Us $ f = f)a  
Gets a preprocessor (tokenizer, feature extractor or processor) that is available for `model_name`.

Args:
    model_name (`str`): Name of the model for which a preprocessor are loaded.

Returns:
    `Optional[Union[AutoTokenizer, AutoFeatureExtractor, AutoProcessor]]`:
        If a processor is found, it is returned. Otherwise, if a tokenizer or a feature extractor exists, it is
        returned. If both a tokenizer and a feature extractor exist, an error is raised. The function returns
        `None` if no preprocessor is found.
r	   r
   )NNNz&Couldn't auto-detect preprocessor for z1. Found both a tokenizer and a feature extractor.) r   r   r   from_pretrained
ValueErrorOSErrorKeyError)r+   r   r   r   	tokenizerfeature_extractors         r   get_preprocessorr4   G   s     FE%,,Z88* %'1$		%55jAI" 			 4 D DZ P" 		  %6%B8Duv  #4#<"$$)%sb    B4A
B4AB4AB4"A54B45BB4BB4(B4/B43B4N)r   )ctypesr   r   enumr   typingr   r   r   r-   r   r   r   r   r    r&   r*   strr4   r   r   r   <module>r9      s    #  1 1 EE"d " c ]` il &'s '? 'WZ '&% &%%8p2q)r &%r   