Ë
    T^(h)  ã            	       ó¬   — d dl mZmZ d dlmZ d dlmZmZmZ er
ddl	m
Z
mZmZ  G d„ de«      Zdded	ed
edefd„Zdededefd„Zdedeed      fd„Zy)é    )Úc_floatÚsizeof)ÚEnum)ÚTYPE_CHECKINGÚOptionalÚUnioné   ©ÚAutoFeatureExtractorÚAutoProcessorÚAutoTokenizerc                   ó&   — e Zd ZeZedefd„«       Zy)ÚParameterFormatÚreturnc                 ó,   — t        | j                  «      S )zf
        Number of byte required for this data type

        Returns:
            Integer > 0
        )r   Úvalue)Úselfs    úU/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/onnx/utils.pyÚsizezParameterFormat.size   s   € ô �d—j‘jÓ!Ð!ó    N)Ú__name__Ú
__module__Ú__qualname__r   ÚFloatÚpropertyÚintr   © r   r   r   r      s    „ Ø€Eàð"�cò "ó ñ"r   r   Ú	dimensionÚfixed_dimensionÚnum_token_to_addr   c                 ó   — | dk  r|} | |z  } | S )ze

    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                 ó    — | |j                   z  S )a7  
    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   € ð ˜EŸJ™JÑ&Ð&r   Ú
model_name)r   r   r   c                 ó`  — ddl m}m}m} 	  |j                  | «      S # t
        t        t        f$ r{ d\  }}	  |j                  | «      }n# t        t        f$ r Y nw xY w	  |j                  | «      }n# t        t        f$ r Y nw xY w|�|�t        d| › d�«      ‚|€|€Y y|�|cY S |cY S w xY w)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_preprocessorr0   G   sí   € ÷ FÑEð%Ø,ˆ}×,Ñ,¨ZÓ8Ð8øÜœ¤Ð*ò %Ø'1Ñ$ˆ	Ð$ð	Ø5˜×5Ñ5°jÓA‰IøÜœÐ"ò 	Ùð	úð	Ø DÐ 4× DÑ DÀZÓ PÑøÜœÐ"ò 	Ùð	úð Ð Ð%6Ð%BÜØ8¸¸ÐDuÐvóð ð ÐÐ#4Ð#<ÙØÐ"ØÒà$Ò$ð)%úsb   Œ žB-¸AÁ
B-ÁAÁB-ÁAÁB-Á!A4Á3B-Á4BÂB-ÂBÂB-Â"B-Â(B-Â,B-N)r   )Úctypesr   r   Úenumr   Útypingr   r   r   r)   r   r   r   r   r   r"   r&   Ústrr0   r   r   r   ú<module>r5      s†   ð÷ #Ý ß 1Ñ 1ñ ßEÑEô"�dô "ñ°ð Àcð Ð]`ð Ðiló ð&'°sð 'À?ð 'ÐWZó 'ð&% ð &%¨°%Ð8pÑ2qÑ)rô &%r   