Ë
    T^(h}  ã                   óŒ   — 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	 dd	l
mZ  ej                  e«      Z G d
„ de«      ZdgZy)zVitMatte model configurationé    N)ÚListé   )ÚPretrainedConfig)Úlogging)Ú verify_backbone_config_argumentsé   )ÚCONFIG_MAPPINGc                   óp   ‡ — e Zd ZdZdZdddd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„Z	d„ Z
ˆ x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.
        backbone (`str`, *optional*):
            Name of backbone to use when `backbone_config` is `None`. If `use_pretrained_backbone` is `True`, this
            will load the corresponding pretrained weights from the timm or transformers library. If `use_pretrained_backbone`
            is `False`, this loads the backbone's config and uses that to initialize the backbone with random weights.
        use_pretrained_backbone (`bool`, *optional*, defaults to `False`):
            Whether to use pretrained weights for the backbone.
        use_timm_backbone (`bool`, *optional*, defaults to `False`):
            Whether to load `backbone` from the timm library. If `False`, the backbone is loaded from the transformers
            library.
        backbone_kwargs (`dict`, *optional*):
            Keyword arguments to be passed to AutoBackbone when loading from a checkpoint
            e.g. `{'out_indices': (0, 1, 2, 3)}`. Cannot be specified if `backbone_config` is set.
        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
    ```ÚvitmatteNFi€  gñhãˆµøä>g{®Gáz”?)é0   é`   éÀ   )é   é€   é@   é    Úbackbone_configÚhidden_sizeÚbatch_norm_epsÚinitializer_rangeÚconvstream_hidden_sizesÚfusion_hidden_sizesc                 óš  •— t        ‰| �  di |¤Ž |€(|€&t        j                  d«       t	        d   dg¬«      }n;t        |t        «      r+|j                  d«      }t        |   }|j                  |«      }t        |||||¬«       || _
        || _        || _        || _        || _        || _        || _        || _        |	| _        |
| _        y )NzX`backbone_config` is `None`. Initializing the config with the default `VitDet` backbone.ÚvitdetÚstage4)Úout_featuresÚ
model_type)Úuse_timm_backboneÚuse_pretrained_backboneÚbackboner   Úbackbone_kwargs© )ÚsuperÚ__init__ÚloggerÚinfor	   Ú
isinstanceÚdictÚgetÚ	from_dictr   r   r!   r    r   r"   r   r   r   r   r   )Úselfr   r!   r    r   r"   r   r   r   r   r   ÚkwargsÚbackbone_model_typeÚconfig_classÚ	__class__s                 €úq/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/models/vitmatte/configuration_vitmatte.pyr%   zVitMatteConfig.__init__R   sÜ   ø€ ô 	‰ÑÑ"˜6Ò"àÐ" xÐ'7Ü�K‰KÐrÔsÜ,¨XÑ6ÀXÀJÔO‰OÜ˜¬Ô.Ø"1×"5Ñ"5°lÓ"CÐÜ)Ð*=Ñ>ˆLØ*×4Ñ4°_ÓEˆOä(Ø/Ø$;ØØ+Ø+õ	
ð  /ˆÔØ ˆŒØ'>ˆÔ$Ø!2ˆÔØ.ˆÔØ,ˆÔØ&ˆÔØ!2ˆÔØ'>ˆÔ$Ø#6ˆÕ ó    c                 ó°   — t        j                  | j                  «      }| 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_dictr0   r   )r,   Úoutputs     r1   r7   zVitMatteConfig.to_dict}   sI   € ô
 —‘˜tŸ}™}Ó-ˆØ$(×$8Ñ$8×$@Ñ$@Ó$BˆÐ Ñ!Ø#Ÿ~™~×8Ñ8ˆˆ|ÑØˆr2   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   ÚintÚfloatr   r%   r7   Ú__classcell__)r0   s   @r1   r   r      s}   ø„ ñ0ðd €Jð -1ØØ %ØØØØ $Ø#'Ú-:Ú);ñ)7à)ð)7ð ð)7ð ð)7ð !ð)7ð "& c¡ð)7ð " #™Yõ)7öVr2   r   )r<   r4   Útypingr   Úconfiguration_utilsr   Úutilsr   Úutils.backbone_utilsr   Úauto.configuration_autor	   Ú
get_loggerr9   r&   r   Ú__all__r#   r2   r1   ú<module>rG      sJ   ðñ #ã Ý å 3Ý Ý DÝ 4ð 
ˆ×	Ñ	˜HÓ	%€ôhÐ%ô hðV Ð
�r2   