



from collections import OrderedDict
from typing import Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


A   :					str	=      logging.get_logger(__name__)

A   :					Dict	=      {
    "facebook/data2vec-vision-base-ft": (
        "https://huggingface.co/facebook/data2vec-vision-base-ft/resolve/main/config.json"
    ),
}







class     _lowercase				(							lowercase__):


       """simple docstring"""




       A__      		=    "data2vec-vision"





       def __init__(     self							:    Dict      ,   __lowerCamelCase							:    List[str]=768      ,   __lowerCamelCase							:    int=12      ,   __lowerCamelCase							:    Union[str, Any]=12      ,   __lowerCamelCase							:    Dict=3072      ,   __lowerCamelCase							:    Tuple="gelu"      ,   __lowerCamelCase							:    Union[str, Any]=0.0      ,   __lowerCamelCase							:    Optional[int]=0.0      ,   __lowerCamelCase							:    Union[str, Any]=0.0_2      ,   __lowerCamelCase							:    Dict=1E-1_2      ,   __lowerCamelCase							:    str=224      ,   __lowerCamelCase							:    List[Any]=16      ,   __lowerCamelCase							:    List[str]=3      ,   __lowerCamelCase							:    Optional[Any]=False      ,   __lowerCamelCase							:    int=False      ,   __lowerCamelCase							:    Optional[int]=False      ,   __lowerCamelCase							:    Optional[Any]=False      ,   __lowerCamelCase							:    Optional[Any]=0.1      ,   __lowerCamelCase							:    str=0.1      ,   __lowerCamelCase							:    Optional[int]=True      ,   __lowerCamelCase							:    str=[3, 5, 7, 11]      ,   __lowerCamelCase							:    str=[1, 2, 3, 6]      ,   __lowerCamelCase							:    int=True      ,   __lowerCamelCase							:    Any=0.4      ,   __lowerCamelCase							:    Union[str, Any]=256      ,   __lowerCamelCase							:    int=1      ,   __lowerCamelCase							:    List[str]=False      ,   __lowerCamelCase							:    Dict=255      ,   **__lowerCamelCase							:    Any      ,   ):


             '''simple docstring'''



             super().__init__(**__lowerCamelCase )

             lowerCamelCase__	:       Optional[Any]					=						hidden_size
             lowerCamelCase__	:       Optional[int]					=						num_hidden_layers
             lowerCamelCase__	:       Optional[int]					=						num_attention_heads
             lowerCamelCase__	:       Dict					=						intermediate_size
             lowerCamelCase__	:       int					=						hidden_act
             lowerCamelCase__	:       List[str]					=						hidden_dropout_prob
             lowerCamelCase__	:       str					=						attention_probs_dropout_prob
             lowerCamelCase__	:       Any					=						initializer_range
             lowerCamelCase__	:       Dict					=						layer_norm_eps

             lowerCamelCase__	:       List[Any]					=						image_size
             lowerCamelCase__	:       Tuple					=						patch_size
             lowerCamelCase__	:       List[str]					=						num_channels
             lowerCamelCase__	:       List[str]					=						use_mask_token
             lowerCamelCase__	:       Tuple					=						use_absolute_position_embeddings
             lowerCamelCase__	:       Optional[int]					=						use_relative_position_bias
             lowerCamelCase__	:       str					=						use_shared_relative_position_bias
             lowerCamelCase__	:       List[str]					=						layer_scale_init_value
             lowerCamelCase__	:       List[str]					=						drop_path_rate
             lowerCamelCase__	:       Optional[int]					=						use_mean_pooling
             # decode head attributes (semantic segmentation)
             lowerCamelCase__	:       Dict					=						out_indices
             lowerCamelCase__	:       Union[str, Any]					=						pool_scales
             # auxiliary head attributes (semantic segmentation)
             lowerCamelCase__	:       str					=						use_auxiliary_head
             lowerCamelCase__	:       Optional[int]					=						auxiliary_loss_weight
             lowerCamelCase__	:       List[str]					=						auxiliary_channels
             lowerCamelCase__	:       List[str]					=						auxiliary_num_convs
             lowerCamelCase__	:       str					=						auxiliary_concat_input
             lowerCamelCase__	:       Any					=						semantic_loss_ignore_index







class     _lowercase				(							lowercase__):


       """simple docstring"""




       A__      		=    version.parse("1.11")





       @property
       def 		lowerCAmelCase  (     self							:    Dict ):


             '''simple docstring'''



             return OrderedDict(
                 [
                     ("pixel_values", {0: "batch", 1: "num_channels", 2: "height", 3: "width"}),
                 ] )





       @property
       def 		lowerCAmelCase  (     self							:    Optional[Any] ):


             '''simple docstring'''



             return 1E-4






import os
from pathlib import Path

def    lowercase_	(	):

      """simple docstring"""




      from torch.utils.cpp_extension import load

      lowerCamelCase__	:       Any					=						Path(_A		).resolve().parent.parent.parent / "kernels" / "deformable_detr"
      lowerCamelCase__	:       Optional[int]					=						[
          root / filename
          for filename in [
              "vision.cpp",
              os.path.join("cpu"					,      "ms_deform_attn_cpu.cpp"		),
              os.path.join("cuda"					,      "ms_deform_attn_cuda.cu"		),
          ]
      ]

      load(
          "MultiScaleDeformableAttention"					,      _A					,      with_cuda=_A					,      extra_include_paths=[str(_A		)]					,      extra_cflags=["-DWITH_CUDA=1"]					,      extra_cuda_cflags=[
              "-DCUDA_HAS_FP16=1",
              "-D__CUDA_NO_HALF_OPERATORS__",
              "-D__CUDA_NO_HALF_CONVERSIONS__",
              "-D__CUDA_NO_HALF2_OPERATORS__",
          ]					,      )

      import MultiScaleDeformableAttention as MSDA

      return MSDA


