
    gN                     j    d Z ddlmZ ddlmZ ddlmZ  ej        e          Z	 G d de          Z
dS )	zLlava model configuration   )PretrainedConfig)logging   )CONFIG_MAPPINGc                   <     e Zd ZdZdZdZ	 	 	 	 	 	 	 	 d fd	Z x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 (`Union[AutoConfig, dict]`,  *optional*, defaults to `CLIPVisionConfig`):
            The config object or dictionary of the vision backbone.
        text_config (`Union[AutoConfig, dict]`, *optional*, defaults to `LlamaConfig`):
            The config object or dictionary of the text backbone.
        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 vision backbone.
            Can be one of `"default"` or `"full"`.
        vision_feature_layer (`int`, *optional*, defaults to -2):
            The index of the layer to select the vision feature.
        image_seq_length (`int`, *optional*, defaults to 576):
            Sequence length of one image embedding.

    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
    ```llavaTN }  geludefault@  c	           
      <   || _         || _        || _        || _        |dvrt	          d|           || _        || _        t          |t                    r*d|v r|d         nd|d<   t          |d                  di |}n|t          d         ddddd	d
dd          }|| _
        t          |t                    r*d|v r|d         nd|d<   t          |d                  di |}n|t          d                     }|| _         t                      j        di |	 d S )N)r   fullzGvision_feature_select_strategy should be one of 'default', 'full'.Got: 
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image_seq_length
ValueErrorvision_feature_select_strategyvision_feature_layer
isinstancedictr   vision_configtext_configsuper__init__)selfr*   r+   r!   r"   r#   r&   r'   r$   kwargs	__class__s             i/var/www/html/ai-engine/env/lib/python3.11/site-packages/transformers/models/llava/configuration_llava.pyr-   zLlavaConfig.__init__N   s    )!2$8! 0)1DDD969 9  
 /M+$8!mT** 	/;}/L/Ll++Re ,' +=+FGXX-XXMM"*+>?"& "$$& "	 	 	M +k4(( 	4EQU`E`E`L(A(AfmK%(\)BCRRkRRKK (133K&""6"""""    )NNr
   r   r   r   r   r   )__name__
__module____qualname____doc__r   is_compositionr-   __classcell__)r0   s   @r1   r   r      sn        0 0d JN #'05# 5# 5# 5# 5# 5# 5# 5# 5# 5#r2   r   N)r6   configuration_utilsr   utilsr   autor   
get_loggerr3   loggerr   r    r2   r1   <module>r>      s       3 3 3 3 3 3       ! ! ! ! ! ! 
	H	%	%k# k# k# k# k#" k# k# k# k# k#r2   