Ë
    S^(h:  ã                   óŽ   — d Z ddlmZ ddlmZ  ej
                  e«      Z G d„ de«      Z G d„ de«      Z	 G d„ d	e«      Z
g d
¢Zy)zBridgeTower model configurationé   )ÚPretrainedConfig)Úloggingc                   ó@   ‡ — e Zd ZdZdZdZ	 	 	 	 	 	 	 	 	 	 dˆ fd„	Zˆ xZS )ÚBridgeTowerVisionConfigaÇ  
    This is the configuration class to store the vision configuration of a [`BridgeTowerModel`]. Instantiating a
    configuration with the defaults will yield a similar configuration to that of the bridgetower-base
    [BridgeTower/bridgetower-base](https://huggingface.co/BridgeTower/bridgetower-base/) architecture.

    Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
    documentation from [`PretrainedConfig`] for more information.

    Args:
        hidden_size (`int`, *optional*, defaults to 768):
            Dimensionality of the encoder layers and the pooler layer.
        num_hidden_layers (`int`, *optional*, defaults to 12):
            Number of hidden layers in visual encoder model.
        patch_size (`int`, *optional*, defaults to 16):
            The size (resolution) of each patch.
        image_size (`int`, *optional*, defaults to 288):
            The size (resolution) of each image.
        initializer_factor (`float`, *optional*, defaults to 1):
            A factor for initializing all weight matrices (should be kept to 1, used internally for initialization
            testing).
        layer_norm_eps (`float`, *optional*, defaults to 1e-05):
            The epsilon used by the layer normalization layers.
        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_configc                 ó°   •— t        ‰| �  di |¤Ž || _        || _        || _        || _        || _        || _        || _        || _	        |	| _
        |
| _        y ©N© )ÚsuperÚ__init__Úhidden_sizeÚnum_hidden_layersÚnum_channelsÚ
patch_sizeÚ
image_sizeÚinitializer_factorÚlayer_norm_epsÚstop_gradientÚshare_layernormÚremove_last_layer)Úselfr   r   r   r   r   r   r   r   r   r   ÚkwargsÚ	__class__s               €úw/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/models/bridgetower/configuration_bridgetower.pyr   z BridgeTowerVisionConfig.__init__F   sc   ø€ ô 	‰ÑÑ"˜6Ò"Ø&ˆÔØ!2ˆÔØ(ˆÔØ$ˆŒØ$ˆŒØ"4ˆÔØ,ˆÔØ*ˆÔØ.ˆÔØ!2ˆÕó    )
é   é   r   é   i   é   çñhãˆµøä>FTF©Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
model_typeÚbase_config_keyr   Ú__classcell__©r   s   @r   r   r      s?   ø„ ñ(ðT ,€JØ%€Oð ØØØØØØØØØ÷3ñ 3r   r   c                   óN   ‡ — e Zd ZdZdZdZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dˆ fd„	Zˆ xZS )ÚBridgeTowerTextConfiga¤  
    This is the configuration class to store the text configuration of a [`BridgeTowerModel`]. The default values here
    are copied from RoBERTa. Instantiating a configuration with the defaults will yield a similar configuration to that
    of the bridgetower-base [BridegTower/bridgetower-base](https://huggingface.co/BridgeTower/bridgetower-base/)
    architecture.

    Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
    documentation from [`PretrainedConfig`] for more information.

    Args:
        vocab_size (`int`, *optional*, defaults to 50265):
            Vocabulary size of the text part of the model. Defines the number of different tokens that can be
            represented by the `inputs_ids` passed when calling [`BridgeTowerModel`].
        hidden_size (`int`, *optional*, defaults to 768):
            Dimensionality of the encoder layers and the pooler layer.
        num_hidden_layers (`int`, *optional*, defaults to 12):
            Number of hidden layers in the Transformer encoder.
        num_attention_heads (`int`, *optional*, defaults to 12):
            Number of attention heads for each attention layer in the Transformer encoder.
        intermediate_size (`int`, *optional*, defaults to 3072):
            Dimensionality of the "intermediate" (often named feed-forward) layer in the Transformer encoder.
        hidden_act (`str` or `Callable`, *optional*, defaults to `"gelu"`):
            The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
            `"relu"`, `"silu"` and `"gelu_new"` are supported.
        hidden_dropout_prob (`float`, *optional*, defaults to 0.1):
            The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
        attention_probs_dropout_prob (`float`, *optional*, defaults to 0.1):
            The dropout ratio for the attention probabilities.
        max_position_embeddings (`int`, *optional*, defaults to 514):
            The maximum sequence length that this model might ever be used with. Typically set this to something large
            just in case (e.g., 512 or 1024 or 2048).
        type_vocab_size (`int`, *optional*, defaults to 2):
            The vocabulary size of the `token_type_ids`.
        initializer_factor (`float`, *optional*, defaults to 1):
            A factor for initializing all weight matrices (should be kept to 1, used internally for initialization
            testing).
        layer_norm_eps (`float`, *optional*, defaults to 1e-05):
            The epsilon used by the layer normalization layers.
        position_embedding_type (`str`, *optional*, defaults to `"absolute"`):
            Type of position embedding. Choose one of `"absolute"`, `"relative_key"`, `"relative_key_query"`. For
            positional embeddings use `"absolute"`. For more information on `"relative_key"`, please refer to
            [Self-Attention with Relative Position Representations (Shaw et al.)](https://arxiv.org/abs/1803.02155).
            For more information on `"relative_key_query"`, please refer to *Method 4* in [Improve Transformer Models
            with Better Relative Position Embeddings (Huang et al.)](https://arxiv.org/abs/2009.13658).
        is_decoder (`bool`, *optional*, defaults to `False`):
            Whether the model is used as a decoder or not. If `False`, the model is used as an encoder.
        use_cache (`bool`, *optional*, defaults to `True`):
            Whether or not the model should return the last key/values attentions (not used by all models). Only
            relevant if `config.is_decoder=True`.

    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_configc                 ó  •— t        ‰| �  di |¤Ž || _        || _        || _        || _        || _        || _        || _        || _	        |	| _
        |
| _        || _        || _        || _        || _        || _        || _        || _        y r
   )r   r   Ú
vocab_sizer   r   Únum_attention_headsÚ
hidden_actr   Úintermediate_sizeÚhidden_dropout_probÚattention_probs_dropout_probÚmax_position_embeddingsÚtype_vocab_sizer   Úposition_embedding_typeÚ	use_cacheÚpad_token_idÚbos_token_idÚeos_token_id)r   r0   r   r   r1   r   r3   r2   r4   r5   r6   r7   r   r:   r;   r<   r8   r9   r   r   s                      €r   r   zBridgeTowerTextConfig.__init__£   sš   ø€ ô* 	‰ÑÑ"˜6Ò"à$ˆŒØ&ˆÔØ!2ˆÔØ#6ˆÔ Ø$ˆŒØ"4ˆÔØ!2ˆÔØ#6ˆÔ Ø,HˆÔ)Ø'>ˆÔ$Ø.ˆÔØ,ˆÔØ'>ˆÔ$Ø"ˆŒØ(ˆÔØ(ˆÔØ(ˆÕr   )iYÄ  r   r   r   r    i   Úgeluçš™™™™™¹?r>   i  r    r!   r    é    é   ÚabsoluteTr"   r*   s   @r   r,   r,   a   sT   ø„ ñ<ð| *€JØ#€Oð ØØØØØØØØ%(Ø #ØØØØØØ *Ø÷%')ñ ')r   r,   c                   óf   ‡ — e Zd ZdZdZeedœZ	 	 	 	 	 	 	 	 	 	 	 	 	 dˆ fd„	Ze	dedefd„«       Z
ˆ xZS )	ÚBridgeTowerConfiga~  
    This is the configuration class to store the configuration of a [`BridgeTowerModel`]. It is used to instantiate a
    BridgeTower model according to the specified arguments, defining the model architecture. Instantiating a
    configuration with the defaults will yield a similar configuration to that of the bridgetower-base
    [BridgeTower/bridgetower-base](https://huggingface.co/BridgeTower/bridgetower-base/) architecture.

    Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
    documentation from [`PretrainedConfig`] for more information.

    Args:
        share_cross_modal_transformer_layers (`bool`, *optional*, defaults to `True`):
            Whether cross modal transformer layers are shared.
        hidden_act (`str` or `function`, *optional*, defaults to `"gelu"`):
            The non-linear activation function (function or string) in the encoder and pooler.
        hidden_size (`int`, *optional*, defaults to 768):
            Dimensionality of the encoder layers and the pooler layer.
        initializer_factor (`float`, *optional*, defaults to 1):
            A factor for initializing all weight matrices (should be kept to 1, used internally for initialization
            testing).
        layer_norm_eps (`float`, *optional*, defaults to 1e-05):
            The epsilon used by the layer normalization layers.
        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.
        num_attention_heads (`int`, *optional*, defaults to 12):
            Number of attention heads for each attention layer in the Transformer encoder.
        num_hidden_layers (`int`, *optional*, defaults to 6):
            Number of hidden layers in the Transformer encoder.
        tie_word_embeddings (`bool`, *optional*, defaults to `False`):
            Whether to tie input and output embeddings.
        init_layernorm_from_vision_encoder (`bool`, *optional*, defaults to `False`):
            Whether to init LayerNorm from the vision encoder.
        text_config (`dict`, *optional*):
            Dictionary of configuration options used to initialize [`BridgeTowerTextConfig`].
        vision_config (`dict`, *optional*):
            Dictionary of configuration options used to initialize [`BridgeTowerVisionConfig`].

    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   c                 óª  •— |j                  dd «      }|j                  dd «      }t        ‰| �  di |¤Ž || _        || _        || _        || _        || _        || _        || _	        || _
        |	| _        |
| _        || _        |€i }t        j                  d«       |€i }t        j                  d«       t!        di |¤Ž| _        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   Ú$share_cross_modal_transformer_layersr2   r   r   r   Úshare_link_tower_layersÚlink_tower_typer1   r   Útie_word_embeddingsÚ"init_layernorm_from_vision_encoderÚloggerÚinfor,   r.   r   r   )r   rJ   r2   r   r   r   rK   rL   r1   r   rM   rN   r.   r   r   Ú_r   s                   €r   r   zBridgeTowerConfig.__init__  sÞ   ø€ ð$ �J‰JÐ)¨4Ó0ˆØ�J‰JÐ+¨TÓ2ˆä‰ÑÑ"˜6Ò"Ø4XˆÔ1Ø$ˆŒØ&ˆÔØ"4ˆÔØ,ˆÔØ'>ˆÔ$Ø.ˆÔØ#6ˆÔ Ø!2ˆÔØ#6ˆÔ Ø2TˆÔ/àÐØˆKÜ�K‰KÐpÔqàÐ ØˆMÜ�K‰KÐtÔuä0Ñ?°;Ñ?ˆÔÜ4ÑE°}ÑEˆÕr   r.   r   c                 óP   —  | d|j                  «       |j                  «       dœ|¤ŽS )zÇ
        Instantiate a [`BridgeTowerConfig`] (or a derived class) from BridgeTower text model configuration. Returns:
            [`BridgeTowerConfig`]: An instance of a configuration object
        rE   r   )Úto_dict)Úclsr.   r   r   s       r   Úfrom_text_vision_configsz*BridgeTowerConfig.from_text_vision_configs3  s,   € ñ Ðf˜{×2Ñ2Ó4ÀM×DYÑDYÓD[ÑfÐ_eÑfÐfr   )Tr=   r   r    r!   FÚaddr   é   FFNN)r#   r$   r%   r&   r'   r,   r   Úsub_configsr   ÚclassmethodrU   r)   r*   s   @r   rC   rC   Í   ss   ø„ ñ3ðj €JØ"7ÐJaÑb€Kð .2ØØØØØ %ØØØØ!Ø+0ØØõ+FðZ ðgØ/ðgØ@Wògó ôgr   rC   )rC   r,   r   N)r&   Úconfiguration_utilsr   Úutilsr   Ú
get_loggerr#   rO   r   r,   rC   Ú__all__r   r   r   ú<module>r^      s^   ðñ &å 3Ý ð 
ˆ×	Ñ	˜HÓ	%€ôF3Ð.ô F3ôRi)Ð,ô i)ôXogÐ(ô ogòd T�r   