ó
    qyüi{I  ã                   ób  • S r SSKJr  SSKJr  SSKJr  SSKJrJ	r	  \	R                  " \5      r\" SS9\ " S	 S
\5      5       5       r\" SS9\ " S S\5      5       5       r\" SS9\ " S S\5      5       5       r\" SS9\ " S S\5      5       5       r\" SS9\ " S S\5      5       5       r/ SQrg)zFLAVA model configurationsé    )ÚAny)Ústricté   )ÚPreTrainedConfig)Úauto_docstringÚloggingzfacebook/flava-full)Ú
checkpointc                   ó8  • \ rS rSr% SrSrSrSr\\	S'   Sr
\\	S'   Sr\\	S	'   S
r\\	S'   Sr\\	S'   Sr\\-  \	S'   Sr\\-  \	S'   Sr\\	S'   Sr\\	S'   Sr\\\   -  \\\4   -  \	S'   Sr\\\   -  \\\4   -  \	S'   Sr\\	S'   Sr\\	S'   Sr\\	S'   Sr\\	S'   S rg!)"ÚFlavaImageConfigé   a$  
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_size© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú
model_typeÚbase_config_keyr   ÚintÚ__annotations__r   r   r   r   Ústrr   Úfloatr   r   r   r    ÚlistÚtupler"   r#   r$   Úboolr%   r'   Ú__static_attributes__r(   ó    Új/home/mande/repo/quber/.venv/lib/python3.13/site-packages/transformers/models/flava/configuration_flava.pyr   r      sá   ‡ ñð& %€JØ$€Oà€K�ÓØÐ�sÓØ!Ð˜Ó!Ø!Ð�sÓ!Ø€J�ÓØ'*Ð˜ ™Ó*Ø03Ð  %¨#¡+Ó3Ø#Ð�uÓ#Ø!€N�EÓ!Ø47€J��d˜3‘i‘ %¨¨S¨¡/Ñ1Ó7Ø46€J��d˜3‘i‘ %¨¨S¨¡/Ñ1Ó6Ø€L�#ÓØ€HˆdÓØ€J�ÓØ€J�Ör8   r   c                   óø   • \ rS rSr% SrSrSrSr\\	S'   Sr
\\	S'   S	r\\	S
'   Sr\\	S'   Sr\\	S'   Sr\\	S'   Sr\\	S'   Sr\\	S'   Sr\\-  \	S'   Sr\\-  \	S'   Sr\\	S'   Sr\\	S'   Sr\S-  \	S'   Sr\\	S'   S rg)!ÚFlavaTextConfigéE   aŒ  
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'   r0   r1   r@   rA   r   r   r   r   r   r2   r   r3   r   r   r   rB   r$   r6   r7   r(   r8   r9   r;   r;   E   s²   ‡ ñð  $€JØ#€Oà€J�ÓØ€O�SÓØ#&Ð˜SÓ&Ø€K�ÓØÐ�sÓØ!Ð˜Ó!Ø!Ð�sÓ!Ø€J�ÓØ'*Ð˜ ™Ó*Ø03Ð  %¨#¡+Ó3Ø#Ð�uÓ#Ø!€N�EÓ!Ø €L�#˜‘*Ó Ø€HˆdÖr8   r;   c                   óÈ   • \ rS rSr% SrSrSrSr\\	S'   Sr
\\	S'   S	r\\	S
'   Sr\\	S'   Sr\\	S'   Sr\\-  \	S'   Sr\\-  \	S'   Sr\\	S'   Sr\\	S'   Sr\\	S'   Sr\\	S'   Srg)ÚFlavaMultimodalConfigék   aK  
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_tokenr(   N)r)   r*   r+   r,   r-   r.   r/   r   r0   r1   r   r   r   r   r2   r   r3   r   r   r   r$   r6   rI   r7   r(   r8   r9   rD   rD   k   s�   ‡ ñð& *€JØ)€Oà€K�ÓØÐ�sÓØ!Ð˜Ó!Ø!Ð�sÓ!Ø€J�ÓØ'*Ð˜ ™Ó*Ø03Ð  %¨#¡+Ó3Ø#Ð�uÓ#Ø!€N�EÓ!Ø€HˆdÓØ€M�4Ör8   rD   c                   ó|   • \ rS rSr% SrSr\\S'   Sr\\S'   Sr	\\S'   S	r
\\S
'   Sr\\S'   Sr\\S'   Sr\\S'   Srg)ÚFlavaImageCodebookConfigé‘   a+  
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   r(   N)r)   r*   r+   r,   r-   rN   r0   r1   rO   rP   r   r'   rR   r6   r   r3   r7   r(   r8   r9   rK   rK   ‘   sQ   ‡ ñð0 €J�ÓØ€N�CÓØ !Ð˜#Ó!Ø€K�ÓØ€J�ÓØ€FˆDÓØ#Ð�uÖ#r8   rK   c                   óÌ  ^ • \ rS rSr% SrSr\\\\	S.r
Sr\\\4   \-  S-  \S'   Sr\\\4   \-  S-  \S'   Sr\\\4   \-  S-  \S'   Sr\\\4   \-  S-  \S	'   S
r\\S'   Sr\\S'   S
r\\S'   Sr\\S'   Sr\\S'   Sr\\S'   Sr\\S'   Sr\\S'   Sr\\S'   Sr \\S'   Sr!\\S'   Sr"\\S'   Sr#\\S'   Sr$\\S'   Sr%\\S'   Sr&\\S '   Sr'\\S!'   Sr(\\S"'   U 4S# jr)S$r*U =r+$ )%ÚFlavaConfigéµ   aP	  
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   rG   Úimage_codebook_configNr   r>   rG   rW   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	  >• U R                   c  0 n[        R                  S5        OF[        U R                   [        5      (       a  U R                   R                  5       nOU R                   nU R                  c  0 n[        R                  S5        OF[        U R                  [        5      (       a  U R                  R                  5       nOU R                  nU R                  c  0 n[        R                  S5        OF[        U R                  [        5      (       a  U R                  R                  5       nOU R                  nU R                  c  0 n[        R                  S5        OF[        U R                  [        5      (       a  U R                  R                  5       nOU R                  nUR                  SS 5      nUR                  SS 5      nUR                  SS 5      nUR                  SS 5      n	Ub†  [	        S0 UD6R                  5       n
U
R                  5        HH  u  p¼X²;   d  M  XÂU   :w  d  M  US	:w  d  M  X¶;   a
  S
U SU S3nOSU S3n[        R                  U5        MJ     UR                  U
5        UbÁ  [        S0 UD6R                  5       nSU;   a5  US   R                  5        VVs0 s H  u  p¼[        U5      U_M     snnUS'   UR                  5        HH  u  p¼X³;   d  M  XÃU   :w  d  M  US	:w  d  M  X·;   a
  S
U SU S3nOSU S3n[        R                  U5        MJ     UR                  U5        Ub†  [        S0 UD6R                  5       nUR                  5        HH  u  p¼X´;   d  M  XÄU   :w  d  M  US	:w  d  M  X¸;   a
  S
U SU S3nOSU S3n[        R                  U5        MJ     UR                  U5        U	b†  [        S0 U	D6R                  5       nUR                  5        HH  u  p¼Xµ;   d  M  XÅU   :w  d  M  US	:w  d  M  X¹;   a
  S
U SU S3nOSU S3n[        R                  U5        MJ     UR                  U5        [	        S0 UD6U l         [        S0 UD6U l        [        S0 UD6U l        [        S0 UD6U l
        [         TU ]D  " S0 UD6  g s  snnf )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.Úid2labelzs` 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["r(   )r>   ÚloggerÚinfoÚ
isinstancer;   Úto_dictr   r   rG   rD   rW   rK   ÚpopÚitemsÚupdater2   ÚsuperÚ__post_init__)ÚselfÚkwargsr>   r   rG   rW   rh   ri   rj   rk   Ú_text_config_dictÚkeyÚvalueÚmessageÚ_image_config_dictÚ_multimodal_config_dictÚ_image_codebook_config_dictÚ	__class__s                    €r9   rw   ÚFlavaConfig.__post_init__
  sì  ø€ Ø×ÑÑ#ØˆKÜ�K‰KÐjÕkÜ˜×(Ñ(¬/×:Ñ:Ø×*Ñ*×2Ñ2Ó4‰Kà×*Ñ*ˆKà×ÑÑ$ØˆLÜ�K‰KÐlÕmÜ˜×)Ñ)Ô+;×<Ñ<Ø×,Ñ,×4Ñ4Ó6‰Là×,Ñ,ˆLà×!Ñ!Ñ)Ø "ÐÜ�K‰KÐvÕwÜ˜×.Ñ.Ô0E×FÑFØ $× 6Ñ 6× >Ñ >Ó @Ñà $× 6Ñ 6Ðà×%Ñ%Ñ-Ø$&Ð!Ü�K‰KØuõô ˜×2Ñ2Ô4L×MÑMØ$(×$>Ñ$>×$FÑ$FÓ$HÑ!à$(×$>Ñ$>Ð!ð "Ÿ:™:Ð&8¸$Ó?ÐØ"ŸJ™JÐ':¸DÓAÐØ!'§¡Ð,DÀdÓ!KÐØ%+§Z¡ZÐ0LÈdÓ%SÐ"ð
 Ñ'ä /Ñ CÐ2BÑ C× KÑ KÓ MÐð 0×5Ñ5Ö7‘
�ØÕ%¨%¸sÑ3CÕ*CÈÐOeÕHeàÓ.à ˜uð %<Ø<?¸5Ð@Yð[ñ  ð3Ø36°%Ð7NðPð  ô —K‘K Ö(ñ 8ð" ×ÑÐ0Ô1àÑ(ä!1Ñ!FÐ4EÑ!F×!NÑ!NÓ!PÐàÐ/Ó/à6HÈÑ6T×6ZÑ6ZÔ6\ô2Ú6\©
¨”C˜“H˜e’OÑ6\ò2Ð" :Ñ.ð
 1×6Ñ6Ö8‘
�ØÕ&¨5ÀÑ4EÕ+EÈ#ÐQgÕJgàÓ/à ˜uð %EØEHÀEÐIbðdñ  ð8Ø8;°uÐ<SðUð  ô —K‘K Ö(ñ 9ð" ×ÑÐ 2Ô3à!Ñ-ä&;Ñ&UÐ>TÑ&U×&]Ñ&]Ó&_Ð#ð 6×;Ñ;Ö=‘
�ØÕ+°È3Ñ9OÕ0OÐTWÐ[qÕTqàÓ4à ˜uð %TØTWÐSXÐXqðsñ  ðVØVYÐUZÐZqðsð  ô —K‘K Ö(ñ >ð" ×$Ñ$Ð%<Ô=à%Ñ1ä*BÑ*`ÐE_Ñ*`×*hÑ*hÓ*jÐ'ð :×?Ñ?ÖA‘
�àÕ0Ø°sÑ!;Õ;ØÐ5Õ5ð Ó8à ˜uð %]Ø]`Ð\að b'ð'ñ  ð]Ø]`Ð\aÐaxðzð  ô —K‘K Ö(ñ' Bð, "×(Ñ(Ð)DÔEô +Ñ9¨[Ñ9ˆÔÜ,Ñ<¨|Ñ<ˆÔÜ!6Ñ!KÐ9JÑ!KˆÔÜ%=Ñ%VÐ@UÑ%VˆÔ"ä‰ÒÑ' Ó'ùók2s   Ê7R&)rW   r   rG   r>   ),r)   r*   r+   r,   r-   r.   r;   r   rD   rK   Úsub_configsr   Údictr2   r   r   r1   r>   rG   rW   r   r0   r   r3   rX   rY   r6   rZ   r   r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   re   rf   rw   r7   Ú__classcell__)r�   s   @r9   rT   rT   µ   sd  ø‡ ñ1ðf €Jà&Ø(Ø2Ø!9ñ	€Kð >B€L�$�s˜C�x‘.Ð#3Ñ3°dÑ:ÓAØ<@€K��c˜3�h‘Ð"2Ñ2°TÑ9Ó@ØBFÐ�t˜C ˜H‘~Ð(8Ñ8¸4Ñ?ÓFØFJÐ˜4  S ™>Ð,<Ñ<¸tÑCÓJØ€K�ÓØ!€N�EÓ!Ø€N�CÓØ€M�4ÓØ$*Ð˜EÓ*Ø#Ð�uÓ#Ø€O�SÓØ€J�ÓØ€J�ÓØ'*Ð˜uÓ*Ø€J�ÓØ!Ð�eÓ!Ø €O�UÓ Ø(,Ð Ó,Ø-1Ð$ dÓ1Ø€K�ÓØ $Ð˜Ó$Ø #Ð˜Ó#÷^(ó ^(r8   rT   )rT   rK   r   rD   r;   N)r-   Útypingr   Úhuggingface_hub.dataclassesr   Úconfiguration_utilsr   Úutilsr   r   Ú
get_loggerr)   ro   r   r;   rD   rK   rT   Ú__all__r(   r8   r9   Ú<module>rŒ      s
  ðñ !å å .å 3ß ,ð 
×	Ò	˜HÓ	%€ñ Ð0Ñ1Øô%Ð'ó %ó ó 2ð%ñP Ð0Ñ1Øô!Ð&ó !ó ó 2ð!ñH Ð0Ñ1Øô!Ð,ó !ó ó 2ð!ñH Ð0Ñ1Øô$Ð/ó $ó ó 2ð$ñD Ð0Ñ1Øôq(Ð"ó q(ó ó 2ðq(òh v�r8   