




from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


lowerCamelCase       :	Union[str, Any]									=     logging.get_logger(__name__)







class 						A(		UpperCamelCase							,   UpperCamelCase     ):



 '''simple docstring'''


 UpperCamelCase		     =		'''maskformer-swin'''

 UpperCamelCase		     =		{
     '''num_attention_heads''': '''num_heads''',
     '''num_hidden_layers''': '''num_layers''',
 }

 def __init__(       self      :						int		,							A_      :						Optional[Any]=224		,							A_      :						Dict=4		,							A_      :						str=3		,							A_      :						List[str]=96		,							A_      :						Union[str, Any]=[2, 2, 6, 2]		,							A_      :						int=[3, 6, 12, 24]		,							A_      :						Tuple=7		,							A_      :						Optional[Any]=4.0		,							A_      :						List[Any]=True		,							A_      :						str=0.0		,							A_      :						str=0.0		,							A_      :						Dict=0.1		,							A_      :						Union[str, Any]="gelu"		,							A_      :						Dict=False		,							A_      :						List[str]=0.02		,							A_      :						List[str]=1E-5		,							A_      :						Union[str, Any]=None		,							A_      :						Union[str, Any]=None		,							**A_      :						List[Any]		,							)     ->			Optional[Any]:

       """simple docstring"""






       super().__init__(**A_						)

       lowerCamelCase_	  =					image_size
       lowerCamelCase_	  =					patch_size
       lowerCamelCase_	  =					num_channels
       lowerCamelCase_	  =					embed_dim
       lowerCamelCase_	  =					depths
       lowerCamelCase_	  =					len(A_						)
       lowerCamelCase_	  =					num_heads
       lowerCamelCase_	  =					window_size
       lowerCamelCase_	  =					mlp_ratio
       lowerCamelCase_	  =					qkv_bias
       lowerCamelCase_	  =					hidden_dropout_prob
       lowerCamelCase_	  =					attention_probs_dropout_prob
       lowerCamelCase_	  =					drop_path_rate
       lowerCamelCase_	  =					hidden_act
       lowerCamelCase_	  =					use_absolute_embeddings
       lowerCamelCase_	  =					layer_norm_eps
       lowerCamelCase_	  =					initializer_range
       # we set the hidden_size attribute in order to make Swin work with VisionEncoderDecoderModel
       # this indicates the channel dimension after the last stage of the model
       lowerCamelCase_	  =					int(embed_dim * 2 ** (len(A_						) - 1)						)
       lowerCamelCase_	  =					['stem'] + [f"""stage{idx}""" for idx in range(1		,							len(A_						) + 1						)]
       lowerCamelCase_  ,       lowerCamelCase_	  =					get_aligned_output_features_output_indices(
           out_features=A_		,							out_indices=A_		,							stage_names=self.stage_names						)









from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_torch_available,
    is_vision_available,
)


lowerCamelCase       :	Dict									=     {"configuration_vit": ["VIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "ViTConfig", "ViTOnnxConfig"]}

try:
 if not is_vision_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCamelCase       :	Optional[int]									=     ["ViTFeatureExtractor"]
 lowerCamelCase       :	Dict									=     ["ViTImageProcessor"]

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCamelCase       :	int									=     [
     "VIT_PRETRAINED_MODEL_ARCHIVE_LIST",
     "ViTForImageClassification",
     "ViTForMaskedImageModeling",
     "ViTModel",
     "ViTPreTrainedModel",
 ]

try:
 if not is_tf_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCamelCase       :	Tuple									=     [
     "TFViTForImageClassification",
     "TFViTModel",
     "TFViTPreTrainedModel",
 ]

try:
 if not is_flax_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCamelCase       :	Dict									=     [
     "FlaxViTForImageClassification",
     "FlaxViTModel",
     "FlaxViTPreTrainedModel",
 ]

if TYPE_CHECKING:
 from .configuration_vit import VIT_PRETRAINED_CONFIG_ARCHIVE_MAP, ViTConfig, ViTOnnxConfig

 try:
  if not is_vision_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .feature_extraction_vit import ViTFeatureExtractor
  from .image_processing_vit import ViTImageProcessor

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_vit import (
      VIT_PRETRAINED_MODEL_ARCHIVE_LIST,
      ViTForImageClassification,
      ViTForMaskedImageModeling,
      ViTModel,
      ViTPreTrainedModel,
  )

 try:
  if not is_tf_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_tf_vit import TFViTForImageClassification, TFViTModel, TFViTPreTrainedModel

 try:
  if not is_flax_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_flax_vit import FlaxViTForImageClassification, FlaxViTModel, FlaxViTPreTrainedModel


else:
 import sys

 lowerCamelCase       :	Any									=     _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)



