§
    ‚Štj{I  ã                   óö  — d Z ddlmZ ddlmZ ddlmZ ddlmZm	Z	  e	j
        e¦  «        Z ed¬¦  «        e G d	„ d
e¦  «        ¦   «         ¦   «         Z ed¬¦  «        e G d„ de¦  «        ¦   «         ¦   «         Z ed¬¦  «        e G d„ de¦  «        ¦   «         ¦   «         Z ed¬¦  «        e G d„ de¦  «        ¦   «         ¦   «         Z ed¬¦  «        e G d„ de¦  «        ¦   «         ¦   «         Zg d¢ZdS )zFLAVA model configurationsé    )ÚAny)Ústricté   )ÚPreTrainedConfig)Úauto_docstringÚloggingzfacebook/flava-full)Ú
checkpointc                   óJ  — e Zd ZU dZdZd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z  ed<   dZeez  ed<   dZeed<   dZeed<   dZeee         z  eeef         z  ed<   dZeee         z  eeef         z  ed<   dZeed<   dZeed<   dZeed<   dZeed<   dS ) ÚFlavaImageConfigaT  
    mask_token (`bool`, *optional*, defaults to `True`):
        Whether to use a mask token or not. Used in MIM (Masked Image Modeling) loss for FLAVA.

    Example:

    ```python
    >>> from transformers import FlavaImageConfig, FlavaImageModel

    >>> # Initializing a FlavaImageModel with  style configuration
    >>> configuration = FlavaImageConfig()

    >>> # Initializing a FlavaImageModel model (with random weights) from the style configuration
    >>> model = FlavaImageModel(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```Úflava_image_modelÚimage_configé   Úhidden_sizeé   Únum_hidden_layersÚnum_attention_headsé   Úintermediate_sizeÚgeluÚ
hidden_actç        Úhidden_dropout_probÚattention_probs_dropout_probç{®Gáz”?Úinitializer_rangeçê-�™—q=Úlayer_norm_epséà   Ú
image_sizeé   Ú
patch_sizer   Únum_channelsTÚqkv_biasÚ
mask_tokené    Ú
vocab_sizeN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
model_typeÚbase_config_keyr   ÚintÚ__annotations__r   r   r   r   Ústrr   Úfloatr   r   r   r   ÚlistÚtupler!   r"   r#   Úboolr$   r&   © ó    úk/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/transformers/models/flava/configuration_flava.pyr   r      sP  € € € € € € ðð ð& %€JØ$€Oà€K�ÐÐÑØÐ�sÐÐÑØ!Ð˜Ð!Ð!Ñ!Ø!Ð�sÐ!Ð!Ñ!Ø€J�ÐÐÑØ'*Ð˜ ™Ð*Ð*Ñ*Ø03Ð  %¨#¡+Ð3Ð3Ñ3Ø#Ð�uÐ#Ð#Ñ#Ø!€N�EÐ!Ð!Ñ!Ø47€J��d˜3”i‘ %¨¨S¨¤/Ñ1Ð7Ð7Ñ7Ø46€J��d˜3”i‘ %¨¨S¨¤/Ñ1Ð6Ð6Ñ6Ø€L�#ÐÐÑØ€HˆdÐÐÑØ€J�ÐÐÑØ€J�ÐÐÑÐÐr5   r   c                   óò   — e Zd ZU dZdZd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<   dZeez  ed<   dZeez  ed<   dZeed<   dZeed<   dZedz  ed<   dZeed<   dS )ÚFlavaTextConfiga´  
    Example:

    ```python
    >>> from transformers import FlavaTextConfig, FlavaTextModel

    >>> # Initializing a FlavaTextModel with  style configuration
    >>> configuration = FlavaTextConfig()

    >>> # Initializing a FlavaTextModel model (with random weights) from the style configuration
    >>> model = FlavaTextModel(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```Úflava_text_modelÚtext_configi:w  r&   é   Útype_vocab_sizei   Úmax_position_embeddingsr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   NÚpad_token_idTr#   )r'   r(   r)   r*   r+   r,   r&   r-   r.   r<   r=   r   r   r   r   r   r/   r   r0   r   r   r   r>   r#   r3   r4   r5   r6   r8   r8   E   s  € € € € € € ðð ð  $€JØ#€Oà€J�ÐÐÑØ€O�SÐÐÑØ#&Ð˜SÐ&Ð&Ñ&Ø€K�ÐÐÑØÐ�sÐÐÑØ!Ð˜Ð!Ð!Ñ!Ø!Ð�sÐ!Ð!Ñ!Ø€J�ÐÐÑØ'*Ð˜ ™Ð*Ð*Ñ*Ø03Ð  %¨#¡+Ð3Ð3Ñ3Ø#Ð�uÐ#Ð#Ñ#Ø!€N�EÐ!Ð!Ñ!Ø €L�#˜‘*Ð Ð Ñ Ø€HˆdÐÐÑÐÐr5   r8   c                   óÂ   — e Zd ZU dZdZd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z  ed<   dZeez  ed<   dZeed<   dZeed<   dZeed<   dZeed<   dS )ÚFlavaMultimodalConfiga{  
    use_cls_token (`bool`, *optional*, defaults to `True`):
        Whether to use an extra CLS token for multimodal settings. Usually needed by the FLAVA model.

    Example:

    ```python
    >>> from transformers import FlavaMultimodalConfig, FlavaMultimodalModel

    >>> # Initializing a FlavaMultimodalModel with  style configuration
    >>> configuration = FlavaMultimodalConfig()

    >>> # Initializing a FlavaMultimodalModel model (with random weights) from the style configuration
    >>> model = FlavaMultimodalModel(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```Úflava_multimodal_modelÚmultimodal_configr   r   é   r   r   r   r   r   r   r   r   r   r   r   r   r   r   Tr#   Úuse_cls_tokenN)r'   r(   r)   r*   r+   r,   r   r-   r.   r   r   r   r   r/   r   r0   r   r   r   r#   r3   rD   r4   r5   r6   r@   r@   k   sæ   € € € € € € ðð ð& *€JØ)€Oà€K�ÐÐÑØÐ�sÐÐÑØ!Ð˜Ð!Ð!Ñ!Ø!Ð�sÐ!Ð!Ñ!Ø€J�ÐÐÑØ'*Ð˜ ™Ð*Ð*Ñ*Ø03Ð  %¨#¡+Ð3Ð3Ñ3Ø#Ð�uÐ#Ð#Ñ#Ø!€N�EÐ!Ð!Ñ!Ø€HˆdÐÐÑØ€M�4ÐÐÑÐÐr5   r@   c                   óv   — e Zd ZU d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S )ÚFlavaImageCodebookConfigas  
    num_groups (`int`, *optional*, defaults to 4):
        Number of groups to be created. This parameter as of now doesn't affect the model and is used for some
        internal calculation and estimations.
    num_blocks_per_group (`int`, *optional*, defaults to 2):
        Number of conv-based blocks per group.
    freeze (`bool`, defaults to `True`):
        Whether to freeze the weights of the model.

    Example:

    ```python
    >>> from transformers import FlavaImageCodebookConfig, FlavaImageCodebook

    >>> # Initializing a FlavaImageCodebook with style configuration
    >>> configuration = FlavaImageCodebookConfig()

    >>> # Initializing a FlavaImageCodebook model (with random weights) from the style configuration
    >>> model = FlavaImageCodebook(configuration)
    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```
    é   Ú
num_groupsr   Úinput_channelsr;   Únum_blocks_per_groupé   r   r%   r&   TÚfreezer   r   N)r'   r(   r)   r*   rH   r-   r.   rI   rJ   r   r&   rL   r3   r   r0   r4   r5   r6   rF   rF   ‘   s�   € € € € € € ðð ð0 €J�ÐÐÑØ€N�CÐÐÑØ !Ð˜#Ð!Ð!Ñ!Ø€K�ÐÐÑØ€J�ÐÐÑØ€FˆDÐÐÑØ#Ð�uÐ#Ð#Ñ#Ð#Ð#r5   rF   c                   óÚ  ‡ — e Zd ZU dZdZeeeedœZ	dZ
eeef         ez  dz  ed<   dZeeef         ez  dz  ed<   dZeeef         ez  dz  ed<   dZeeef         ez  dz  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<   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<   dZ%eed<   dZ&eed <   dZ'eed!<   ˆ fd"„Z(ˆ xZ)S )#ÚFlavaConfiga 
  
    image_config (`dict`, *optional*):
        Dictionary of configuration options used to initialize [`FlavaImageConfig`].
    multimodal_config (`dict`, *optional*):
        Dictionary of configuration options used to initialize [`FlavaMultimodalConfig`].
    image_codebook_config (`dict`, *optional*):
        Dictionary of configuration options used to initialize [`FlavaCodebookConfig`].
    init_codebook (`bool`, *optional*, defaults to `True`):
        Whether to initialize the codebook
    logit_scale_init_value (`float`, *optional*, defaults to 2.6592):
        The initial value of the *logit_scale* parameter. Default is used as per the original FLAVA/CLIP
        implementation.
    ce_ignore_index (`int`, *optional*, defaults to -100):
        Cross entropy index to ignore.
    mim_weight (`float`, *optional*, defaults to 1.0):
        Weight to be assigned to MIM (Masked Image Modeling) unimodal loss
    mlm_weight (`float`, *optional*, defaults to 1.0):
        Weight to be assigned to MLM (Masked Language Modeling) unimodal loss
    global_contrastive_weight (`float`, *optional*, defaults to 1.0):
        Weight to be assigned to global contrastive cross-alignment loss.
    itm_weight (`float`, *optional*, defaults to 1.0):
        Weight to be assigned to image-text matching multimodal loss.
    mmm_image_weight (`float`, *optional*, defaults to 1.0):
        Weight to be assigned to MMM loss's image part.
    mmm_text_weight (`float`, *optional*, defaults to 1.0):
        Weight to be assigned to MMM loss's text part.
    global_backprop_contrastive (`bool`, *optional*, defaults to `True`):
        Whether to use global backpropgation through all workers in contrastive loss.
    skip_unmasked_multimodal_encoder (`bool`, *optional*, defaults to `True`):
        Whether to skip running unmasked multimodal encoder whose outputs are not used by FLAVA losses.
    return_loss (`bool`, *optional*, defaults to `True`):
        Whether to return loss or not

    Example:

    ```python
    >>> from transformers import FlavaConfig, FlavaModel, FlavaForPreTraining

    >>> # Initializing a FlavaConfig with style configuration
    >>> configuration = FlavaConfig()

    >>> # Initializing a FlavaModel and FlavaForPreTraining model (with random weights) from the style configuration
    >>> model = FlavaModel(configuration)
    >>> model_pre = FlavaForPreTraining(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    >>> configuration_pre = model_pre.config
    ```
    Úflava)r:   r   rB   Úimage_codebook_configNr   r:   rB   rP   r   r   r   r   Úprojection_dimTÚinit_codebookgƒ/L¦
F@Úlogit_scale_init_valuer   r   iœÿÿÿÚce_ignore_indexg      ð?Ú
mim_weightÚ
mlm_weightÚglobal_contrastive_weightÚ
itm_weightÚmmm_image_weightÚmmm_text_weightÚglobal_backprop_contrastiveÚ skip_unmasked_multimodal_encoderÚreturn_lossÚtie_word_embeddingsÚinitializer_factorc                 óX	  •— | j         €i }t                               d¦  «         n;t          | j         t          ¦  «        r| j                              ¦   «         }n| j         }| j        €i }t                               d¦  «         n;t          | j        t          ¦  «        r| j                             ¦   «         }n| j        }| j        €i }t                               d¦  «         n;t          | j        t          ¦  «        r| j                             ¦   «         }n| j        }| j
        €i }t                               d¦  «         n;t          | j
        t          ¦  «        r| j
                             ¦   «         }n| j
        }|                     dd ¦  «        }|                     dd ¦  «        }|                     dd ¦  «        }|                     dd ¦  «        }	|�‘t	          di |¤Ž                     ¦   «         }
|
                     ¦   «         D ]I\  }}||v r@|||         k    r4|d	k    r.||v r
d
|› d|› d�}nd|› d�}t                               |¦  «         ŒJ|                     |
¦  «         |�¼t          di |¤Ž                     ¦   «         }d|v r'd„ |d                              ¦   «         D ¦   «         |d<   |                     ¦   «         D ]I\  }}||v r@|||         k    r4|d	k    r.||v r
d
|› d|› d�}nd|› d�}t                               |¦  «         ŒJ|                     |¦  «         |�‘t          di |¤Ž                     ¦   «         }|                     ¦   «         D ]I\  }}||v r@|||         k    r4|d	k    r.||v r
d
|› d|› d�}nd|› d�}t                               |¦  «         ŒJ|                     |¦  «         |	�‘t          di |	¤Ž                     ¦   «         }|                     ¦   «         D ]I\  }}||v r@|||         k    r4|d	k    r.||	v r
d
|› d|› d�}nd|› d�}t                               |¦  «         ŒJ|                     |¦  «         t	          di |¤Ž| _         t          di |¤Ž| _        t          di |¤Ž| _        t          di |¤Ž| _
         t          ¦   «         j        di |¤Ž d S )NzP`text_config` is `None`. Initializing the `FlavaTextConfig` with default values.zR`image_config` is `None`. initializing the `FlavaImageConfig` with default values.z\`multimodal_config` is `None`. Initializing the `FlavaMultimodalConfig` with default values.zc`image_codebook_config` is `None`. initializing the `FlavaImageCodebookConfig` with default values.Útext_config_dictÚimage_config_dictÚmultimodal_config_dictÚimage_codebook_config_dictÚtransformers_versionú`zp` is found in both `text_config_dict` and `text_config` but with different values. The value `text_config_dict["z"]` will be used instead.zk`text_config_dict` is provided which will be used to initialize `FlavaTextConfig`. The value `text_config["z"]` will be overridden.Úid2labelc                 ó4   — i | ]\  }}t          |¦  «        |“ŒS r4   )r/   )Ú.0ÚkeyÚvalues      r6   ú
<dictcomp>z-FlavaConfig.__post_init__.<locals>.<dictcomp>S  s1   € ð 2ð 2ð 2Ù(2¨¨U•C˜‘H”H˜eð2ð 2ð 2r5   zs` is found in both `image_config_dict` and `image_config` but with different values. The value `image_config_dict["zn`image_config_dict` is provided which will be used to initialize `FlavaImageConfig`. The value `image_config["z‚` is found in both `multimodal_config_dict` and `multimodal_config` but with different values. The value `multimodal_config_dict["z}`multimodal_config_dict` is provided which will be used to initialize `FlavaMultimodalConfig`. The value `multimodal_config["zŽ` is found in both `image_codebook_config_dict` and `image_codebook_config` but with different values. The value `image_codebook_config_dict["zˆ`image_codebook_config_dict` is provided which will be used to initialize `FlavaImageCodebookConfig`. The value `image_codebook_config["r4   )r:   ÚloggerÚinfoÚ
isinstancer8   Úto_dictr   r   rB   r@   rP   rF   ÚpopÚitemsÚupdateÚsuperÚ__post_init__)ÚselfÚkwargsr:   r   rB   rP   ra   rb   rc   rd   Ú_text_config_dictrj   rk   ÚmessageÚ_image_config_dictÚ_multimodal_config_dictÚ_image_codebook_config_dictÚ	__class__s                    €r6   ru   zFlavaConfig.__post_init__
  sc  ø€ ØÔÐ#ØˆKÝ�KŠKÐjÑkÔkÐkÐkÝ˜Ô(­/Ñ:Ô:ð 	+ØÔ*×2Ò2Ñ4Ô4ˆKˆKàÔ*ˆKàÔÐ$ØˆLÝ�KŠKÐlÑmÔmÐmÐmÝ˜Ô)Õ+;Ñ<Ô<ð 	-ØÔ,×4Ò4Ñ6Ô6ˆLˆLàÔ,ˆLàÔ!Ð)Ø "ÐÝ�KŠKÐvÑwÔwÐwÐwÝ˜Ô.Õ0EÑFÔFð 	7Ø $Ô 6× >Ò >Ñ @Ô @ÐÐà $Ô 6ÐàÔ%Ð-Ø$&Ð!Ý�KŠKØuñô ð ð õ ˜Ô2Õ4LÑMÔMð 	?Ø$(Ô$>×$FÒ$FÑ$HÔ$HÐ!Ð!à$(Ô$>Ð!ð "Ÿ:š:Ð&8¸$Ñ?Ô?ÐØ"ŸJšJÐ':¸DÑAÔAÐØ!'§¢Ð,DÀdÑ!KÔ!KÐØ%+§Z¢ZÐ0LÈdÑ%SÔ%SÐ"ð
 Ð'å /Ð CÐ CÐ2BÐ CÐ C× KÒ KÑ MÔ MÐð 0×5Ò5Ñ7Ô7ð )ð )‘
��UØ˜+Ð%Ð%¨%°;¸sÔ3CÒ*CÐ*CÈÐOeÒHeÐHeàÐ.Ð.Ð.ð[ ð [ð [Ø<?ð[ð [ð [ð  ˜ðPØ36ðPð Pð Pð  õ —K’K Ñ(Ô(Ð(øð ×ÒÐ0Ñ1Ô1Ð1àÐ(å!1Ð!FÐ!FÐ4EÐ!FÐ!F×!NÒ!NÑ!PÔ!PÐàÐ/Ð/Ð/ð2ð 2Ø6HÈÔ6T×6ZÒ6ZÑ6\Ô6\ð2ñ 2ô 2Ð" :Ñ.ð
 1×6Ò6Ñ8Ô8ð )ð )‘
��UØ˜,Ð&Ð&¨5°LÀÔ4EÒ+EÐ+EÈ#ÐQgÒJgÐJgàÐ/Ð/Ð/ðd ð dð dØEHðdð dð dð  ˜ðUØ8;ðUð Uð Uð  õ —K’K Ñ(Ô(Ð(øð ×ÒÐ 2Ñ3Ô3Ð3à!Ð-å&;Ð&UÐ&UÐ>TÐ&UÐ&U×&]Ò&]Ñ&_Ô&_Ð#ð 6×;Ò;Ñ=Ô=ð )ð )‘
��UØÐ+Ð+Ð+°Ð9JÈ3Ô9OÒ0OÐ0OÐTWÐ[qÒTqÐTqàÐ4Ð4Ð4ðs ð sð sØTWðsð sð sð  ˜ðsØVYðsð sð sð  õ —K’K Ñ(Ô(Ð(øð ×$Ò$Ð%<Ñ=Ô=Ð=à%Ð1å*BÐ*`Ð*`ÐE_Ð*`Ð*`×*hÒ*hÑ*jÔ*jÐ'ð :×?Ò?ÑAÔAð )ð )‘
��UàÐ0Ð0Ð0ØÐ!6°sÔ!;Ò;Ð;ØÐ5Ò5Ð5ð Ð8Ð8Ð8ð' ð 'ð 'Ø]`ð'ð 'ð 'ð  ˜ðzØ]`ðzð zð zð  õ —K’K Ñ(Ô(Ð(øð "×(Ò(Ð)DÑEÔEÐEõ +Ð9Ð9¨[Ð9Ð9ˆÔÝ,Ð<Ð<¨|Ð<Ð<ˆÔÝ!6Ð!KÐ!KÐ9JÐ!KÐ!KˆÔÝ%=Ð%VÐ%VÐ@UÐ%VÐ%VˆÔ"à�‰ŒÔÐ'Ð' Ð'Ð'Ð'Ð'Ð'r5   )*r'   r(   r)   r*   r+   r8   r   r@   rF   Úsub_configsr   Údictr/   r   r   r.   r:   rB   rP   r   r-   r   r0   rQ   rR   r3   rS   r   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   ru   Ú__classcell__)r}   s   @r6   rN   rN   µ   s&  ø€ € € € € € ð1ð 1ðf €Jà&Ø(Ø2Ø!9ð	ð €Kð >B€L�$�s˜C�x”.Ð#3Ñ3°dÑ:ÐAÐAÑAØ<@€K��c˜3�h”Ð"2Ñ2°TÑ9Ð@Ð@Ñ@ØBFÐ�t˜C ˜H”~Ð(8Ñ8¸4Ñ?ÐFÐFÑFØFJÐ˜4  S œ>Ð,<Ñ<¸tÑCÐJÐJÑJØ€K�ÐÐÑØ!€N�EÐ!Ð!Ñ!Ø€N�CÐÐÑØ€M�4ÐÐÑØ$*Ð˜EÐ*Ð*Ñ*Ø#Ð�uÐ#Ð#Ñ#Ø€O�SÐÐÑØ€J�ÐÐÑØ€J�ÐÐÑØ'*Ð˜uÐ*Ð*Ñ*Ø€J�ÐÐÑØ!Ð�eÐ!Ð!Ñ!Ø €O�UÐ Ð Ñ Ø(,Ð Ð,Ð,Ñ,Ø-1Ð$ dÐ1Ð1Ñ1Ø€K�ÐÐÑØ $Ð˜Ð$Ð$Ñ$Ø #Ð˜Ð#Ð#Ñ#ð^(ð ^(ð ^(ð ^(ð ^(ð ^(ð ^(ð ^(ð ^(r5   rN   )rN   rF   r   r@   r8   N)r*   Útypingr   Úhuggingface_hub.dataclassesr   Úconfiguration_utilsr   Úutilsr   r   Ú
get_loggerr'   rm   r   r8   r@   rF   rN   Ú__all__r4   r5   r6   ú<module>r‡      s  ðð !Ð  à Ð Ð Ð Ð Ð à .Ð .Ð .Ð .Ð .Ð .à 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,ð 
ˆÔ	˜HÑ	%Ô	%€ð €Ð0Ð1Ñ1Ô1Øð%ð %ð %ð %ð %Ð'ñ %ô %ñ „ñ 2Ô1ð%ðP €Ð0Ð1Ñ1Ô1Øð!ð !ð !ð !ð !Ð&ñ !ô !ñ „ñ 2Ô1ð!ðH €Ð0Ð1Ñ1Ô1Øð!ð !ð !ð !ð !Ð,ñ !ô !ñ „ñ 2Ô1ð!ðH €Ð0Ð1Ñ1Ô1Øð$ð $ð $ð $ð $Ð/ñ $ô $ñ „ñ 2Ô1ð$ðD €Ð0Ð1Ñ1Ô1Øðq(ð q(ð q(ð q(ð q(Ð"ñ q(ô q(ñ „ñ 2Ô1ðq(ðh vÐ
uÐ
u€€€r5   