


"""simple docstring"""

from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available


UpperCAmelCase__  							={
    "configuration_data2vec_audio": ["DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP", "Data2VecAudioConfig"],
    "configuration_data2vec_text": [
        "DATA2VEC_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "Data2VecTextConfig",
        "Data2VecTextOnnxConfig",
    ],
    "configuration_data2vec_vision": [
        "DATA2VEC_VISION_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "Data2VecVisionConfig",
        "Data2VecVisionOnnxConfig",
    ],
}

try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       UpperCAmelCase__  							=[
           "DATA2VEC_AUDIO_PRETRAINED_MODEL_ARCHIVE_LIST",
           "Data2VecAudioForAudioFrameClassification",
           "Data2VecAudioForCTC",
           "Data2VecAudioForSequenceClassification",
           "Data2VecAudioForXVector",
           "Data2VecAudioModel",
           "Data2VecAudioPreTrainedModel",
       ]
       UpperCAmelCase__  							=[
           "DATA2VEC_TEXT_PRETRAINED_MODEL_ARCHIVE_LIST",
           "Data2VecTextForCausalLM",
           "Data2VecTextForMaskedLM",
           "Data2VecTextForMultipleChoice",
           "Data2VecTextForQuestionAnswering",
           "Data2VecTextForSequenceClassification",
           "Data2VecTextForTokenClassification",
           "Data2VecTextModel",
           "Data2VecTextPreTrainedModel",
       ]
       UpperCAmelCase__  							=[
           "DATA2VEC_VISION_PRETRAINED_MODEL_ARCHIVE_LIST",
           "Data2VecVisionForImageClassification",
           "Data2VecVisionForMaskedImageModeling",
           "Data2VecVisionForSemanticSegmentation",
           "Data2VecVisionModel",
           "Data2VecVisionPreTrainedModel",
       ]

if is_tf_available():
       UpperCAmelCase__  							=[
           "TFData2VecVisionForImageClassification",
           "TFData2VecVisionForSemanticSegmentation",
           "TFData2VecVisionModel",
           "TFData2VecVisionPreTrainedModel",
       ]

if TYPE_CHECKING:
       from .configuration_dataavec_audio import DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP, DataaVecAudioConfig
       from .configuration_dataavec_text import (
           DATA2VEC_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP,
           DataaVecTextConfig,
           DataaVecTextOnnxConfig,
       )
       from .configuration_dataavec_vision import (
           DATA2VEC_VISION_PRETRAINED_CONFIG_ARCHIVE_MAP,
           DataaVecVisionConfig,
           DataaVecVisionOnnxConfig,
       )

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_dataavec_audio import (
                  DATA2VEC_AUDIO_PRETRAINED_MODEL_ARCHIVE_LIST,
                  DataaVecAudioForAudioFrameClassification,
                  DataaVecAudioForCTC,
                  DataaVecAudioForSequenceClassification,
                  DataaVecAudioForXVector,
                  DataaVecAudioModel,
                  DataaVecAudioPreTrainedModel,
              )
              from .modeling_dataavec_text import (
                  DATA2VEC_TEXT_PRETRAINED_MODEL_ARCHIVE_LIST,
                  DataaVecTextForCausalLM,
                  DataaVecTextForMaskedLM,
                  DataaVecTextForMultipleChoice,
                  DataaVecTextForQuestionAnswering,
                  DataaVecTextForSequenceClassification,
                  DataaVecTextForTokenClassification,
                  DataaVecTextModel,
                  DataaVecTextPreTrainedModel,
              )
              from .modeling_dataavec_vision import (
                  DATA2VEC_VISION_PRETRAINED_MODEL_ARCHIVE_LIST,
                  DataaVecVisionForImageClassification,
                  DataaVecVisionForMaskedImageModeling,
                  DataaVecVisionForSemanticSegmentation,
                  DataaVecVisionModel,
                  DataaVecVisionPreTrainedModel,
              )
       if is_tf_available():
              from .modeling_tf_dataavec_vision import (
                  TFDataaVecVisionForImageClassification,
                  TFDataaVecVisionForSemanticSegmentation,
                  TFDataaVecVisionModel,
                  TFDataaVecVisionPreTrainedModel,
              )

else:
       import sys

       UpperCAmelCase__  							=_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)




"""simple docstring"""

from ...configuration_utils import PretrainedConfig
from ...utils import logging


UpperCAmelCase__  							=logging.get_logger(__name__)

UpperCAmelCase__  							={
    "microsoft/swinv2-tiny-patch4-window8-256": (
        "https://huggingface.co/microsoft/swinv2-tiny-patch4-window8-256/resolve/main/config.json"
    ),
}





class    lowerCamelCase__						(		_a    ):
      a :     List[Any]											=		"""swinv2"""

      a :     Any											=		{
          """num_attention_heads""": """num_heads""",
          """num_hidden_layers""": """num_layers""",
      }
      def __init__(		self	:	List[str]      ,       A_	:	Any=2_2_4      ,       A_	:	int=4      ,       A_	:	Optional[int]=3      ,       A_	:	List[Any]=9_6      ,       A_	:	List[Any]=[2, 2, 6, 2]      ,       A_	:	List[str]=[3, 6, 1_2, 2_4]      ,       A_	:	Union[str, Any]=7      ,       A_	:	int=4.0      ,       A_	:	List[str]=True      ,       A_	:	str=0.0      ,       A_	:	Any=0.0      ,       A_	:	Union[str, Any]=0.1      ,       A_	:	Optional[Any]="gelu"      ,       A_	:	int=False      ,       A_	:	List[Any]=0.02      ,       A_	:	Tuple=1e-5      ,       A_	:	Tuple=3_2      ,       **A_	:	int      ,       ):






       '''simple docstring'''


       super().__init__(**A_							)

       __lowercase									=	image_size
       __lowercase									=	patch_size
       __lowercase									=	num_channels
       __lowercase									=	embed_dim
       __lowercase									=	depths
       __lowercase									=	len(A_							)
       __lowercase									=	num_heads
       __lowercase									=	window_size
       __lowercase									=	mlp_ratio
       __lowercase									=	qkv_bias
       __lowercase									=	hidden_dropout_prob
       __lowercase									=	attention_probs_dropout_prob
       __lowercase									=	drop_path_rate
       __lowercase									=	hidden_act
       __lowercase									=	use_absolute_embeddings
       __lowercase									=	layer_norm_eps
       __lowercase									=	initializer_range
       __lowercase									=	encoder_stride
       # we set the hidden_size attribute in order to make Swinv2 work with VisionEncoderDecoderModel
       # this indicates the channel dimension after the last stage of the model
       __lowercase									=	int(embed_dim * 2 ** (len(A_							) - 1)							)
       __lowercase									=	(0, 0, 0, 0)
