
    fTh                     x    S r SSKJr  SSKJr  SSKJr  SSKJr  \R                  " \
5      r " S S\5      rS/rg	)
zUperNet model configuration   )PretrainedConfig)logging) verify_backbone_config_arguments   )CONFIG_MAPPINGc                   V   ^  \ rS rSrSrSrSSSSSSS/ SQS	S
SSSSS4U 4S jjrSrU =r$ )UperNetConfig   a  
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{Gz?)   r   r      Tg?i     r      c                   > [         TU ]  " S0 UD6  Uc(  Uc%  [        R                  S5        [        S   " / SQS9nO@[        U[        5      (       a+  UR                  S5      n[        U   nUR                  U5      n[        UUUUUS9  Xl
        X l        X0l        X@l        XPl        X`l        Xpl        Xl        Xl        Xl        Xl        Xl        Xl        Xl        Xl        g )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                      i/var/www/auris/envauris/lib/python3.13/site-packages/transformers/models/upernet/configuration_upernet.pyr   UperNetConfig.__init__W   s    & 	"6""x'7KKrs,X6DlmO.."1"5"5l"C)*=>L*44_EO(/$;++	
  / '>$!2.&!2&"4%:"%:""4#6 &<#!2    )r,   r.   r+   r*   r-   r   r   r   r&   r'   r/   r(   r)   r   r   )	__name__
__module____qualname____firstlineno____doc__r   r   __static_attributes____classcell__)r4   s   @r5   r	   r	      sI    8t J  % !!$!23 23r7   r	   N)r<   configuration_utilsr   utilsr   utils.backbone_utilsr   auto.configuration_autor   
get_loggerr8   r    r	   __all__r   r7   r5   <module>rE      sB    " 3  D 4 
		H	%o3$ o3d 
r7   