
     `i                         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j        e          Z G d	 d
e          Zd
gZdS )zVitPose model configuration    )Optional   )PretrainedConfig)logging) verify_backbone_config_arguments   )CONFIG_MAPPINGc                        e Zd ZdZdZ	 	 	 	 	 	 	 	 ddee         d	ee         d
ededee	         de
dedef fdZed             Z x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
    ```vitposeNF{Gz?   Tbackbone_configbackboneuse_pretrained_backboneuse_timm_backbonebackbone_kwargsinitializer_rangescale_factoruse_simple_decoderc	                 0    t                      j        d	i |	 |rt                              d           |rt	          d          |4|2t                              d           t          d         dg          }nLt          |t                    r7|                    d          }
t
          |
         }|	                    |          }t          |||||           || _        || _        || _        || _        || _        || _        || _        || _        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.vitpose_backboner   )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   kwargsbackbone_model_typeconfig_class	__class__s               /home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/transformers/models/vitpose/configuration_vitpose.pyr   zVitPoseConfig.__init__N   sG    	""6"""" 	KK~    	][\\\"x'7KKsttt,-?@aSQQQOO.. 	F"1"5"5l"C"C)*=>L*44_EEO(/$;++	
 	
 	
 	
  / '>$!2.!2("4    c                 T    t          | dd           dt          | j                  ini S )Nr   )getattrtyper   )r%   s    r*   sub_configszVitPoseConfig.sub_configs}   s7     t.55A T%9 : :;;	
r+   )NNFFNr   r   T)__name__
__module____qualname____doc__r   r   r   strboolr"   floatintr   propertyr/   __classcell__)r)   s   @r*   r   r      s        - -^ J 7;"&(-"'*.#'#'-5 -5!"23-5 3--5 "&	-5
  -5 "$-5 !-5 -5 !-5 -5 -5 -5 -5 -5^ 
 
 X
 
 
 
 
r+   r   N)r3   typingr   configuration_utilsr   utilsr   utils.backbone_utilsr   auto.configuration_autor	   
get_loggerr0   r   r   __all__r   r+   r*   <module>rA      s    " !       3 3 3 3 3 3       D D D D D D 4 4 4 4 4 4 
	H	%	%g
 g
 g
 g
 g
$ g
 g
 g
T 
r+   