"""simple docstring"""



from typing import TYPE_CHECKING

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


SCREAMING_SNAKE_CASE__:str			=	{
    """configuration_bert""": ["""BERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """BertConfig""", """BertOnnxConfig"""],
    """tokenization_bert""": ["""BasicTokenizer""", """BertTokenizer""", """WordpieceTokenizer"""],
}

try:
   if not is_tokenizers_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   SCREAMING_SNAKE_CASE__:str			=	["""BertTokenizerFast"""]

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   SCREAMING_SNAKE_CASE__:Optional[int]			=	[
       """BERT_PRETRAINED_MODEL_ARCHIVE_LIST""",
       """BertForMaskedLM""",
       """BertForMultipleChoice""",
       """BertForNextSentencePrediction""",
       """BertForPreTraining""",
       """BertForQuestionAnswering""",
       """BertForSequenceClassification""",
       """BertForTokenClassification""",
       """BertLayer""",
       """BertLMHeadModel""",
       """BertModel""",
       """BertPreTrainedModel""",
       """load_tf_weights_in_bert""",
   ]

try:
   if not is_tf_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   SCREAMING_SNAKE_CASE__:int			=	[
       """TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST""",
       """TFBertEmbeddings""",
       """TFBertForMaskedLM""",
       """TFBertForMultipleChoice""",
       """TFBertForNextSentencePrediction""",
       """TFBertForPreTraining""",
       """TFBertForQuestionAnswering""",
       """TFBertForSequenceClassification""",
       """TFBertForTokenClassification""",
       """TFBertLMHeadModel""",
       """TFBertMainLayer""",
       """TFBertModel""",
       """TFBertPreTrainedModel""",
   ]
try:
   if not is_tensorflow_text_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   SCREAMING_SNAKE_CASE__:Optional[int]			=	["""TFBertTokenizer"""]

try:
   if not is_flax_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   SCREAMING_SNAKE_CASE__:List[Any]			=	[
       """FlaxBertForCausalLM""",
       """FlaxBertForMaskedLM""",
       """FlaxBertForMultipleChoice""",
       """FlaxBertForNextSentencePrediction""",
       """FlaxBertForPreTraining""",
       """FlaxBertForQuestionAnswering""",
       """FlaxBertForSequenceClassification""",
       """FlaxBertForTokenClassification""",
       """FlaxBertModel""",
       """FlaxBertPreTrainedModel""",
   ]

if TYPE_CHECKING:
   from .configuration_bert import BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, BertConfig, BertOnnxConfig
   from .tokenization_bert import BasicTokenizer, BertTokenizer, WordpieceTokenizer

   try:
      if not is_tokenizers_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .tokenization_bert_fast import BertTokenizerFast

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_bert import (
          BERT_PRETRAINED_MODEL_ARCHIVE_LIST,
          BertForMaskedLM,
          BertForMultipleChoice,
          BertForNextSentencePrediction,
          BertForPreTraining,
          BertForQuestionAnswering,
          BertForSequenceClassification,
          BertForTokenClassification,
          BertLayer,
          BertLMHeadModel,
          BertModel,
          BertPreTrainedModel,
          load_tf_weights_in_bert,
      )

   try:
      if not is_tf_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_tf_bert import (
          TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST,
          TFBertEmbeddings,
          TFBertForMaskedLM,
          TFBertForMultipleChoice,
          TFBertForNextSentencePrediction,
          TFBertForPreTraining,
          TFBertForQuestionAnswering,
          TFBertForSequenceClassification,
          TFBertForTokenClassification,
          TFBertLMHeadModel,
          TFBertMainLayer,
          TFBertModel,
          TFBertPreTrainedModel,
      )

   try:
      if not is_tensorflow_text_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .tokenization_bert_tf import TFBertTokenizer

   try:
      if not is_flax_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_flax_bert import (
          FlaxBertForCausalLM,
          FlaxBertForMaskedLM,
          FlaxBertForMultipleChoice,
          FlaxBertForNextSentencePrediction,
          FlaxBertForPreTraining,
          FlaxBertForQuestionAnswering,
          FlaxBertForSequenceClassification,
          FlaxBertForTokenClassification,
          FlaxBertModel,
          FlaxBertPreTrainedModel,
      )

else:
   import sys

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

"""simple docstring"""



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


SCREAMING_SNAKE_CASE__:List[str]			=	logging.get_logger(__name__)

SCREAMING_SNAKE_CASE__:int			=	{
    """microsoft/focalnet-tiny""": """https://huggingface.co/microsoft/focalnet-tiny/resolve/main/config.json""",
}






class 				snake_case__     (   snake_case_,		snake_case_   ):
 _snake_case   :			List[Any]           =		"""focalnet"""


 def __init__(				self  ,						lowerCamelCase=224  ,						lowerCamelCase=4  ,						lowerCamelCase=3  ,						lowerCamelCase=96  ,						lowerCamelCase=False  ,						lowerCamelCase=[192, 384, 768, 768]  ,						lowerCamelCase=[2, 2, 6, 2]  ,						lowerCamelCase=[2, 2, 2, 2]  ,						lowerCamelCase=[3, 3, 3, 3]  ,						lowerCamelCase="gelu"  ,						lowerCamelCase=4.0  ,						lowerCamelCase=0.0  ,						lowerCamelCase=0.1  ,						lowerCamelCase=False  ,						lowerCamelCase=1E-4  ,						lowerCamelCase=False  ,						lowerCamelCase=False  ,						lowerCamelCase=False  ,						lowerCamelCase=0.02  ,						lowerCamelCase=1E-5  ,						lowerCamelCase=32  ,						lowerCamelCase=None  ,						lowerCamelCase=None  ,						**lowerCamelCase  ,						):
        super().__init__(**lowerCamelCase		)

        __a     				=  image_size
        __a     				=  patch_size
        __a     				=  num_channels
        __a     				=  embed_dim
        __a     				=  use_conv_embed
        __a     				=  hidden_sizes
        __a     				=  depths
        __a     				=  focal_levels
        __a     				=  focal_windows
        __a     				=  hidden_act
        __a     				=  mlp_ratio
        __a     				=  hidden_dropout_prob
        __a     				=  drop_path_rate
        __a     				=  use_layerscale
        __a     				=  layerscale_value
        __a     				=  use_post_layernorm
        __a     				=  use_post_layernorm_in_modulation
        __a     				=  normalize_modulator
        __a     				=  initializer_range
        __a     				=  layer_norm_eps
        __a     				=  encoder_stride
        __a     				=  ["stem"] + [F"stage{idx}" for idx in range(1  ,						len(self.depths		) + 1		)]
        __a				, __a     				=  get_aligned_output_features_output_indices(
            out_features=lowerCamelCase  ,						out_indices=lowerCamelCase  ,						stage_names=self.stage_names		)
