






from collections import OrderedDict
from typing import Mapping

from packaging import version

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


__lowerCamelCase      :    int   		=   logging.get_logger(__name__)

__lowerCamelCase      :    List[Any]   		=   {
    """microsoft/swin-tiny-patch4-window7-224""": (
        """https://huggingface.co/microsoft/swin-tiny-patch4-window7-224/resolve/main/config.json"""
    ),
    # See all Swin models at https://huggingface.co/models?filter=swin
}



class 							SCREAMING_SNAKE_CASE__		(       UpperCamelCase_				,     UpperCamelCase_		):





					"""simple docstring"""






					a_			=	"swin"

					a_			=	{
					    "num_attention_heads": "num_heads",
					    "num_hidden_layers": "num_layers",
					}



					def __init__(      self  :						Optional[int]							,	__A  :						Optional[int]=2_2_4							,	__A  :						Optional[int]=4							,	__A  :						Any=3							,	__A  :						List[Any]=9_6							,	__A  :						Union[str, Any]=[2, 2, 6, 2]							,	__A  :						List[Any]=[3, 6, 1_2, 2_4]							,	__A  :						str=7							,	__A  :						Any=4.0							,	__A  :						int=True							,	__A  :						int=0.0							,	__A  :						Union[str, Any]=0.0							,	__A  :						Union[str, Any]=0.1							,	__A  :						Optional[Any]="gelu"							,	__A  :						Dict=False							,	__A  :						List[Any]=0.0_2							,	__A  :						Any=1e-5							,	__A  :						Optional[int]=3_2							,	__A  :						Optional[int]=None							,	__A  :						str=None							,	**__A  :						Dict							,	):
						super().__init__(**__A )

						snake_case__				:   str     =						image_size
						snake_case__				:   Optional[Any]     =						patch_size
						snake_case__				:   Tuple     =						num_channels
						snake_case__				:   Any     =						embed_dim
						snake_case__				:   Optional[Any]     =						depths
						snake_case__				:   Tuple     =						len(__A )
						snake_case__				:   int     =						num_heads
						snake_case__				:   str     =						window_size
						snake_case__				:   Dict     =						mlp_ratio
						snake_case__				:   List[str]     =						qkv_bias
						snake_case__				:   str     =						hidden_dropout_prob
						snake_case__				:   Optional[Any]     =						attention_probs_dropout_prob
						snake_case__				:   str     =						drop_path_rate
						snake_case__				:   List[str]     =						hidden_act
						snake_case__				:   Union[str, Any]     =						use_absolute_embeddings
						snake_case__				:   Union[str, Any]     =						layer_norm_eps
						snake_case__				:   Optional[Any]     =						initializer_range
						snake_case__				:   Union[str, Any]     =						encoder_stride
						# we set the hidden_size attribute in order to make Swin work with VisionEncoderDecoderModel
						# this indicates the channel dimension after the last stage of the model
						snake_case__				:   Optional[int]     =						int(embed_dim * 2 ** (len(__A ) - 1) )
						snake_case__				:   List[Any]     =						["stem"] + [f'''stage{idx}''' for idx in range(1							,	len(__A ) + 1 )]
						snake_case__				:   int     =						get_aligned_output_features_output_indices(
						    out_features=__A							,	out_indices=__A							,	stage_names=self.stage_names )



class 							SCREAMING_SNAKE_CASE__		(       UpperCamelCase_		):





					"""simple docstring"""






					a_			=	version.parse("1.11"		)



					@property
					def  _lowercase  (      self  :						str ):
						return OrderedDict(
						    [
						        ("pixel_values", {0: "batch", 1: "num_channels", 2: "height", 3: "width"}),
						    ] )






					@property
					def  _lowercase  (      self  :						int ):
						return 1e-4







from typing import TYPE_CHECKING

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


__lowerCamelCase      :    Tuple   		=   {
    """configuration_roberta_prelayernorm""": [
        """ROBERTA_PRELAYERNORM_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """RobertaPreLayerNormConfig""",
        """RobertaPreLayerNormOnnxConfig""",
    ],
}

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	__lowerCamelCase      :    Tuple   		=   [
	    """ROBERTA_PRELAYERNORM_PRETRAINED_MODEL_ARCHIVE_LIST""",
	    """RobertaPreLayerNormForCausalLM""",
	    """RobertaPreLayerNormForMaskedLM""",
	    """RobertaPreLayerNormForMultipleChoice""",
	    """RobertaPreLayerNormForQuestionAnswering""",
	    """RobertaPreLayerNormForSequenceClassification""",
	    """RobertaPreLayerNormForTokenClassification""",
	    """RobertaPreLayerNormModel""",
	    """RobertaPreLayerNormPreTrainedModel""",
	]

try:
	if not is_tf_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	__lowerCamelCase      :    Union[str, Any]   		=   [
	    """TF_ROBERTA_PRELAYERNORM_PRETRAINED_MODEL_ARCHIVE_LIST""",
	    """TFRobertaPreLayerNormForCausalLM""",
	    """TFRobertaPreLayerNormForMaskedLM""",
	    """TFRobertaPreLayerNormForMultipleChoice""",
	    """TFRobertaPreLayerNormForQuestionAnswering""",
	    """TFRobertaPreLayerNormForSequenceClassification""",
	    """TFRobertaPreLayerNormForTokenClassification""",
	    """TFRobertaPreLayerNormMainLayer""",
	    """TFRobertaPreLayerNormModel""",
	    """TFRobertaPreLayerNormPreTrainedModel""",
	]

try:
	if not is_flax_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	__lowerCamelCase      :    List[Any]   		=   [
	    """FlaxRobertaPreLayerNormForCausalLM""",
	    """FlaxRobertaPreLayerNormForMaskedLM""",
	    """FlaxRobertaPreLayerNormForMultipleChoice""",
	    """FlaxRobertaPreLayerNormForQuestionAnswering""",
	    """FlaxRobertaPreLayerNormForSequenceClassification""",
	    """FlaxRobertaPreLayerNormForTokenClassification""",
	    """FlaxRobertaPreLayerNormModel""",
	    """FlaxRobertaPreLayerNormPreTrainedModel""",
	]


if TYPE_CHECKING:
	from .configuration_roberta_prelayernorm import (
	    ROBERTA_PRELAYERNORM_PRETRAINED_CONFIG_ARCHIVE_MAP,
	    RobertaPreLayerNormConfig,
	    RobertaPreLayerNormOnnxConfig,
	)

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_roberta_prelayernorm import (
		    ROBERTA_PRELAYERNORM_PRETRAINED_MODEL_ARCHIVE_LIST,
		    RobertaPreLayerNormForCausalLM,
		    RobertaPreLayerNormForMaskedLM,
		    RobertaPreLayerNormForMultipleChoice,
		    RobertaPreLayerNormForQuestionAnswering,
		    RobertaPreLayerNormForSequenceClassification,
		    RobertaPreLayerNormForTokenClassification,
		    RobertaPreLayerNormModel,
		    RobertaPreLayerNormPreTrainedModel,
		)

	try:
		if not is_tf_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_tf_roberta_prelayernorm import (
		    TF_ROBERTA_PRELAYERNORM_PRETRAINED_MODEL_ARCHIVE_LIST,
		    TFRobertaPreLayerNormForCausalLM,
		    TFRobertaPreLayerNormForMaskedLM,
		    TFRobertaPreLayerNormForMultipleChoice,
		    TFRobertaPreLayerNormForQuestionAnswering,
		    TFRobertaPreLayerNormForSequenceClassification,
		    TFRobertaPreLayerNormForTokenClassification,
		    TFRobertaPreLayerNormMainLayer,
		    TFRobertaPreLayerNormModel,
		    TFRobertaPreLayerNormPreTrainedModel,
		)

	try:
		if not is_flax_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_flax_roberta_prelayernorm import (
		    FlaxRobertaPreLayerNormForCausalLM,
		    FlaxRobertaPreLayerNormForMaskedLM,
		    FlaxRobertaPreLayerNormForMultipleChoice,
		    FlaxRobertaPreLayerNormForQuestionAnswering,
		    FlaxRobertaPreLayerNormForSequenceClassification,
		    FlaxRobertaPreLayerNormForTokenClassification,
		    FlaxRobertaPreLayerNormModel,
		    FlaxRobertaPreLayerNormPreTrainedModel,
		)

else:
	import sys

	__lowerCamelCase      :    Dict   		=   _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)



