# Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """VitPose model configuration""" from huggingface_hub.dataclasses import strict from ...backbone_utils import consolidate_backbone_kwargs_to_config from ...configuration_utils import PreTrainedConfig from ...utils import auto_docstring from ..auto.configuration_auto import AutoConfig @auto_docstring(checkpoint="usyd-community/vitpose-base-simple") @strict class VitPoseConfig(PreTrainedConfig): r""" 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 ```""" model_type = "vitpose" sub_configs = {"backbone_config": AutoConfig} backbone_config: dict | PreTrainedConfig | None = None initializer_range: float = 0.02 scale_factor: int = 4 use_simple_decoder: bool = True def __post_init__(self, **kwargs): self.backbone_config, kwargs = consolidate_backbone_kwargs_to_config( backbone_config=self.backbone_config, default_config_type="vitpose_backbone", default_config_kwargs={"out_indices": [4]}, **kwargs, ) super().__post_init__(**kwargs) __all__ = ["VitPoseConfig"]