Ë
    T^(hó  ã                   óx   — d 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UperNet model configurationé   )ÚPretrainedConfig)Úlogging)Ú verify_backbone_config_argumentsé   )ÚCONFIG_MAPPINGc                   óJ   ‡ — e Zd ZdZdZdddddddg d¢dd	d
ddddfˆ fd„	Zˆ x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.
        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*, `False`):
            Whether to use pretrained weights for the backbone.
        use_timm_backbone (`bool`, *optional*, `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 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
    ```ÚupernetNFi   g{®Gáz”?)é   r   r   é   Tgš™™™™™Ù?i€  é   r   éÿ   c                 óâ  •— t        ‰| �  di |¤Ž |€)|€'t        j                  d«       t	        d   g d¢¬«      }n;t        |t        «      r+|j                  d«      }t        |   }|j                  |«      }t        |||||¬«       || _
        || _        || _        || _        || _        || _        || _        || _        |	| _        |
| _        || _        || _        || _        || _        || _        y )NzX`backbone_config` is `None`. Initializing the config with the default `ResNet` backbone.Úresnet)Ústage1Ústage2Ústage3Ústage4)Úout_featuresÚ
model_type)Úuse_timm_backboneÚuse_pretrained_backboneÚbackboneÚbackbone_configÚbackbone_kwargs© )ÚsuperÚ__init__ÚloggerÚinfor   Ú
isinstanceÚdictÚgetÚ	from_dictr   r   r   r   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)Úselfr   r   r   r   r   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   ÚkwargsÚbackbone_model_typeÚconfig_classÚ	__class__s                      €úo/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/models/upernet/configuration_upernet.pyr   zUperNetConfig.__init__W   s  ø€ ô& 	‰ÑÑ"˜6Ò"ØÐ" xÐ'7Ü�K‰KÐrÔsÜ,¨XÑ6ÒDlÔm‰OÜ˜¬Ô.Ø"1×"5Ñ"5°lÓ"CÐÜ)Ð*=Ñ>ˆLØ*×4Ñ4°_ÓEˆOä(Ø/Ø$;ØØ+Ø+õ	
ð  /ˆÔØ ˆŒØ'>ˆÔ$Ø!2ˆÔØ.ˆÔØ&ˆÔØ!2ˆÔØ&ˆÔØ"4ˆÔØ%:ˆÔ"Ø%:ˆÔ"Ø"4ˆÔØ#6ˆÔ Ø&<ˆÔ#Ø!2ˆÕó    )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Ú__classcell__)r3   s   @r4   r	   r	      sI   ø„ ñ8ðt €Jð ØØ %ØØØØÚ ØØ!Ø!ØØØ$Ø÷!23ñ 23r5   r	   N)r9   Úconfiguration_utilsr   Úutilsr   Úutils.backbone_utilsr   Úauto.configuration_autor   Ú
get_loggerr6   r   r	   Ú__all__r   r5   r4   ú<module>rA      sD   ðñ "å 3Ý Ý DÝ 4ð 
ˆ×	Ñ	˜HÓ	%€ôo3Ð$ô o3ðd Ð
�r5   