




import copy

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


snake_case__			:    Tuple			     =      logging.get_logger(__name__)





class      snake_case	(						UpperCAmelCase__				):


   '''simple docstring'''







   UpperCamelCase__						:							Any 	=   "upernet"




   def __init__(       self  :						Any    ,     lowerCamelCase_  :						Tuple=None    ,     lowerCamelCase_  :						Any=512    ,     lowerCamelCase_  :						Optional[Any]=0.02    ,     lowerCamelCase_  :						Union[str, Any]=[1, 2, 3, 6]    ,     lowerCamelCase_  :						Dict=True    ,     lowerCamelCase_  :						List[Any]=0.4    ,     lowerCamelCase_  :						Tuple=384    ,     lowerCamelCase_  :						int=256    ,     lowerCamelCase_  :						Dict=1    ,     lowerCamelCase_  :						Dict=False    ,     lowerCamelCase_  :						Any=255    ,     **lowerCamelCase_  :						Union[str, Any]    ,     )       ->Optional[int]:
     '''simple docstring'''







     super().__init__(**lowerCamelCase_      )

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

     UpperCAmelCase__         = backbone_config
     UpperCAmelCase__         = hidden_size
     UpperCAmelCase__         = initializer_range
     UpperCAmelCase__         = pool_scales
     UpperCAmelCase__         = use_auxiliary_head
     UpperCAmelCase__         = auxiliary_loss_weight
     UpperCAmelCase__         = auxiliary_in_channels
     UpperCAmelCase__         = auxiliary_channels
     UpperCAmelCase__         = auxiliary_num_convs
     UpperCAmelCase__         = auxiliary_concat_input
     UpperCAmelCase__         = loss_ignore_index







   def 						UpperCAmelCase							(       self  :						Optional[int]      )       ->str:
     '''simple docstring'''







     UpperCAmelCase__         = copy.deepcopy(self.__dict__      )
     UpperCAmelCase__         = self.backbone_config.to_dict()
     UpperCAmelCase__         = self.__class__.model_type
     return output





'''simple docstring'''




from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


__UpperCAmelCase					={
    "configuration_mobilebert": [
        "MOBILEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "MobileBertConfig",
        "MobileBertOnnxConfig",
    ],
    "tokenization_mobilebert": ["MobileBertTokenizer"],
}

try:
  if not is_tokenizers_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  __UpperCAmelCase					=["MobileBertTokenizerFast"]

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  __UpperCAmelCase					=[
      "MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
      "MobileBertForMaskedLM",
      "MobileBertForMultipleChoice",
      "MobileBertForNextSentencePrediction",
      "MobileBertForPreTraining",
      "MobileBertForQuestionAnswering",
      "MobileBertForSequenceClassification",
      "MobileBertForTokenClassification",
      "MobileBertLayer",
      "MobileBertModel",
      "MobileBertPreTrainedModel",
      "load_tf_weights_in_mobilebert",
  ]

try:
  if not is_tf_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  __UpperCAmelCase					=[
      "TF_MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
      "TFMobileBertForMaskedLM",
      "TFMobileBertForMultipleChoice",
      "TFMobileBertForNextSentencePrediction",
      "TFMobileBertForPreTraining",
      "TFMobileBertForQuestionAnswering",
      "TFMobileBertForSequenceClassification",
      "TFMobileBertForTokenClassification",
      "TFMobileBertMainLayer",
      "TFMobileBertModel",
      "TFMobileBertPreTrainedModel",
  ]


if TYPE_CHECKING:
  from .configuration_mobilebert import (
      MOBILEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
      MobileBertConfig,
      MobileBertOnnxConfig,
  )
  from .tokenization_mobilebert import MobileBertTokenizer

  try:
    if not is_tokenizers_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .tokenization_mobilebert_fast import MobileBertTokenizerFast

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_mobilebert import (
        MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
        MobileBertForMaskedLM,
        MobileBertForMultipleChoice,
        MobileBertForNextSentencePrediction,
        MobileBertForPreTraining,
        MobileBertForQuestionAnswering,
        MobileBertForSequenceClassification,
        MobileBertForTokenClassification,
        MobileBertLayer,
        MobileBertModel,
        MobileBertPreTrainedModel,
        load_tf_weights_in_mobilebert,
    )

  try:
    if not is_tf_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_tf_mobilebert import (
        TF_MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
        TFMobileBertForMaskedLM,
        TFMobileBertForMultipleChoice,
        TFMobileBertForNextSentencePrediction,
        TFMobileBertForPreTraining,
        TFMobileBertForQuestionAnswering,
        TFMobileBertForSequenceClassification,
        TFMobileBertForTokenClassification,
        TFMobileBertMainLayer,
        TFMobileBertModel,
        TFMobileBertPreTrainedModel,
    )

else:
  import sys

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