
    g                          d Z ddlZddlmZmZm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 de          Z G d de          ZdS )zFLAVA model configurations    N)AnyDictUnion   )PretrainedConfig)loggingc                        e Zd ZdZdZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d#dededededededededededededededef fdZe	de
eej        f         d d!fd"            Z xZS )$FlavaImageConfiga  
    This is the configuration class to store the configuration of a [`FlavaImageModel`]. It is used to instantiate an
    FLAVA 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 FLAVA
    [facebook/flava-full](https://huggingface.co/facebook/flava-full) 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 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" (i.e., feed-forward) layer in the Transformer encoder.
        hidden_act (`str` or `function`, *optional*, defaults to `"gelu"`):
            The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
            `"relu"`, `"selu"` and `"gelu_new"` are supported.
        hidden_dropout_prob (`float`, *optional*, defaults to 0.0):
            The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
        attention_probs_dropout_prob (`float`, *optional*, defaults to 0.0):
            The dropout ratio for the attention probabilities.
        initializer_range (`float`, *optional*, defaults to 0.02):
            The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
        layer_norm_eps (`float`, *optional*, defaults to 1e-12):
            The epsilon used by the layer normalization layers.
        image_size (`int`, *optional*, defaults to 224):
            The size (resolution) of each image.
        patch_size (`int`, *optional*, defaults to 16):
            The size (resolution) of each patch.
        num_channels (`int`, *optional*, defaults to 3):
            The number of input channels.
        qkv_bias (`bool`, *optional*, defaults to `True`):
            Whether to add a bias to the queries, keys and values.
        mask_token (`bool`, *optional*, defaults to `True`):
            Whether to use a mask token or not. Used in MIM (Masked Image Modeling) loss for FLAVA.
        vocab_size (`int`, *optional*, defaults to 8192):
            Vocabulary size of the [`FlavaImageCodebook`] used in conjunction with [`FlavaImageModel`] for 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         gelu        {Gz?-q=      r   T    hidden_sizenum_hidden_layersnum_attention_headsintermediate_size
hidden_acthidden_dropout_probattention_probs_dropout_probinitializer_rangelayer_norm_eps
image_size
patch_sizenum_channelsqkv_bias
mask_token
vocab_sizec                     t                      j        di | || _        || _        || _        || _        || _        || _        || _        || _	        |	| _
        |
| _        || _        || _        || _        || _        || _        d S N )super__init__r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   )selfr   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   kwargs	__class__s                    i/var/www/html/ai-engine/env/lib/python3.11/site-packages/transformers/models/flava/configuration_flava.pyr)   zFlavaImageConfig.__init__Z   s    & 	""6"""&!2#6 !2$#6 ,H)!2,$$( $$    pretrained_model_name_or_pathreturnr   c                 N   |                      |            | j        |fi |\  }}|                    d          dk    r|d         }d|v rMt          | d          r=|d         | j        k    r,t
                              d|d          d| j         d            | j        |fi |S )N
model_typeflavaimage_configYou are using a model of type   to instantiate a model of type N. This is not supported for all configurations of models and can yield errors._set_token_in_kwargsget_config_dictgethasattrr2   loggerwarning	from_dictclsr/   r+   config_dicts       r-   from_pretrainedz FlavaImageConfig.from_pretrained   s      (((1c12OZZSYZZV ??<((G33%n5K;&&73+E+E&+VbJcgjguJuJuNNr\1J r r>r r r  
 s}[33F333r.   )r   r   r   r   r   r   r   r   r   r   r   r   TTr   __name__
__module____qualname____doc__r2   intfloatboolr)   classmethodr   strosPathLikerC   __classcell__r,   s   @r-   r
   r
      sS       : :x %J !##%!% %(.1#' %!#% #%#% #% !	#%
 #% #% ##% ',#% !#% #% #% #% #% #% #%  !#% #% #% #% #% #%J 4E#r{BR<S 4bt 4 4 4 [4 4 4 4 4r.   r
   c                        e Zd ZdZdZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d$dededededededededededededededef fdZ	e
d eeej        f         d!d"fd#            Z xZS )%FlavaTextConfigaC  
    This is the configuration class to store the configuration of a [`FlavaTextModel`]. It is used to instantiate an
    FLAVA 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 FLAVA
    [facebook/flava-full](https://huggingface.co/facebook/flava-full) 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 30522):
            Vocabulary size of the BERT model. Defines the number of different tokens that can be represented by the
            `inputs_ids` passed when calling [`FlavaTextModel`].
        type_vocab_size (`int`, *optional*, defaults to 2):
            The vocabulary size of the `token_type_ids` passed when calling [`FlavaTextModel`]. Note that even though
            text encoder allows `token_type_ids`'s value as 2, for text-only pretraining and fine-tuning, only 1 is
            used similar to RoBERTa.
        max_position_embeddings (`int`, *optional*, defaults to 512):
            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). For VL, max_length passed to model is 77.
        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).
        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" (i.e., feed-forward) layer in the Transformer encoder.
        hidden_act (`str` or `function`, *optional*, defaults to `"gelu"`):
            The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
            `"relu"`, `"selu"` 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.
        initializer_range (`float`, *optional*, defaults to 0.02):
            The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
        layer_norm_eps (`float`, *optional*, defaults to 1e-12):
            The epsilon used by the layer normalization layers.
        image_size (`int`, *optional*, defaults to 224):
            The size (resolution) of each image.
        patch_size (`int`, *optional*, defaults to 16):
            The size (resolution) of each patch.
        num_channels (`int`, *optional*, defaults to 3):
            The number of input channels.
        qkv_bias (`bool`, *optional*, defaults to `True`):
            Whether to add a bias to the queries, keys and values.

    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:w        absoluter   r   r   r   r   r   r   r   Tr$   type_vocab_sizemax_position_embeddingsposition_embedding_typer   r   r   r   r   r   r   r   r   pad_token_idr"   c                     t                      j        di | || _        || _        || _        || _        || _        || _        || _        || _	        |	| _
        |
| _        || _        || _        || _        || _        || _        d S r&   )r(   r)   r$   rY   rZ   r[   r   r   r   r   r   r   r   r   r   r"   r\   )r*   r$   rY   rZ   r[   r   r   r   r   r   r   r   r   r   r\   r"   r+   r,   s                    r-   r)   zFlavaTextConfig.__init__   s    & 	""6"""$.'>$'>$&!2#6 !2$#6 ,H)!2, (r.   r/   r0   r   c                 N   |                      |            | j        |fi |\  }}|                    d          dk    r|d         }d|v rMt          | d          r=|d         | j        k    r,t
                              d|d          d| j         d            | j        |fi |S )Nr2   r3   text_configr5   r6   r7   r8   r@   s       r-   rC   zFlavaTextConfig.from_pretrained  s      (((1c12OZZSYZZV ??<((G33%m4K;&&73+E+E&+VbJcgjguJuJuNNr\1J r r>r r r  
 s}[33F333r.   )rU   rV   rW   rX   r   r   r   r   r   r   r   r   r   r   T)rE   rF   rG   rH   r2   rI   rM   rJ   rK   r)   rL   r   rN   rO   rC   rP   rQ   s   @r-   rS   rS      sU       E EN $J   '*'1!##%!% %(.1#' %!#) #)#) #) "%	#)
 "%#) #) #) !#) #) #) ##) ',#) !#) #) #)  !#) #) #) #) #) #)J 4E#r{BR<S 4bt 4 4 4 [4 4 4 4 4r.   rS   c                        e Zd ZdZdZ	 	 	 	 	 	 	 	 	 	 	 ddededededededededededef fdZe	de
eej        f         ddfd            Z xZS )FlavaMultimodalConfiga  
    This is the configuration class to store the configuration of a [`FlavaMultimodalModel`]. It is used to instantiate
    an FLAVA 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 FLAVA
    [facebook/flava-full](https://huggingface.co/facebook/flava-full) 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 6):
            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" (i.e., feed-forward) layer in the Transformer encoder.
        hidden_act (`str` or `function`, *optional*, defaults to `"gelu"`):
            The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
            `"relu"`, `"selu"` and `"gelu_new"` are supported.
        hidden_dropout_prob (`float`, *optional*, defaults to 0.0):
            The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
        attention_probs_dropout_prob (`float`, *optional*, defaults to 0.0):
            The dropout ratio for the attention probabilities.
        initializer_range (`float`, *optional*, defaults to 0.02):
            The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
        layer_norm_eps (`float`, *optional*, defaults to 1e-12):
            The epsilon used by the layer normalization layers.
        qkv_bias (`bool`, *optional*, defaults to `True`):
            Whether to add a bias to the queries, keys and values.
        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_modelr      r   r   r   r   r   r   Tr   r   r   r   r   r   r   r   r   r"   use_cls_tokenc                      t                      j        di | || _        || _        || _        || _        || _        || _        || _        || _	        |	| _
        |
| _        || _        d S r&   )r(   r)   r   r   r   r   r   r   r   r   r   r"   rd   )r*   r   r   r   r   r   r   r   r   r   r"   rd   r+   r,   s                r-   r)   zFlavaMultimodalConfig.__init__K  s~     	""6"""&!2#6 !2$#6 ,H)!2, *r.   r/   r0   r   c                 N   |                      |            | j        |fi |\  }}|                    d          dk    r|d         }d|v rMt          | d          r=|d         | j        k    r,t
                              d|d          d| j         d            | j        |fi |S )Nr2   r3   multimodal_configr5   r6   r7   r8   r@   s       r-   rC   z%FlavaMultimodalConfig.from_pretrainedh  s      (((1c12OZZSYZZV ??<((G33%&9:K;&&73+E+E&+VbJcgjguJuJuNNr\1J r r>r r r  
 s}[33F333r.   )r   rc   r   r   r   r   r   r   r   TTrD   rQ   s   @r-   ra   ra     s       2 2h *J !"#%!% #&,/#' %"+ ++ + !	+
 + + !+ '*+ !+ + + + + + + + +: 4E#r{BR<S 4bt 4 4 4 [4 4 4 4 4r.   ra   c                        e Zd ZdZ	 	 	 	 	 	 	 	 dd	ed
edededededef fdZedee	e
j        f         ddfd            Z xZS )FlavaImageCodebookConfigflava_image_codebook   r   rV      r   Tr   
num_groupsinput_channelsnum_blocks_per_groupr   r$   freezer   c                      t                      j        di | || _        || _        || _        || _        || _        || _        || _        d S r&   )	r(   r)   rm   rn   ro   r   r$   rp   r   )
r*   rm   rn   ro   r   r$   rp   r   r+   r,   s
            r-   r)   z!FlavaImageCodebookConfig.__init__  s]     	""6"""$,$8!&$!2r.   r/   r0   r   c                 N   |                      |            | j        |fi |\  }}|                    d          dk    r|d         }d|v rMt          | d          r=|d         | j        k    r,t
                              d|d          d| j         d            | j        |fi |S )Nr2   r3   image_codebook_configr5   r6   r7   r8   r@   s       r-   rC   z(FlavaImageCodebookConfig.from_pretrained  s      (((1c12OZZSYZZV ??<((G33%&=>K;&&73+E+E&+VbJcgjguJuJuNNr\1J r r>r r r  
 s}[33F333r.   )rk   r   rV   rl   r   Tr   )rE   rF   rG   r2   rI   rJ   r)   rL   r   rM   rN   rO   rC   rP   rQ   s   @r-   ri   ri   {  s        'J)Z $%#'3 33 3 "	3
 3 3 3 !3 3 3 3 3 3( 4E#r{BR<S 4bt 4 4 4 [4 4 4 4 4r.   ri   c            )       
    e Zd ZdZdZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d!deeef         deeef         deeef         deeef         dede	dede
de	de	dede	de	de	de	de	de	de
de
de
f( fdZededededefd             Z xZS )"FlavaConfiga  
    [`FlavaConfig`] is the configuration class to store the configuration of a [`FlavaModel`]. It is used to
    instantiate FLAVA model according to the specified arguments, defining the text model, image model, image codebook
    and multimodal model configs. Instantiating a configuration with the defaults will yield a similar configuration to
    that of the FLAVA [facebook/flava-full](https://huggingface.co/facebook/flava-full) architecture.

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

    Args:
        text_config (`dict`, *optional*):
            Dictionary of configuration options used to initialize [`FlavaTextConfig`].
        image_config (`dict`, *optional*):
            Dictionary of configuration options used to initialize [`FlavaImageConfig`].
        multimodal_config (`dict`, *optional*):
            Dictionary of configuration options used to initialize [`FlavaMultimodalConfig`].
        hidden_size (`int`, *optional*, defaults to 768):
            Dimensionality of the encoder layers and the pooler layer.
        layer_norm_eps (`float`, *optional*, defaults to 1e-12):
            The epsilon used by the layer normalization layers.
        projection_dim (`int`, *optional*, defaults to 512):
            Dimensionality of text and image projection layers.
        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.
        initializer_range (`float`, *optional*, defaults to 0.02):
            The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
        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

        kwargs (*optional*):
            Dictionary of keyword arguments.

    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
    ```
    r3   Nr   r   T/L
F@r         ?r4   r_   rg   rs   r   r   projection_diminit_codebooklogit_scale_init_valuer   ce_ignore_index
mim_weight
mlm_weightglobal_contrastive_weight
itm_weightmmm_image_weightmmm_text_weightglobal_backprop_contrastive skip_unmasked_multimodal_encoderreturn_lossc                 N   |                     dd           }|                     dd           }|                     dd           }|                     dd           } t                      j        di | ||i }t          di |                                }|                                D ]G\  }}||v r>|||         k    r2|dvr.||v r
d| d| d}nd	| d
}t                              |           H|                    |           ||i }t          di |                                }d|v r'd |d                                         D             |d<   |                                D ]G\  }}||v r>|||         k    r2|dvr.||v r
d| d| d}nd| d
}t                              |           H|                    |           ||i }t          di |                                }|                                D ]G\  }}||v r>|||         k    r2|dvr.||v r
d| d| d}nd| d
}t                              |           H|                    |           ||i }t          di |                                } |                                 D ]G\  }}||v r>|||         k    r2|dvr.||v r
d| d| d}nd| d
}t                              |           H|                    |            |i }t                              d           |i }t                              d           |i }t                              d           |i }t                              d           t          di || _        t          di || _        t          di || _        t          di || _        || _        || _        || _        || _        |
| _        |	| _        d| _        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _         d S )N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 r'   )rM   ).0keyvalues      r-   
<dictcomp>z(FlavaConfig.__init__.<locals>.<dictcomp>`  s1     2 2 2(2UCHHe2 2 2r.   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["zR`image_config` is `None`. initializing the `FlavaImageConfig` with default values.zP`text_config` is `None`. Initializing the `FlavaTextConfig` 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.rx   r'   )!popr(   r)   rS   to_dictitemsr=   infoupdater
   ra   ri   r4   r_   rg   rs   ry   rz   r   r   r   r{   initializer_factorr|   r}   r~   r   r   r   r   r   r   r   )"r*   r4   r_   rg   rs   r   r   ry   rz   r{   r   r|   r}   r~   r   r   r   r   r   r   r   r+   r   r   r   r   _text_config_dictr   r   message_image_config_dict_multimodal_config_dict_image_codebook_config_dictr,   s"                                    r-   r)   zFlavaConfig.__init__  s1   6 "::&8$??"JJ':DAA!',Dd!K!K%+ZZ0Ld%S%S"""6"""
 '"  !0 C C2B C C K K M M 05577 ) )
U+%%%;s3C*C*CSkHkHk...[ [ [<?[ [ [  P36P P P   KK((( 0111(#! "2!F!F4E!F!F!N!N!P!P///2 26H6T6Z6Z6\6\2 2 2":.
 16688 ) )
U,&&5L4E+E+E#UmJmJm///d d dEHd d d  U8;U U U   KK(((  2333!- ($&! '<&U&U>T&U&U&]&]&_&_# 6;;== ) )
U,,,!23!777#;;; 444s s sTWs s s  sVYs s s   KK((( $$%<===%1$,(*% +C*`*`E_*`*`*h*h*j*j' :??AA ) )
U000!6s!;;;#;;; 888' ' ']`' ' '  z]`z z z   KK((( "(()DEEELKKlmmmKKKjkkk$ "KKvwww ($&!KKu   -<<|<<*99[99!6!K!K9J!K!K%=%V%V@U%V%V",*&,!2&<#"%.$$)B&$ 0.+F(0P-&r.   c                      | d|                                 |                                 |                                 |                                 d|S )a&  
        Instantiate a [`FlavaConfig`] (or a derived class) from flava text model configuration, flava image model
        configuration, flava multimodal model and flava codebook model configuration.

        Returns:
            [`FlavaConfig`]: An instance of a configuration object
        )r4   r_   rg   rs   r'   )r   )rA   r4   r_   rg   rs   r+   s         r-   from_configszFlavaConfig.from_configs  sh    " s 
%--//#++--/7799"7"?"?"A"A	
 

 
 
 	
r.   )NNNNr   r   r   Trv   r   rw   rx   rx   rx   rx   rx   rx   TTT)rE   rF   rG   rH   r2   r   rM   r   rI   rJ   rK   r)   rL   r
   rS   ra   ri   r   rP   rQ   s   @r-   ru   ru     s       C CJ J (,&*,004 %!"(.#'#+."%!$,015 +H' H'38nH' #s(^H'  S>	H'
  $CH~H' H' H' H' H' !&H' !H' H' H' H' $)H'  !H'"  #H'$ %H'& &*'H'( +/)H'* +H' H' H' H' H' H'T 
&
 %
 1	

  8
 
 
 [
 
 
 
 
r.   ru   )rH   rN   typingr   r   r   configuration_utilsr   utilsr   
get_loggerrE   r=   r
   rS   ra   ri   ru   r'   r.   r-   <module>r      s{   !   				 # # # # # # # # # # 3 3 3 3 3 3       
	H	%	%t4 t4 t4 t4 t4' t4 t4 t4n4 4 4 4 4& 4 4 4Dd4 d4 d4 d4 d4, d4 d4 d4NR4 R4 R4 R4 R4/ R4 R4 R4ji
 i
 i
 i
 i
" i
 i
 i
 i
 i
r.   