





"""simple docstring"""





from typing import TYPE_CHECKING

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


lowerCAmelCase__     			=			{
    '''configuration_roberta_prelayernorm''': [
        '''ROBERTA_PRELAYERNORM_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''RobertaPreLayerNormConfig''',
        '''RobertaPreLayerNormOnnxConfig''',
    ],
}

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						lowerCAmelCase__     			=			[
						    '''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__     			=			[
						    '''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__     			=			[
						    '''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__     			=			_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)













"""simple docstring"""





from ...configuration_utils import PretrainedConfig
from ...utils import logging


lowerCAmelCase__     			=			logging.get_logger(__name__)

lowerCAmelCase__     			=			{
    '''microsoft/swinv2-tiny-patch4-window8-256''': (
        '''https://huggingface.co/microsoft/swinv2-tiny-patch4-window8-256/resolve/main/config.json'''
    ),
}





class        _lowerCamelCase      (       _lowercase ):
						UpperCAmelCase_ =			"swinv2"

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


						def __init__(self   ,							__a=2_24   ,							__a=4   ,							__a=3   ,							__a=96   ,							__a=[2, 2, 6, 2]   ,							__a=[3, 6, 12, 24]   ,							__a=7   ,							__a=4.0   ,							__a=True   ,							__a=0.0   ,							__a=0.0   ,							__a=0.1   ,							__a="gelu"   ,							__a=False   ,							__a=0.02   ,							__a=1e-5   ,							__a=32   ,							**__a   ,							) ->   Optional[Any]:
								super().__init__(**__a		)

								UpperCamelCase   =	image_size
								UpperCamelCase   =	patch_size
								UpperCamelCase   =	num_channels
								UpperCamelCase   =	embed_dim
								UpperCamelCase   =	depths
								UpperCamelCase   =	len(__a		)
								UpperCamelCase   =	num_heads
								UpperCamelCase   =	window_size
								UpperCamelCase   =	mlp_ratio
								UpperCamelCase   =	qkv_bias
								UpperCamelCase   =	hidden_dropout_prob
								UpperCamelCase   =	attention_probs_dropout_prob
								UpperCamelCase   =	drop_path_rate
								UpperCamelCase   =	hidden_act
								UpperCamelCase   =	use_absolute_embeddings
								UpperCamelCase   =	layer_norm_eps
								UpperCamelCase   =	initializer_range
								UpperCamelCase   =	encoder_stride
								# we set the hidden_size attribute in order to make Swinv2 work with VisionEncoderDecoderModel
								# this indicates the channel dimension after the last stage of the model
								UpperCamelCase   =	int(embed_dim * 2 ** (len(__a		) - 1)		)
								UpperCamelCase   =	(0, 0, 0, 0)






