U
    9%e                     @   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                	       s`   e Zd ZdZdZddddddd	gd
dddgfeeeeee ee d 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-5):
            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
    ```ZvitmatteNi  gh㈵>g{Gz?0   `            @       )backbone_confighidden_sizebatch_norm_epsinitializer_rangeconvstream_hidden_sizesfusion_hidden_sizesc           
         s   t  jf | |d kr2td td dgd}n&t|trX|d}t| }	|	|}|| _	|| _
|| _|| _|| _|| _d S )NzX`backbone_config` is `None`. Initializing the config with the default `VitDet` backbone.ZvitdetZstage4)Zout_features
model_type)super__init__loggerinfor   
isinstancedictget	from_dictr   r   r   r   r   r   )
selfr   r   r   r   r   r   kwargsZbackbone_model_typeZconfig_class	__class__ r/var/www/html/Darija-Ai-API/env/lib/python3.8/site-packages/transformers/models/vitmatte/configuration_vitmatte.pyr   H   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(   c   s    zVitMatteConfig.to_dict)__name__
__module____qualname____doc__r   r   intfloatr   r   r(   __classcell__r#   r#   r!   r$   r       s"   %
r   )r-   r%   typingr   Zconfiguration_utilsr   utilsr   Zauto.configuration_autor   Z
get_loggerr*   r   Z&VITMATTE_PRETRAINED_CONFIG_ARCHIVE_MAPr   r#   r#   r#   r$   <module>   s   
 