o
    ¾e¦i#  ã                   @   sX   d 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 )
zUperNet model configurationé   )Ú%consolidate_backbone_kwargs_to_config)ÚPreTrainedConfig)Úloggingé   )Ú
AutoConfigc                       sH   e Zd ZdZdZdeiZdddg d¢dd	dd
dddf‡ fdd„	Z‡  ZS )ÚUperNetConfigaÖ	  
    This is the configuration class to store the configuration of an [`UperNetForSemanticSegmentation`]. It is used to
    instantiate an UperNet 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 UperNet
    [openmmlab/upernet-convnext-tiny](https://huggingface.co/openmmlab/upernet-convnext-tiny) 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 `ResNetConfig()`):
            The configuration of the backbone model.
        hidden_size (`int`, *optional*, defaults to 512):
            The number of hidden units in the convolutional layers.
        initializer_range (`float`, *optional*, defaults to 0.02):
            The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
        pool_scales (`tuple[int]`, *optional*, defaults to `[1, 2, 3, 6]`):
            Pooling scales used in Pooling Pyramid Module applied on the last feature map.
        use_auxiliary_head (`bool`, *optional*, defaults to `True`):
            Whether to use an auxiliary head during training.
        auxiliary_loss_weight (`float`, *optional*, defaults to 0.4):
            Weight of the cross-entropy loss of the auxiliary head.
        auxiliary_channels (`int`, *optional*, defaults to 256):
            Number of channels to use in the auxiliary head.
        auxiliary_num_convs (`int`, *optional*, defaults to 1):
            Number of convolutional layers to use in the auxiliary head.
        auxiliary_concat_input (`bool`, *optional*, defaults to `False`):
            Whether to concatenate the output of the auxiliary head with the input before the classification layer.
        loss_ignore_index (`int`, *optional*, defaults to 255):
            The index that is ignored by the loss function.

    Examples:

    ```python
    >>> from transformers import UperNetConfig, UperNetForSemanticSegmentation

    >>> # Initializing a configuration
    >>> configuration = UperNetConfig()

    >>> # Initializing a model (with random weights) from the configuration
    >>> model = UperNetForSemanticSegmentation(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```ÚupernetÚbackbone_configNi   g{®Gáz”?)é   r   r   é   Tgš™™™™™Ù?é   r
   Féÿ   c                    sz   t d|ddg d¢idœ|¤Ž\}}|| _|| _|| _|| _|| _|| _|| _|| _|	| _	|
| _
|| _tƒ jdi |¤Ž d S )NÚresnetÚout_features)Ústage1Ústage2Ústage3Ústage4)r	   Údefault_config_typeÚdefault_config_kwargs© )r   r	   Úhidden_sizeÚinitializer_rangeÚpool_scalesÚuse_auxiliary_headÚauxiliary_loss_weightÚauxiliary_in_channelsÚauxiliary_channelsÚauxiliary_num_convsÚauxiliary_concat_inputÚloss_ignore_indexÚsuperÚ__init__)Úselfr	   r   r   r   r   r   r   r   r   r   r    Úkwargs©Ú	__class__r   úo/home/ubuntu/transcripts/venv/lib/python3.10/site-packages/transformers/models/upernet/configuration_upernet.pyr"   K   s(   ÿý
ú	zUperNetConfig.__init__)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
model_typer   Úsub_configsr"   Ú__classcell__r   r   r%   r'   r      s     .ôr   N)r+   Úbackbone_utilsr   Úconfiguration_utilsr   Úutilsr   Úauto.configuration_autor   Ú
get_loggerr(   Úloggerr   Ú__all__r   r   r   r'   Ú<module>   s   

Y