a
    h                     @   sd   d 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eZG d	d
 d
eZd
gZdS )zVitPose model configuration    )Optional   )PretrainedConfig)logging) verify_backbone_config_arguments   )CONFIG_MAPPINGc                
       sR   e Zd ZdZdZdee ee eeee	 e
eed fd	d
Zedd Z  ZS )VitPoseConfiga
  
    This is the configuration class to store the configuration of a [`VitPoseForPoseEstimation`]. It is used to instantiate a
    VitPose 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 VitPose
    [usyd-community/vitpose-base-simple](https://huggingface.co/usyd-community/vitpose-base-simple) 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 `VitPoseBackboneConfig()`):
            The configuration of the backbone model. Currently, only `backbone_config` with `vitpose_backbone` as `model_type` is supported.
        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.
        initializer_range (`float`, *optional*, defaults to 0.02):
            The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
        scale_factor (`int`, *optional*, defaults to 4):
            Factor to upscale the feature maps coming from the ViT backbone.
        use_simple_decoder (`bool`, *optional*, defaults to `True`):
            Whether to use a `VitPoseSimpleDecoder` to decode the feature maps from the backbone into heatmaps. Otherwise it uses `VitPoseClassicDecoder`.


    Example:

    ```python
    >>> from transformers import VitPoseConfig, VitPoseForPoseEstimation

    >>> # Initializing a VitPose configuration
    >>> configuration = VitPoseConfig()

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

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```ZvitposeNF{Gz?   T)backbone_configbackboneuse_pretrained_backboneuse_timm_backbonebackbone_kwargsinitializer_rangescale_factoruse_simple_decoderc	                    s   t  jf i |	 |r td |r,td|d u rX|d u rXtd td dgd}n&t|tr~|d}
t|
 }|	|}t
|||||d || _|| _|| _|| _|| _|| _|| _|| _d S )	Nzl`use_pretrained_backbone` is `True`. For the pure inference purpose of VitPose weight do not set this value.z<use_timm_backbone set `True` is not supported at the moment.zY`backbone_config` is `None`. Initializing the config with the default `VitPose` backbone.Zvitpose_backboner   )Zout_indices
model_type)r   r   r   r   r   )super__init__loggerinfo
ValueErrorr   
isinstancedictget	from_dictr   r   r   r   r   r   r   r   r   )selfr   r   r   r   r   r   r   r   kwargsZbackbone_model_typeZconfig_class	__class__ m/var/www/html/assistant/venv/lib/python3.9/site-packages/transformers/models/vitpose/configuration_vitpose.pyr   N   s:    



zVitPoseConfig.__init__c                 C   s"   t | dd d urdt| jiS i S )Nr   )getattrtyper   )r   r"   r"   r#   sub_configs}   s    zVitPoseConfig.sub_configs)NNFFNr
   r   T)__name__
__module____qualname____doc__r   r   r   strboolr   floatintr   propertyr&   __classcell__r"   r"   r    r#   r	      s,   /        /r	   N)r*   typingr   Zconfiguration_utilsr   utilsr   Zutils.backbone_utilsr   Zauto.configuration_autor   Z
get_loggerr'   r   r	   __all__r"   r"   r"   r#   <module>   s   
j