o
    h                     @   sb   d Z ddlZddlm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 VitMatte model configuration    N)List   )PretrainedConfig)logging   )CONFIG_MAPPINGz$hustvl/vitmatte-small-composition-1kzThttps://huggingface.co/hustvl/vitmatte-small-composition-1k/resolve/main/config.jsonc                       sd   e Zd ZdZdZddddg dg dfd	ed
edededee dee f fddZ	dd Z
  ZS )VitMatteConfiga  
    This is the configuration class to store the configuration of [`VitMatteForImageMatting`]. It is used to
    instantiate a ViTMatte 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 ViTMatte
    [hustvl/vitmatte-small-composition-1k](https://huggingface.co/hustvl/vitmatte-small-composition-1k) architecture.

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

    Args:
        backbone_config (`PretrainedConfig` or `dict`, *optional*, defaults to `VitDetConfig()`):
            The configuration of the backbone model.
        hidden_size (`int`, *optional*, defaults to 384):
            The number of input channels of the decoder.
        batch_norm_eps (`float`, *optional*, defaults to 1e-05):
            The epsilon used by the batch norm layers.
        initializer_range (`float`, *optional*, defaults to 0.02):
            The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
        convstream_hidden_sizes (`List[int]`, *optional*, defaults to `[48, 96, 192]`):
            The output channels of the ConvStream module.
        fusion_hidden_sizes (`List[int]`, *optional*, defaults to `[256, 128, 64, 32]`):
            The output channels of the Fusion blocks.

    Example:

    ```python
    >>> from transformers import VitMatteConfig, VitMatteForImageMatting

    >>> # Initializing a ViTMatte hustvl/vitmatte-small-composition-1k style configuration
    >>> configuration = VitMatteConfig()

    >>> # Initializing a model (with random weights) from the hustvl/vitmatte-small-composition-1k style configuration
    >>> model = VitMatteForImageMatting(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```vitmatteNi  gh㈵>g{Gz?)0   `      )      @       backbone_confighidden_sizebatch_norm_epsinitializer_rangeconvstream_hidden_sizesfusion_hidden_sizesc           
         s   t  jdi | |d u rtd td dgd}nt|tr.|d}t| }	|	|}|| _	|| _
|| _|| _|| _|| _d S )NzX`backbone_config` is `None`. Initializing the config with the default `VitDet` backbone.vitdetstage4)out_features
model_type )super__init__loggerinfor   
isinstancedictget	from_dictr   r   r   r   r   r   )
selfr   r   r   r   r   r   kwargsbackbone_model_typeconfig_class	__class__r   i/var/www/html/ai/venv/lib/python3.10/site-packages/transformers/models/vitmatte/configuration_vitmatte.pyr   I   s   





zVitMatteConfig.__init__c                 C   s*   t | j}| j |d< | jj|d< |S )z
        Serializes this instance to a Python dictionary. Override the default [`~PretrainedConfig.to_dict`]. Returns:
            `Dict[str, any]`: Dictionary of all the attributes that make up this configuration instance,
        r   r   )copydeepcopy__dict__r   to_dictr)   r   )r$   outputr   r   r*   r.   d   s   zVitMatteConfig.to_dict)__name__
__module____qualname____doc__r   r   intfloatr   r   r.   __classcell__r   r   r(   r*   r       s.    &r   )r3   r+   typingr   configuration_utilsr   utilsr   auto.configuration_autor   
get_loggerr0   r   &VITMATTE_PRETRAINED_CONFIG_ARCHIVE_MAPr   r   r   r   r*   <module>   s   
