§
    9²¸jP  ã                   óî   — d dl mZ ddlmZ ddlmZ ddlmZ ddlm	Z	m
Z
  ed¬	¦  «        e G d
„ de¦  «        ¦   «         ¦   «         Z ed¬	¦  «        e G d„ de¦  «        ¦   «         ¦   «         ZddgZdS )é    )Ústricté   )ÚPreTrainedConfig)Úauto_docstring)Úintervalé   )ÚCONFIG_MAPPINGÚ
AutoConfigznvidia/canary-1b-v2)Ú
checkpointc                   ój  ‡ — e Zd ZU dZdZdgZdZeed<   dZ	eed<   dZ
eed	<   d
Zeed<   d
Zeed<   d
Zeed<   dZeed<   dZeed<     edd¬¦  «        d¬¦  «        Zeed<   dZeed<   dZedz  ed<   dZedz  ed<   dZedz  ed<   dZeed <   dZeez  dz  ed!<   d"Zeed#<   dZeed$<   ˆ fd%„Zd&„ Zˆ xZS )'ÚCanaryDecoderConfiga®  
    ```python
    >>> from transformers import CanaryDecoderModel, CanaryDecoderConfig

    >>> # Initializing a CanaryDecoder canary_decoder-7b style configuration
    >>> configuration = CanaryDecoderConfig()

    >>> # Initializing a model from the canary_decoder-7b style configuration
    >>> model = CanaryDecoderModel(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```Úcanary_decoderÚpast_key_valuesé @  Ú
vocab_sizei   Úhidden_sizei   Úintermediate_sizeé   Únum_hidden_layersÚnum_attention_headsÚnum_key_value_headsÚreluÚ
hidden_actÚmax_position_embeddingsç        g      ð?)ÚminÚmaxç{®Gáz”?)ÚdefaultÚinitializer_rangeTÚ	use_cacher   NÚpad_token_idé   Úbos_token_idr   Úeos_token_idÚattention_biasÚattention_dropouté€   Úhead_dimÚis_encoder_decoderc                 ó–   •— | j         €| j        | j        z  | _         | j        €| j        | _         t	          ¦   «         j        di |¤Ž d S )N© )r)   r   r   r   ÚsuperÚ__post_init__©ÚselfÚkwargsÚ	__class__s     €ú/root/private/project/pallet_detection_v2/.venv/lib/python3.11/site-packages/transformers/models/canary/configuration_canary.pyr.   z!CanaryDecoderConfig.__post_init__B   sT   ø€ ØŒ=Ð Ø Ô,°Ô0HÑHˆDŒMØÔ#Ð+Ø'+Ô'?ˆDÔ$à�‰ŒÔÐ'Ð' Ð'Ð'Ð'Ð'Ð'ó    c                 ól   — | j         | j        z  dk    r t          d| j         › d| j        › d�¦  «        ‚dS )zOPart of `@strict`-powered validation. Validates the architecture of the config.r   zThe hidden size (z6) is not a multiple of the number of attention heads (ú).N)r   r   Ú
ValueError©r0   s    r3   Úvalidate_architecturez)CanaryDecoderConfig.validate_architectureJ   s[   € àÔ˜dÔ6Ñ6¸!Ò;Ð;Ýð7 DÔ$4ð 7ð 7ØÔ2ð7ð 7ð 7ñô ð ð <Ð;r4   ) Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
model_typeÚkeys_to_ignore_at_inferencer   ÚintÚ__annotations__r   r   r   r   r   r   Ústrr   r   r    Úfloatr!   Úboolr"   r$   r%   r&   r'   r)   r*   r.   r9   Ú__classcell__©r2   s   @r3   r   r      s¬  ø€ € € € € € ðð ð "€JØ#4Ð"5Ðà€J�ÐÐÑØ€K�ÐÐÑØ!Ð�sÐ!Ð!Ñ!ØÐ�sÐÐÑØ Ð˜Ð Ð Ñ Ø Ð˜Ð Ð Ñ Ø€J�ÐÐÑØ#'Ð˜SÐ'Ð'Ñ'Ø9˜x˜x¨C°SÐ9Ñ9Ô9À$ÐGÑGÔGÐ�uÐGÐGÑGØ€IˆtÐÐÑØ €L�#˜‘*Ð Ð Ñ Ø €L�#˜‘*Ð Ð Ñ Ø €L�#˜‘*Ð Ð Ñ Ø€N�DÐÐÑØ,/Ð�s˜U‘{ TÑ)Ð/Ð/Ñ/Ø€HˆcÐÐÑØ#Ð˜Ð#Ð#Ñ#ð(ð (ð (ð (ð (ðð ð ð ð ð ð r4   r   c                   ó  ‡ — e Zd ZU dZdZdgZeedœZdZ	e
ez  dz  ed<   dZe
ez  dz  ed<   dZeed	<   dZeed
<   dZeed<   dZedz  ed<   dZedz  ed<   dZedz  ed<   dZedz  ed<   dZeed<   dZeed<   ˆ fd„Zd„ Zd„ Zˆ xZS )ÚCanaryConfiga‹  
    encoder_config (`Union[dict, ParakeetEncoderConfig]`, *optional*):
        The config object or dictionary of the FastConformer encoder ([`ParakeetEncoderConfig`]).
    decoder_config (`Union[dict, CanaryDecoderConfig]`, *optional*):
        The config object or dictionary of the Transformer decoder ([`CanaryDecoderConfig`]).
    decoder_start_token_id (`int`, *optional*, defaults to 7):
        The token id that starts decoding (`<|startofcontext|>`, the first token of the multitask prompt).

    Example:

    ```python
    >>> from transformers import CanaryForConditionalGeneration, CanaryConfig

    >>> # Initializing a Canary configuration
    >>> configuration = CanaryConfig()

    >>> # Initializing a model from the configuration
    >>> model = CanaryForConditionalGeneration(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```
    Úcanaryr   )Úencoder_configÚdecoder_configNrJ   rK   Tr!   r*   Útie_word_embeddingsr   r"   r#   r$   r   r%   é   Údecoder_start_token_idr   r    r   r   c                 óä  •— t          | j        t          ¦  «        rK| j                             dd¦  «        | j        d<   t	          | j        d                  di | j        ¤Ž| _        n%| j        €t	          d         dddd¬¦  «        | _        t          | j        t          ¦  «        rt          di | j        ¤Ž| _        n| j        €t          ¦   «         | _         t          ¦   «         j        di |¤Ž d S )	Nr>   Úparakeet_encoderé    r(   Fr   )r   Únum_mel_binsÚscale_inputÚ	layerdropr,   )	Ú
isinstancerJ   ÚdictÚgetr	   rK   r   r-   r.   r/   s     €r3   r.   zCanaryConfig.__post_init__~   s  ø€ Ý�dÔ)­4Ñ0Ô0ð 		Ø04Ô0C×0GÒ0GÈÐVhÑ0iÔ0iˆDÔ Ñ-Ý"0°Ô1DÀ\Ô1RÔ"SÐ"jÐ"jÐVZÔViÐ"jÐ"jˆDÔÐØÔ Ð(Ý"0Ð1CÔ"DØ"$Ø Ø!Øð	#ñ #ô #ˆDÔõ �dÔ)­4Ñ0Ô0ð 	8Ý"5Ð"LÐ"L¸Ô8KÐ"LÐ"LˆDÔÐØÔ Ð(Ý"5Ñ"7Ô"7ˆDÔà�‰ŒÔÐ'Ð' Ð'Ð'Ð'Ð'Ð'r4   c                 óz   — | j         j        | j        k    r%t          d| j         j        › d| j        › d�¦  «        ‚d S )Nz$The decoder config vocabulary size (z4) does not match the Canary config vocabulary size (r6   )rK   r   r7   r8   s    r3   r9   z"CanaryConfig.validate_architecture‘   sZ   € ØÔÔ)¨T¬_Ò<Ð<Ýð?°tÔ7JÔ7Uð ?ð ?Ø+/¬?ð?ð ?ð ?ñô ð ð =Ð<r4   c                 ó   — | j         S )N)rK   )r0   Úargsr1   s      r3   Úget_text_configzCanaryConfig.get_text_config˜   s   € ØÔ"Ð"r4   )r:   r;   r<   r=   r>   r?   r
   r   Úsub_configsrJ   rV   r   rA   rK   r!   rD   r*   rL   r"   r@   r$   r%   rN   r    rC   r   r.   r9   r[   rE   rF   s   @r3   rH   rH   S   sZ  ø€ € € € € € ðð ð0 €JØ#4Ð"5ÐØ%/ÐCVÐWÐW€Kà59€N�DÐ+Ñ+¨dÑ2Ð9Ð9Ñ9Ø59€N�DÐ+Ñ+¨dÑ2Ð9Ð9Ñ9Ø€IˆtÐÐÑØ#Ð˜Ð#Ð#Ñ#Ø $Ð˜Ð$Ð$Ñ$Ø €L�#˜‘*Ð Ð Ñ Ø €L�#˜‘*Ð Ð Ñ Ø €L�#˜‘*Ð Ð Ñ Ø)*Ð˜C $™JÐ*Ð*Ñ*Ø#Ð�uÐ#Ð#Ñ#Ø€J�ÐÐÑð(ð (ð (ð (ð (ð&ð ð ð#ð #ð #ð #ð #ð #ð #r4   rH   N)Úhuggingface_hub.dataclassesr   Úconfiguration_utilsr   Úutilsr   Úutils.type_validatorsr   Úautor	   r
   r   rH   Ú__all__r,   r4   r3   ú<module>rc      s"  ðð( /Ð .Ð .Ð .Ð .Ð .à 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø #Ð #Ð #Ð #Ð #Ð #Ø -Ð -Ð -Ð -Ð -Ð -Ø -Ð -Ð -Ð -Ð -Ð -Ð -Ð -ð €Ð0Ð1Ñ1Ô1Øð2ð 2ð 2ð 2ð 2Ð*ñ 2ô 2ñ „ñ 2Ô1ð2ðj €Ð0Ð1Ñ1Ô1ØðD#ð D#ð D#ð D#ð D#Ð#ñ D#ô D#ñ „ñ 2Ô1ðD#ðN Ð0Ð
1€€€r4   