o
    €wÖi|  ã                   @   s`   d dl mZ d dlmZ ddlmZ ddlmZ ddlm	Z	 e 
e¡ZG dd	„ d	eƒZd	gZd
S )é    )Údeepcopy)ÚAnyé   )ÚPretrainedConfig)Úloggingé   )ÚCONFIG_MAPPINGc                       s`   e Zd ZU dZdZdeiZeee	f e
d< 			dded	ef‡ fd
d„Zddefdd„Z‡  ZS )ÚColQwen2Configac  
    Configuration class to store the configuration of a [`ColQ2en2ForRetrieval`]. It is used to instantiate an instance
    of `ColQwen2ForRetrieval` according to the specified arguments, defining the model architecture following the methodology
    from the "ColPali: Efficient Document Retrieval with Vision Language Models" paper.

    Instantiating a configuration with the defaults will yield a similar configuration to the vision encoder used by the pre-trained
    ColQwen2-v1.0 model, e.g. [vidore/colqwen2-v1.0-hf](https://huggingface.co/vidore/colqwen2-v1.0-hf).

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

    Args:
        vlm_config (`PretrainedConfig`, *optional*):
            Configuration of the VLM backbone model.
        embedding_dim (`int`, *optional*, defaults to 128):
            Dimension of the multi-vector embeddings produced by the model.
        initializer_range (`float`, *optional*, defaults to 0.02):
            The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
    Example:

    ```python
    from transformers.models.colqwen2 import ColQwen2Config, ColQwen2ForRetrieval

    config = ColQwen2Config()
    model = ColQwen2ForRetrieval(config)
    ```
    Úcolqwen2Ú
vlm_configÚsub_configsNé€   ç{®Gáz”?Úembedding_dimÚinitializer_rangec                    s¤   |d u rt d ƒ }t d¡ n/t|tƒr,t|ƒ}d|vr tdƒ‚t |d  di |¤Ž}nt|tƒr4|}n
tdt	|ƒ› dƒ‚|| _
|| _|| _tƒ jdi |¤Ž d S )NÚqwen2_vlz_`vlm_config` is `None`. Initializing `vlm_config` with the `Qwen2VLConfig` with default values.Ú
model_typez^The `model_type` key is missing in the `vlm_config` dictionary. Please provide the model type.zWInvalid type for `vlm_config`. Expected `PretrainedConfig`, `dict`, or `None`, but got Ú.© )r   ÚloggerÚinfoÚ
isinstanceÚdictr   ÚKeyErrorr   Ú	TypeErrorÚtyper   r   r   ÚsuperÚ__init__)Úselfr   r   r   Úkwargs©Ú	__class__r   úp/home/ubuntu/sommelier/.venv/lib/python3.10/site-packages/transformers/models/colqwen2/configuration_colqwen2.pyr   ;   s*   
ÿ
ÿ
ÿzColQwen2Config.__init__FÚreturnc                 C   s   | j j|dS )N)Údecoder)r   Úget_text_config)r   r$   r   r   r"   r%   Z   s   zColQwen2Config.get_text_config)Nr   r   )F)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   Ústrr   Ú__annotations__ÚintÚfloatr   r%   Ú__classcell__r   r   r    r"   r	      s   
 üýür	   N)Úcopyr   Útypingr   Úconfiguration_utilsr   Úutilsr   Úautor   Ú
get_loggerr&   r   r	   Ú__all__r   r   r   r"   Ú<module>   s   

C