





'''simple docstring'''



from typing import TYPE_CHECKING

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


__magic_name__   :						Tuple    =			{
    """configuration_deberta""": ["""DEBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """DebertaConfig""", """DebertaOnnxConfig"""],
    """tokenization_deberta""": ["""DebertaTokenizer"""],
}

try:
   if not is_tokenizers_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   __magic_name__   :						Union[str, Any]    =			["""DebertaTokenizerFast"""]

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   __magic_name__   :						List[Any]    =			[
       """DEBERTA_PRETRAINED_MODEL_ARCHIVE_LIST""",
       """DebertaForMaskedLM""",
       """DebertaForQuestionAnswering""",
       """DebertaForSequenceClassification""",
       """DebertaForTokenClassification""",
       """DebertaModel""",
       """DebertaPreTrainedModel""",
   ]

try:
   if not is_tf_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   __magic_name__   :						int    =			[
       """TF_DEBERTA_PRETRAINED_MODEL_ARCHIVE_LIST""",
       """TFDebertaForMaskedLM""",
       """TFDebertaForQuestionAnswering""",
       """TFDebertaForSequenceClassification""",
       """TFDebertaForTokenClassification""",
       """TFDebertaModel""",
       """TFDebertaPreTrainedModel""",
   ]


if TYPE_CHECKING:
   from .configuration_deberta import DEBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP, DebertaConfig, DebertaOnnxConfig
   from .tokenization_deberta import DebertaTokenizer

   try:
      if not is_tokenizers_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .tokenization_deberta_fast import DebertaTokenizerFast

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_deberta import (
          DEBERTA_PRETRAINED_MODEL_ARCHIVE_LIST,
          DebertaForMaskedLM,
          DebertaForQuestionAnswering,
          DebertaForSequenceClassification,
          DebertaForTokenClassification,
          DebertaModel,
          DebertaPreTrainedModel,
      )

   try:
      if not is_tf_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_tf_deberta import (
          TF_DEBERTA_PRETRAINED_MODEL_ARCHIVE_LIST,
          TFDebertaForMaskedLM,
          TFDebertaForQuestionAnswering,
          TFDebertaForSequenceClassification,
          TFDebertaForTokenClassification,
          TFDebertaModel,
          TFDebertaPreTrainedModel,
      )


else:
   import sys

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









'''simple docstring'''



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


__magic_name__   :						Any    =			logging.get_logger(__name__)

__magic_name__   :						Dict    =			{
    """google/bit-50""": """https://huggingface.co/google/bit-50/resolve/main/config.json""",
}


class       __SCREAMING_SNAKE_CASE	(						__UpperCamelCase					,    __UpperCamelCase			):



     '''simple docstring'''






     UpperCAmelCase__       :						List[str]      =   '''bit'''
     UpperCAmelCase__       :						Union[str, Any]      =   ['''preactivation''', '''bottleneck''']
     UpperCAmelCase__       :						int      =   ['''SAME''', '''VALID''']

     def __init__(					self						,   lowerCamelCase=3						,   lowerCamelCase=64						,   lowerCamelCase=[256, 512, 1_024, 2_048]						,   lowerCamelCase=[3, 4, 6, 3]						,   lowerCamelCase="preactivation"						,   lowerCamelCase="relu"						,   lowerCamelCase=None						,   lowerCamelCase=32						,   lowerCamelCase=0.0						,   lowerCamelCase=False						,   lowerCamelCase=32						,   lowerCamelCase=1						,   lowerCamelCase=None						,   lowerCamelCase=None						,   **lowerCamelCase						,   ):
       super().__init__(**lowerCamelCase	)
       if layer_type not in self.layer_types:
         raise ValueError(F'''layer_type={layer_type} is not one of {",".join(self.layer_types	)}'''	)
       if global_padding is not None:
         if global_padding.upper() in self.supported_padding:
           _snake_case     		=				global_padding.upper()
         else:
           raise ValueError(F'''Padding strategy {global_padding} not supported'''	)
       _snake_case     		=				num_channels
       _snake_case     		=				embedding_size
       _snake_case     		=				hidden_sizes
       _snake_case     		=				depths
       _snake_case     		=				layer_type
       _snake_case     		=				hidden_act
       _snake_case     		=				global_padding
       _snake_case     		=				num_groups
       _snake_case     		=				drop_path_rate
       _snake_case     		=				embedding_dynamic_padding
       _snake_case     		=				output_stride
       _snake_case     		=				width_factor

       _snake_case     		=				["stem"] + [F'''stage{idx}''' for idx in range(1						,   len(lowerCamelCase	) + 1	)]
       _snake_case		,		_snake_case     		=				get_aligned_output_features_output_indices(
           out_features=lowerCamelCase						,   out_indices=lowerCamelCase						,   stage_names=self.stage_names	)


