




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


UpperCAmelCase_ 		=      logging.get_logger(__name__)

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





class    __lowercase						(  __magic_name__       ,							__magic_name__ ):
   _a							=      """focalnet"""







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

     __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=UpperCamelCase      ,							out_indices=UpperCamelCase      ,							stage_names=self.stage_names      )









'''simple docstring'''


from typing import TYPE_CHECKING

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


UpperCAmelCase_ 		=      {
    "configuration_roformer": ["ROFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "RoFormerConfig", "RoFormerOnnxConfig"],
    "tokenization_roformer": ["RoFormerTokenizer"],
}

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

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase_ 		=      [
      "ROFORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
      "RoFormerForCausalLM",
      "RoFormerForMaskedLM",
      "RoFormerForMultipleChoice",
      "RoFormerForQuestionAnswering",
      "RoFormerForSequenceClassification",
      "RoFormerForTokenClassification",
      "RoFormerLayer",
      "RoFormerModel",
      "RoFormerPreTrainedModel",
      "load_tf_weights_in_roformer",
  ]


try:
  if not is_tf_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase_ 		=      [
      "TF_ROFORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
      "TFRoFormerForCausalLM",
      "TFRoFormerForMaskedLM",
      "TFRoFormerForMultipleChoice",
      "TFRoFormerForQuestionAnswering",
      "TFRoFormerForSequenceClassification",
      "TFRoFormerForTokenClassification",
      "TFRoFormerLayer",
      "TFRoFormerModel",
      "TFRoFormerPreTrainedModel",
  ]


try:
  if not is_flax_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase_ 		=      [
      "FLAX_ROFORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
      "FlaxRoFormerForMaskedLM",
      "FlaxRoFormerForMultipleChoice",
      "FlaxRoFormerForQuestionAnswering",
      "FlaxRoFormerForSequenceClassification",
      "FlaxRoFormerForTokenClassification",
      "FlaxRoFormerModel",
      "FlaxRoFormerPreTrainedModel",
  ]


if TYPE_CHECKING:
  from .configuration_roformer import ROFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, RoFormerConfig, RoFormerOnnxConfig
  from .tokenization_roformer import RoFormerTokenizer

  try:
    if not is_tokenizers_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .tokenization_roformer_fast import RoFormerTokenizerFast

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_roformer import (
        ROFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
        RoFormerForCausalLM,
        RoFormerForMaskedLM,
        RoFormerForMultipleChoice,
        RoFormerForQuestionAnswering,
        RoFormerForSequenceClassification,
        RoFormerForTokenClassification,
        RoFormerLayer,
        RoFormerModel,
        RoFormerPreTrainedModel,
        load_tf_weights_in_roformer,
    )

  try:
    if not is_tf_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_tf_roformer import (
        TF_ROFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
        TFRoFormerForCausalLM,
        TFRoFormerForMaskedLM,
        TFRoFormerForMultipleChoice,
        TFRoFormerForQuestionAnswering,
        TFRoFormerForSequenceClassification,
        TFRoFormerForTokenClassification,
        TFRoFormerLayer,
        TFRoFormerModel,
        TFRoFormerPreTrainedModel,
    )

  try:
    if not is_flax_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_flax_roformer import (
        FLAX_ROFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
        FlaxRoFormerForMaskedLM,
        FlaxRoFormerForMultipleChoice,
        FlaxRoFormerForQuestionAnswering,
        FlaxRoFormerForSequenceClassification,
        FlaxRoFormerForTokenClassification,
        FlaxRoFormerModel,
        FlaxRoFormerPreTrainedModel,
    )


else:
  import sys

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



