






from typing import TYPE_CHECKING

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


SCREAMING_SNAKE_CASE__       :			Optional[Any]			      =						{"""configuration_beit""": ["""BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """BeitConfig""", """BeitOnnxConfig"""]}

try:
  if not is_vision_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  SCREAMING_SNAKE_CASE__       :			Dict			      =						["""BeitFeatureExtractor"""]
  SCREAMING_SNAKE_CASE__       :			str			      =						["""BeitImageProcessor"""]

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  SCREAMING_SNAKE_CASE__       :			Optional[int]			      =						[
      """BEIT_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """BeitForImageClassification""",
      """BeitForMaskedImageModeling""",
      """BeitForSemanticSegmentation""",
      """BeitModel""",
      """BeitPreTrainedModel""",
  ]


try:
  if not is_flax_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  SCREAMING_SNAKE_CASE__       :			Optional[Any]			      =						[
      """FlaxBeitForImageClassification""",
      """FlaxBeitForMaskedImageModeling""",
      """FlaxBeitModel""",
      """FlaxBeitPreTrainedModel""",
  ]

if TYPE_CHECKING:
  from .configuration_beit import BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP, BeitConfig, BeitOnnxConfig

  try:
    if not is_vision_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .feature_extraction_beit import BeitFeatureExtractor
    from .image_processing_beit import BeitImageProcessor

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_beit import (
        BEIT_PRETRAINED_MODEL_ARCHIVE_LIST,
        BeitForImageClassification,
        BeitForMaskedImageModeling,
        BeitForSemanticSegmentation,
        BeitModel,
        BeitPreTrainedModel,
    )

  try:
    if not is_flax_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_flax_beit import (
        FlaxBeitForImageClassification,
        FlaxBeitForMaskedImageModeling,
        FlaxBeitModel,
        FlaxBeitPreTrainedModel,
    )


else:
  import sys

  SCREAMING_SNAKE_CASE__       :			str			      =						_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)








import copy

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto.configuration_auto import CONFIG_MAPPING


SCREAMING_SNAKE_CASE__       :			int			      =						logging.get_logger(__name__)







class   __lowerCAmelCase			(					_UpperCamelCase  ):
   _UpperCamelCase :						int     		=				"""upernet"""





   def __init__( self					,			snake_case=None					,			snake_case=512					,			snake_case=0.02					,			snake_case=[1, 2, 3, 6]					,			snake_case=True					,			snake_case=0.4					,			snake_case=384					,			snake_case=256					,			snake_case=1					,			snake_case=False					,			snake_case=255					,			**snake_case					,			)				->  Optional[Any]:
      """simple docstring"""





      super().__init__(**snake_case      )

      if backbone_config is None:
         logger.info("`backbone_config` is `None`. Initializing the config with the default `ResNet` backbone."      )
         a__	:						List[str]      		=  CONFIG_MAPPING["resnet"](out_features=["stage1", "stage2", "stage3", "stage4"]      )
      elif isinstance(snake_case					,			snake_case      ):
         a__	:						Optional[int]      		=  backbone_config.get("model_type"      )
         a__	:						str      		=  CONFIG_MAPPING[backbone_model_type]
         a__	:						str      		=  config_class.from_dict(snake_case      )

      a__	:						int      		=  backbone_config
      a__	:						Optional[Any]      		=  hidden_size
      a__	:						Optional[Any]      		=  initializer_range
      a__	:						Tuple      		=  pool_scales
      a__	:						Optional[Any]      		=  use_auxiliary_head
      a__	:						Optional[Any]      		=  auxiliary_loss_weight
      a__	:						Dict      		=  auxiliary_in_channels
      a__	:						Optional[int]      		=  auxiliary_channels
      a__	:						Any      		=  auxiliary_num_convs
      a__	:						Any      		=  auxiliary_concat_input
      a__	:						int      		=  loss_ignore_index





   def 	_snake_case ( self      )				->  str:
      """simple docstring"""





      a__	:						Tuple      		=  copy.deepcopy(self.__dict__      )
      a__	:						Optional[Any]      		=  self.backbone_config.to_dict()
      a__	:						List[Any]      		=  self.__class__.model_type
      return output

