


'''simple docstring'''







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


a__  :					str        =       logging.get_logger(__name__)

a__  :					str        =       {
    '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 					lowercase_     (    a__  ,						a__   ):
    __UpperCAmelCase   			=	'swin'

    __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=None  ,					a=None  ,					**a  ,					):
          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 Swin work with VisionEncoderDecoderModel
          # this indicates the channel dimension after the last stage of the model
          UpperCamelCase__										=				int(embed_dim * 2 ** (len(a    ) - 1)    )
          UpperCamelCase__										=				["stem"] + [f'''stage{idx}''' for idx in range(1  ,					len(a    ) + 1    )]
          UpperCamelCase__					,	UpperCamelCase__										=				get_aligned_output_features_output_indices(
              out_features=a  ,					out_indices=a  ,					stage_names=self.stage_names    )

class 					lowercase_     (    a__   ):
    __UpperCAmelCase   			=	version.parse('1.11'   )


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


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













"""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		:  Dict						=		{
    'configuration_roberta': ['ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP', 'RobertaConfig', 'RobertaOnnxConfig'],
    'tokenization_roberta': ['RobertaTokenizer'],
}

try:
    if not is_tokenizers_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    _UpperCamelCase		:  str						=		['RobertaTokenizerFast']

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    _UpperCamelCase		:  Tuple						=		[
        'ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST',
        'RobertaForCausalLM',
        'RobertaForMaskedLM',
        'RobertaForMultipleChoice',
        'RobertaForQuestionAnswering',
        'RobertaForSequenceClassification',
        'RobertaForTokenClassification',
        'RobertaModel',
        'RobertaPreTrainedModel',
    ]

try:
    if not is_tf_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    _UpperCamelCase		:  List[Any]						=		[
        'TF_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST',
        'TFRobertaForCausalLM',
        'TFRobertaForMaskedLM',
        'TFRobertaForMultipleChoice',
        'TFRobertaForQuestionAnswering',
        'TFRobertaForSequenceClassification',
        'TFRobertaForTokenClassification',
        'TFRobertaMainLayer',
        'TFRobertaModel',
        'TFRobertaPreTrainedModel',
    ]

try:
    if not is_flax_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    _UpperCamelCase		:  Optional[int]						=		[
        'FlaxRobertaForCausalLM',
        'FlaxRobertaForMaskedLM',
        'FlaxRobertaForMultipleChoice',
        'FlaxRobertaForQuestionAnswering',
        'FlaxRobertaForSequenceClassification',
        'FlaxRobertaForTokenClassification',
        'FlaxRobertaModel',
        'FlaxRobertaPreTrainedModel',
    ]


if TYPE_CHECKING:
    from .configuration_roberta import ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP, RobertaConfig, RobertaOnnxConfig
    from .tokenization_roberta import RobertaTokenizer

    try:
        if not is_tokenizers_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .tokenization_roberta_fast import RobertaTokenizerFast

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_roberta import (
            ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST,
            RobertaForCausalLM,
            RobertaForMaskedLM,
            RobertaForMultipleChoice,
            RobertaForQuestionAnswering,
            RobertaForSequenceClassification,
            RobertaForTokenClassification,
            RobertaModel,
            RobertaPreTrainedModel,
        )

    try:
        if not is_tf_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_tf_roberta import (
            TF_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST,
            TFRobertaForCausalLM,
            TFRobertaForMaskedLM,
            TFRobertaForMultipleChoice,
            TFRobertaForQuestionAnswering,
            TFRobertaForSequenceClassification,
            TFRobertaForTokenClassification,
            TFRobertaMainLayer,
            TFRobertaModel,
            TFRobertaPreTrainedModel,
        )

    try:
        if not is_flax_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_flax_roberta import (
            FlaxRobertaForCausalLM,
            FlaxRobertaForMaskedLM,
            FlaxRobertaForMultipleChoice,
            FlaxRobertaForQuestionAnswering,
            FlaxRobertaForSequenceClassification,
            FlaxRobertaForTokenClassification,
            FlaxRobertaModel,
            FlaxRobertaPreTrainedModel,
        )

else:
    import sys

    _UpperCamelCase		:  Optional[Any]						=		_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)


