'''simple docstring'''






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


SCREAMING_SNAKE_CASE_	   =			logging.get_logger(__name__)




class    a (       __lowerCAmelCase						,  __lowerCAmelCase				):



  """simple docstring"""
  __lowerCAmelCase				      =					"""maskformer-swin"""

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







  def __init__(							self   ,    snake_case_=224   ,    snake_case_=4   ,    snake_case_=3   ,    snake_case_=96   ,    snake_case_=[2, 2, 6, 2]   ,    snake_case_=[3, 6, 12, 24]   ,    snake_case_=7   ,    snake_case_=4.0   ,    snake_case_=True   ,    snake_case_=0.0   ,    snake_case_=0.0   ,    snake_case_=0.1   ,    snake_case_="gelu"   ,    snake_case_=False   ,    snake_case_=0.0_2   ,    snake_case_=1e-5   ,    snake_case_=None   ,    snake_case_=None   ,    **snake_case_   ,    ):

    '''simple docstring'''







    super().__init__(**snake_case_					)

    __UpperCAmelCase:					Tuple		= image_size
    __UpperCAmelCase:					Tuple		= patch_size
    __UpperCAmelCase:					int		= num_channels
    __UpperCAmelCase:					Dict		= embed_dim
    __UpperCAmelCase:					Union[str, Any]		= depths
    __UpperCAmelCase:					List[Any]		= len(snake_case_					)
    __UpperCAmelCase:					Optional[int]		= num_heads
    __UpperCAmelCase:					Dict		= window_size
    __UpperCAmelCase:					Union[str, Any]		= mlp_ratio
    __UpperCAmelCase:					Optional[int]		= qkv_bias
    __UpperCAmelCase:					List[str]		= hidden_dropout_prob
    __UpperCAmelCase:					List[Any]		= attention_probs_dropout_prob
    __UpperCAmelCase:					Union[str, Any]		= drop_path_rate
    __UpperCAmelCase:					Union[str, Any]		= hidden_act
    __UpperCAmelCase:					List[Any]		= use_absolute_embeddings
    __UpperCAmelCase:					Optional[int]		= layer_norm_eps
    __UpperCAmelCase:					int		= initializer_range
    # 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:					Dict		= int(embed_dim * 2 ** (len(snake_case_					) - 1)					)
    __UpperCAmelCase:					Union[str, Any]		= ["""stem"""] + [F'''stage{idx}''' for idx in range(1   ,    len(snake_case_					) + 1					)]
    __UpperCAmelCase, __UpperCAmelCase:					Union[str, Any]		= get_aligned_output_features_output_indices(
        out_features=snake_case_   ,    out_indices=snake_case_   ,    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,
)


SCREAMING_SNAKE_CASE_	   =			{
    'configuration_electra': ['ELECTRA_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ElectraConfig', 'ElectraOnnxConfig'],
    'tokenization_electra': ['ElectraTokenizer'],
}

try:
    if not is_tokenizers_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    SCREAMING_SNAKE_CASE_	   =			['ElectraTokenizerFast']

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    SCREAMING_SNAKE_CASE_	   =			[
        'ELECTRA_PRETRAINED_MODEL_ARCHIVE_LIST',
        'ElectraForCausalLM',
        'ElectraForMaskedLM',
        'ElectraForMultipleChoice',
        'ElectraForPreTraining',
        'ElectraForQuestionAnswering',
        'ElectraForSequenceClassification',
        'ElectraForTokenClassification',
        'ElectraModel',
        'ElectraPreTrainedModel',
        'load_tf_weights_in_electra',
    ]

try:
    if not is_tf_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    SCREAMING_SNAKE_CASE_	   =			[
        'TF_ELECTRA_PRETRAINED_MODEL_ARCHIVE_LIST',
        'TFElectraForMaskedLM',
        'TFElectraForMultipleChoice',
        'TFElectraForPreTraining',
        'TFElectraForQuestionAnswering',
        'TFElectraForSequenceClassification',
        'TFElectraForTokenClassification',
        'TFElectraModel',
        'TFElectraPreTrainedModel',
    ]

try:
    if not is_flax_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    SCREAMING_SNAKE_CASE_	   =			[
        'FlaxElectraForCausalLM',
        'FlaxElectraForMaskedLM',
        'FlaxElectraForMultipleChoice',
        'FlaxElectraForPreTraining',
        'FlaxElectraForQuestionAnswering',
        'FlaxElectraForSequenceClassification',
        'FlaxElectraForTokenClassification',
        'FlaxElectraModel',
        'FlaxElectraPreTrainedModel',
    ]


if TYPE_CHECKING:
    from .configuration_electra import ELECTRA_PRETRAINED_CONFIG_ARCHIVE_MAP, ElectraConfig, ElectraOnnxConfig
    from .tokenization_electra import ElectraTokenizer

    try:
        if not is_tokenizers_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .tokenization_electra_fast import ElectraTokenizerFast

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_electra import (
            ELECTRA_PRETRAINED_MODEL_ARCHIVE_LIST,
            ElectraForCausalLM,
            ElectraForMaskedLM,
            ElectraForMultipleChoice,
            ElectraForPreTraining,
            ElectraForQuestionAnswering,
            ElectraForSequenceClassification,
            ElectraForTokenClassification,
            ElectraModel,
            ElectraPreTrainedModel,
            load_tf_weights_in_electra,
        )

    try:
        if not is_tf_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_tf_electra import (
            TF_ELECTRA_PRETRAINED_MODEL_ARCHIVE_LIST,
            TFElectraForMaskedLM,
            TFElectraForMultipleChoice,
            TFElectraForPreTraining,
            TFElectraForQuestionAnswering,
            TFElectraForSequenceClassification,
            TFElectraForTokenClassification,
            TFElectraModel,
            TFElectraPreTrainedModel,
        )

    try:
        if not is_flax_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_flax_electra import (
            FlaxElectraForCausalLM,
            FlaxElectraForMaskedLM,
            FlaxElectraForMultipleChoice,
            FlaxElectraForPreTraining,
            FlaxElectraForQuestionAnswering,
            FlaxElectraForSequenceClassification,
            FlaxElectraForTokenClassification,
            FlaxElectraModel,
            FlaxElectraPreTrainedModel,
        )

else:
    import sys

    SCREAMING_SNAKE_CASE_	   =			_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)