
    i                        d 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g dZy)zBridgeTower model configuration    )strict   )PreTrainedConfig)auto_docstringloggingzBridgeTower/bridgetower-base)
checkpointc                       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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z  ed<   dZeed<   dZeed<   dZeed<   dZeed<   y)BridgeTowerVisionConfiga  
    stop_gradient (`bool`, *optional*, defaults to `False`):
        Whether to stop gradient for training.
    share_layernorm (`bool`, *optional*, defaults to `True`):
        Whether LayerNorm layers are shared.
    remove_last_layer (`bool`, *optional*, defaults to `False`):
        Whether to remove the last layer from the vision encoder.

    Example:

    ```python
    >>> from transformers import BridgeTowerVisionConfig

    >>> # Initializing a BridgeTower BridgeTower/bridgetower-base style configuration for the vision model
    >>> configuration = BridgeTowerVisionConfig()

    >>> # Accessing the configuration
    >>> configuration
    ```bridgetower_vision_modelvision_config   hidden_size   num_hidden_layersr   num_channels   
patch_sizei   
image_size   initializer_factorh㈵>layer_norm_epsFstop_gradientTshare_layernormremove_last_layerN)__name__
__module____qualname____doc__
model_typebase_config_keyr   int__annotations__r   r   r   listtupler   r   floatr   r   boolr   r        /var/www/vps2.regionflexible.com/Desarrollo/venv/lib/python3.12/site-packages/transformers/models/bridgetower/configuration_bridgetower.pyr
   r
      s    ( ,J%OKsL#46Jd3i%S/1647Jd3i%S/17&''!NE!M4 OT #t#r)   r
   c                   F   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z  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dz  ed<   dZedz  ed<   dZeee   z  dz  ed<   dZeed <   d!Zeed"<   d!Zeed#<   y)$BridgeTowerTextConfiga2  
    Example:

    ```python
    >>> from transformers import BridgeTowerTextConfig

    >>> # Initializing a BridgeTower BridgeTower/bridgetower-base style configuration for the text model
    >>> configuration = BridgeTowerTextConfig()

    >>> # Accessing the configuration
    >>> configuration
    ```bridgetower_text_modeltext_configiY  
vocab_sizer   r   r   r   num_attention_headsr   r   i   intermediate_sizegelu
hidden_actg?hidden_dropout_probattention_probs_dropout_probi  max_position_embeddingstype_vocab_sizer   r   Npad_token_idr   bos_token_id   eos_token_idT	use_cacheF
is_decoderadd_cross_attention)r   r   r   r   r    r!   r/   r"   r#   r   r   r0   r   r&   r1   r3   strr4   r5   r6   r7   r   r8   r9   r;   r$   r<   r'   r=   r>   r(   r)   r*   r,   r,   ?   s     *J#OJKs!!&''!s!J'**03 %#+3#&S&OS!NE! L#*  L#* +,L#S	/D(,ItJ %%r)   r,   c                       e Zd ZU dZdZeedZ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
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  dz  e
d<   dZeez  dz  e
d<    fdZ xZS )BridgeTowerConfiga  
    share_cross_modal_transformer_layers (`bool`, *optional*, defaults to `True`):
        Whether cross modal transformer layers are shared.
    share_link_tower_layers (`bool`, *optional*, defaults to `False`):
        Whether the bride/link tower layers are shared.
    link_tower_type (`str`, *optional*, defaults to `"add"`):
        Type of the bridge/link layer.
    init_layernorm_from_vision_encoder (`bool`, *optional*, defaults to `False`):
        Whether to init LayerNorm from the vision encoder.

    Example:

    ```python
    >>> from transformers import BridgeTowerModel, BridgeTowerConfig

    >>> # Initializing a BridgeTower BridgeTower/bridgetower-base style configuration
    >>> configuration = BridgeTowerConfig()

    >>> # Initializing a model from the BridgeTower/bridgetower-base style configuration
    >>> model = BridgeTowerModel(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```bridgetower)r.   r   T$share_cross_modal_transformer_layersr2   r3   r   r   r   r   r   r   Fshare_link_tower_layersaddlink_tower_typer   r0      r   tie_word_embeddings"init_layernorm_from_vision_encoderNr.   r   c                     |j                  dd       }|j                  dd       }| j                  %t               | _        t        j	                  d       n4t        | j                  t              rt        di | j                  | _        | j                  %t               | _        t        j	                  d       n4t        | j                  t              rt        di | j                  | _        t        | (  di | y )Ntext_config_dictvision_config_dictzV`text_config` is `None`. initializing the `BridgeTowerTextConfig` with default values.zZ`vision_config` is `None`. initializing the `BridgeTowerVisionConfig` with default values.r(   )popr.   r,   loggerinfo
isinstancedictr   r
   super__post_init__)selfkwargs_	__class__s      r*   rS   zBridgeTowerConfig.__post_init__   s    JJ)40JJ+T2#46DKKpq(($/4Ht7G7GHD%!8!:DKKtu**D1!8!N4;M;M!ND''r)   )r   r   r   r   r    r,   r
   sub_configsrC   r'   r#   r3   r?   r   r"   r   r&   r   rD   rF   r0   r   rH   rI   r.   rQ   r   r   rS   __classcell__)rW   s   @r*   rA   rA   f   s    2 J"7JabK15($5JK&''!NE!$)T) OS !!s %%/4&426K((4/648M4**T18( (r)   rA   )rA   r,   r
   N)r   huggingface_hub.dataclassesr   configuration_utilsr   utilsr   r   
get_loggerr   rN   r
   r,   rA   __all__r(   r)   r*   <module>r_      s    & . 3 , 
		H	% 9:!$. !$  ;!$H 9:"&, "&  ;"&J 9:<(( <(  ;<(~ Tr)   