a
    h                     @   sP   d 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VipLlava model configuration   )PretrainedConfig)logging   )CONFIG_MAPPING
AutoConfigc                       sJ   e Zd ZdZdZddiZeedZddddd	g d
df fdd	Z  Z	S )VipLlavaConfiga  
    This is the configuration class to store the configuration of a [`VipLlavaForConditionalGeneration`]. It is used to instantiate an
    VipLlava 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 VipLlava-9B.

    e.g. [ybelkada/vip-llava-7b-hf](https://huggingface.co/ybelkada/vip-llava-7b-hf)

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

    Args:
        vision_config (`VipLlavaVisionConfig`,  *optional*):
            Custom vision config or dict
        text_config (`Union[AutoConfig, dict]`, *optional*):
            The config object of the text backbone. Can be any of `LlamaConfig` or `MistralConfig`.
        image_token_index (`int`, *optional*, defaults to 32000):
            The image token index to encode the image prompt.
        projector_hidden_act (`str`, *optional*, defaults to `"gelu"`):
            The activation function used by the multimodal projector.
        projector_layernorm_eps (`float`, *optional*, defaults to 1e-05):
            The layer norm epsilon of the projector layernorm
        vision_feature_layers (`Union[int, list[int]]`, *optional*, defaults to `[-2, -5, -8, -11, 6]`):
            The vision feature layer, or list of layers to select the vision features from.
        image_seq_length (`int`, *optional*, defaults to 576):
            Sequence length of one image embedding.

    Example:

    ```python
    >>> from transformers import VipLlavaForConditionalGeneration, VipLlavaConfig, CLIPVisionConfig, LlamaConfig

    >>> # Initializing a CLIP-vision config
    >>> vision_config = CLIPVisionConfig()

    >>> # Initializing a Llama config
    >>> text_config = LlamaConfig()

    >>> # Initializing a VipLlava vipllava-7b style configuration
    >>> configuration = VipLlavaConfig(vision_config, text_config)

    >>> # Initializing a model from the vipllava-7b style configuration
    >>> model = VipLlavaForConditionalGeneration(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```ZvipllavaZimage_token_idimage_token_index)text_configvision_configN }  Zgelugh㈵>)ii   i@  c           	   
      s   || _ || _|| _|| _|| _|| _t| jtrZ|dd|d< t	|d  f i || _n&|d u rt	d ddddddd	d
d| _t|tr|dd|d< t	|d  f i |}n|d u rt	d  }|| _
t jf i | d S )N
model_typeZclip_vision_modeli   i      iP        r   i   )Zintermediate_sizeZhidden_sizeZ
patch_sizeZ
image_sizeZnum_hidden_layersZnum_attention_headsZ
vocab_sizeZprojection_dimllama)r   projector_hidden_actprojector_layernorm_epsvision_feature_layersimage_seq_lengthr
   
isinstancedictgetr   r	   super__init__)	selfr
   r	   r   r   r   r   r   kwargs	__class__ o/var/www/html/assistant/venv/lib/python3.9/site-packages/transformers/models/vipllava/configuration_vipllava.pyr   N   s6    

zVipLlavaConfig.__init__)
__name__
__module____qualname____doc__r   Zattribute_mapr   Zsub_configsr   __classcell__r!   r!   r   r"   r      s   /
r   N)r&   Zconfiguration_utilsr   utilsr   autor   r   Z
get_loggerr#   loggerr   __all__r!   r!   r!   r"   <module>   s   
b