o
    hr                     @   sN   d Z ddlmZ ddlmZ ddlmZ eeZ	ddiZ
G dd	 d	eZd
S )z Llava model configuration   )PretrainedConfig)logging   )CONFIG_MAPPINGzllava-hf/llava-v1.5-7bzFhttps://huggingface.co/llava-hf/llava-v1.5-7b/resolve/main/config.jsonc                       s:   e Zd ZdZdZdZ									d fd
d	Z  ZS )LlavaConfiga	  
    This is the configuration class to store the configuration of a [`LlavaForConditionalGeneration`]. It is used to instantiate an
    Llava 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 Llava-9B.

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

    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 (`LlavaVisionConfig`,  *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`.
        ignore_index (`int`, *optional*, defaults to -100):
            The ignore index for the loss function.
        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.
        vision_feature_select_strategy (`str`, *optional*, defaults to `"default"`):
            The feature selection strategy used to select the vision feature from the CLIP backbone.
        vision_feature_layer (`int`, *optional*, defaults to -2):
            The index of the layer to select the vision feature.
        vocab_size (`int`, *optional*, defaults to 32000):
            Vocabulary size of the Llava model. Defines the number of different tokens that can be represented by the
            `inputs_ids` passed when calling [`~LlavaForConditionalGeneration`]

    Example:

    ```python
    >>> from transformers import LlavaForConditionalGeneration, LlavaConfig, CLIPVisionConfig, LlamaConfig

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

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

    >>> # Initializing a Llava llava-1.5-7b style configuration
    >>> configuration = LlavaConfig(vision_config, text_config)

    >>> # Initializing a model from the llava-1.5-7b style configuration
    >>> model = LlavaForConditionalGeneration(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```llavaFN }  geludefaultc	           
   
      s  || _ || _|| _|| _|| _|| _|| _t| jtr4d|v r#|d nd|d< t	|d  di || _n|d u rGt	d ddddddd	d
d| _| j| _|| _
t| j
trrd|v r\|d nd|d< t	|d  di || _
| j
j| _n
|d u r|t	d  | _
t jdi |	 d S )N
model_typeclip_vision_modeli   i      iP        r	   i   )intermediate_sizehidden_size
patch_size
image_sizenum_hidden_layersnum_attention_heads
vocab_sizeprojection_dimllama )ignore_indeximage_token_indexprojector_hidden_actvision_feature_select_strategyvision_feature_layerr   vision_config
isinstancedictr   text_configsuper__init__)
selfr!   r$   r   r   r   r   r    r   kwargs	__class__r   c/var/www/html/ai/venv/lib/python3.10/site-packages/transformers/models/llava/configuration_llava.pyr&   R   s>   
zLlavaConfig.__init__)NNr   r	   r
   r   r   r	   )__name__
__module____qualname____doc__r   is_compositionr&   __classcell__r   r   r)   r+   r      s    2r   N)r/   configuration_utilsr   utilsr   autor   
get_loggerr,   logger#LLAVA_PRETRAINED_CONFIG_ARCHIVE_MAPr   r   r   r   r+   <module>   s   
