o
    ¾e¦iË!  ã                   @   s\   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 
e¡ZG dd„ deƒZdgZd	S )
zFuyu model configurationé   )ÚPreTrainedConfig)ÚRopeParameters)Úloggingé   )ÚCONFIG_MAPPINGÚ
AutoConfigc                0       s,  e Zd ZdZdZdeiZdgZdZ						
																		d0de	dB de	dB de	dB de	dB de	dB de
dB de	dB de	dB d e	dB d!e	dB d"edB d#e	dB d$edB d%edB d&eee
ef B dB d'edB d(edB d)edB d*e	dB d+e	dB d,e	dB d-e	dB dedB f.‡ fd.d/„Z‡  ZS )1Ú
FuyuConfiga_  
    This is the configuration class to store the configuration of a [`FuyuForCausalLM`]. It is used to instantiate an
    Fuyu 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
    [adept/fuyu-8b](https://huggingface.co/adept/fuyu-8b).

    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 262144):
            Vocabulary size of the Fuyu model. Defines the number of different tokens that can be represented by the
            `inputs_ids` passed when calling [`FuyuForCausalLM`]
        hidden_size (`int`, *optional*, defaults to 4096):
            Dimension of the hidden representations.
        intermediate_size (`int`, *optional*, defaults to 16384):
            Dimension of the MLP representations.
        num_hidden_layers (`int`, *optional*, defaults to 36):
            Number of hidden layers in the Transformer encoder.
        num_attention_heads (`int`, *optional*, defaults to 64):
            Number of attention heads for each attention layer in the Transformer encoder.
        hidden_act (`str` or `function`, *optional*, defaults to `"relu2"`):
            The non-linear activation function (function or string) in the decoder.
        max_position_embeddings (`int`, *optional*, defaults to 16384):
            The maximum sequence length that this model might ever be used with.
        image_size (`int`, *optional*, defaults to 300):
            The input image size.
        patch_size (`int`, *optional*, defaults to 30):
            The input vision transformer encoding patch size.
        num_channels (`int`, *optional*, defaults to 3):
            The input image number of channels.
        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-05):
            The epsilon used by the rms normalization layers.
        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`. Whether to tie weight embeddings
        tie_word_embeddings (`bool`, *optional*, defaults to `False`):
            Whether to tie input and output embeddings.
        rope_parameters (`RopeParameters`, *optional*):
            Dictionary containing the configuration parameters for the RoPE embeddings. The dictionary should contain
            a value for `rope_theta` and optionally parameters used for scaling in case you want to use RoPE
            with longer `max_position_embeddings`.
        qk_layernorm (`bool`, *optional*, defaults to `True`):
            Whether or not to normalize the Queries and Keys after projecting the hidden states
        hidden_dropout (`float`, *optional*, defaults to 0.0):
            The dropout ratio after applying the MLP to the hidden states.
        attention_dropout (`float`, *optional*, defaults to 0.0):
            The dropout ratio after computing the attention scores.
        pad_token_id (`int`, *optional*):
            The id of the *padding* token.
        bos_token_id (`int`, *optional*, defaults to 1):
            The id of the *beginning-of-sequence* token.
        eos_token_id (`Union[int, list[int]]`, *optional*, defaults to 2):
            The id of the *end-of-sequence* token. Optionally, use a list to set multiple *end-of-sequence* tokens.
        image_token_id (`int`, *optional*, defaults to 71011):
            The id of the image placeholder token.
        text_config (`dict`, *optional*):
            Dictionary of configuration options used to initialize the `language``[`Aut`].

    ```python
    >>> from transformers import FuyuConfig

    >>> # Initializing a Fuyu fuyu-7b style configuration
    >>> configuration = FuyuConfig()
    ```ÚfuyuÚtext_configÚpast_key_valuesg     jØ@é   é   é @  é$   é@   Úrelu2é,  é   r   ç{®Gáz”?çñhãˆµøä>TFNç        é   r   éc Ú
vocab_sizeÚhidden_sizeÚintermediate_sizeÚnum_hidden_layersÚnum_attention_headsÚ
hidden_actÚmax_position_embeddingsÚ
image_sizeÚ
patch_sizeÚnum_channelsÚinitializer_rangeÚlayer_norm_epsÚ	use_cacheÚtie_word_embeddingsÚrope_parametersÚqk_layernormÚhidden_dropoutÚattention_dropoutÚpad_token_idÚbos_token_idÚeos_token_idÚimage_token_idc                    sB  |d u r>i d|“d|“d|“d|“d|“d|“d|“d|“d	|“d
|“d|“d|“d|“d|“d|“d|“d|“}t  d¡ | dd¡}t| di |¤Ž| _|| _|| _|| _|	| _|
| _	|| _
|| _|| _|| _|| _|| _|| _|| _|| _|| _|| _|| _|| _| dd¡ || _|| _|| _|| _tƒ jdi |¤Ž d S )Nr   r   r   r   r   r   r   r#   r$   r%   r'   r(   r)   r*   r+   r,   r-   zEtext_config is None. initializing the text model with default values.Ú
model_typeÚ	persimmonÚpartial_rotary_factorg      à?© )ÚloggerÚinfoÚgetr   r
   Ú_vocab_sizer   r    r!   r"   r   r   r   r   r   r#   r$   r%   r(   r)   r*   r.   r'   Ú
setdefaultr&   r+   r,   r-   ÚsuperÚ__init__)Úselfr   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r
   ÚkwargsÚtext_model_type©Ú	__class__r2   úi/home/ubuntu/transcripts/venv/lib/python3.10/site-packages/transformers/models/fuyu/configuration_fuyu.pyr9   d   s~   ÿþýüûúùø	÷
öõôóòñðï
zFuyuConfig.__init__)r   r   r   r   r   r   r   r   r   r   r   r   TFNTr   r   Nr   r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r/   r   Úsub_configsÚkeys_to_ignore_at_inferenceÚdefault_thetaÚintÚstrÚfloatÚboolr   Údictr9   Ú__classcell__r2   r2   r=   r?   r      s˜    Eèþýüûúùø	÷
öõôóòñðïîíìëêéèr   N)rC   Úconfiguration_utilsr   Úmodeling_rope_utilsr   Úutilsr   Úautor   r   Ú
get_loggerr@   r3   r   Ú__all__r2   r2   r2   r?   Ú<module>   s   
 
