






'''simple docstring'''





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


__lowerCamelCase						:    Any     				=  logging.get_logger(__name__)

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



class   lowerCAmelCase__ ( UpperCamelCase__						,UpperCamelCase__  ):
			A     				= "focalnet"

			def __init__(					self					:		str     ,		UpperCamelCase_					:		Dict=224     ,		UpperCamelCase_					:		str=4     ,		UpperCamelCase_					:		Optional[int]=3     ,		UpperCamelCase_					:		Optional[int]=96     ,		UpperCamelCase_					:		Tuple=False     ,		UpperCamelCase_					:		List[str]=[192, 384, 768, 768]     ,		UpperCamelCase_					:		Dict=[2, 2, 6, 2]     ,		UpperCamelCase_					:		str=[2, 2, 2, 2]     ,		UpperCamelCase_					:		Optional[int]=[3, 3, 3, 3]     ,		UpperCamelCase_					:		List[Any]="gelu"     ,		UpperCamelCase_					:		List[Any]=4.0     ,		UpperCamelCase_					:		int=0.0     ,		UpperCamelCase_					:		List[str]=0.1     ,		UpperCamelCase_					:		List[str]=False     ,		UpperCamelCase_					:		Optional[Any]=1e-4     ,		UpperCamelCase_					:		Tuple=False     ,		UpperCamelCase_					:		Optional[Any]=False     ,		UpperCamelCase_					:		Union[str, Any]=False     ,		UpperCamelCase_					:		List[Any]=0.02     ,		UpperCamelCase_					:		List[str]=1e-5     ,		UpperCamelCase_					:		Optional[int]=32     ,		UpperCamelCase_					:		List[Any]=None     ,		UpperCamelCase_					:		Any=None     ,		**UpperCamelCase_					:		Dict     ,		) ->  Union[str, Any]:







				"""simple docstring"""






				super().__init__(**lowercase_	)

				lowerCamelCase_					:  Tuple						=    image_size
				lowerCamelCase_					:  Union[str, Any]						=    patch_size
				lowerCamelCase_					:  List[str]						=    num_channels
				lowerCamelCase_					:  int						=    embed_dim
				lowerCamelCase_					:  Dict						=    use_conv_embed
				lowerCamelCase_					:  List[Any]						=    hidden_sizes
				lowerCamelCase_					:  int						=    depths
				lowerCamelCase_					:  Tuple						=    focal_levels
				lowerCamelCase_					:  Optional[Any]						=    focal_windows
				lowerCamelCase_					:  Optional[Any]						=    hidden_act
				lowerCamelCase_					:  Tuple						=    mlp_ratio
				lowerCamelCase_					:  int						=    hidden_dropout_prob
				lowerCamelCase_					:  Tuple						=    drop_path_rate
				lowerCamelCase_					:  Tuple						=    use_layerscale
				lowerCamelCase_					:  Union[str, Any]						=    layerscale_value
				lowerCamelCase_					:  Dict						=    use_post_layernorm
				lowerCamelCase_					:  List[str]						=    use_post_layernorm_in_modulation
				lowerCamelCase_					:  List[str]						=    normalize_modulator
				lowerCamelCase_					:  int						=    initializer_range
				lowerCamelCase_					:  Any						=    layer_norm_eps
				lowerCamelCase_					:  List[Any]						=    encoder_stride
				lowerCamelCase_					:  Dict						=    ['''stem'''] + [F"""stage{idx}""" for idx in range(1     ,		len(self.depths	) + 1	)]
				lowerCamelCase_	,				lowerCamelCase_					:  Tuple						=    get_aligned_output_features_output_indices(
				    out_features=lowercase_     ,		out_indices=lowercase_     ,		stage_names=self.stage_names	)













'''simple docstring'''

# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import TYPE_CHECKING

# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available


__lowerCAmelCase				:      Union[str, Any]						      ={"configuration_mra": ["MRA_PRETRAINED_CONFIG_ARCHIVE_MAP", "MraConfig"]}

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  __lowerCAmelCase				:      int						      =[
      "MRA_PRETRAINED_MODEL_ARCHIVE_LIST",
      "MraForMaskedLM",
      "MraForMultipleChoice",
      "MraForQuestionAnswering",
      "MraForSequenceClassification",
      "MraForTokenClassification",
      "MraLayer",
      "MraModel",
      "MraPreTrainedModel",
  ]


if TYPE_CHECKING:
  from .configuration_mra import MRA_PRETRAINED_CONFIG_ARCHIVE_MAP, MraConfig

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_mra import (
        MRA_PRETRAINED_MODEL_ARCHIVE_LIST,
        MraForMaskedLM,
        MraForMultipleChoice,
        MraForQuestionAnswering,
        MraForSequenceClassification,
        MraForTokenClassification,
        MraLayer,
        MraModel,
        MraPreTrainedModel,
    )
else:
  import sys

  __lowerCAmelCase				:      Dict						      =_LazyModule(__name__, globals()["__file__"], _import_structure)



