





"""simple docstring"""






from typing import TYPE_CHECKING

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


A			      =	{'''configuration_xlnet''': ['''XLNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''XLNetConfig''']}

try:
		if not is_sentencepiece_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		A			      =	['''XLNetTokenizer''']

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

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		A			      =	[
		    '''XLNET_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''XLNetForMultipleChoice''',
		    '''XLNetForQuestionAnswering''',
		    '''XLNetForQuestionAnsweringSimple''',
		    '''XLNetForSequenceClassification''',
		    '''XLNetForTokenClassification''',
		    '''XLNetLMHeadModel''',
		    '''XLNetModel''',
		    '''XLNetPreTrainedModel''',
		    '''load_tf_weights_in_xlnet''',
		]

try:
		if not is_tf_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		A			      =	[
		    '''TF_XLNET_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''TFXLNetForMultipleChoice''',
		    '''TFXLNetForQuestionAnsweringSimple''',
		    '''TFXLNetForSequenceClassification''',
		    '''TFXLNetForTokenClassification''',
		    '''TFXLNetLMHeadModel''',
		    '''TFXLNetMainLayer''',
		    '''TFXLNetModel''',
		    '''TFXLNetPreTrainedModel''',
		]


if TYPE_CHECKING:
		from .configuration_xlnet import XLNET_PRETRAINED_CONFIG_ARCHIVE_MAP, XLNetConfig

		try:
				if not is_sentencepiece_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_xlnet import XLNetTokenizer

		try:
				if not is_tokenizers_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_xlnet_fast import XLNetTokenizerFast

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_xlnet import (
				    XLNET_PRETRAINED_MODEL_ARCHIVE_LIST,
				    XLNetForMultipleChoice,
				    XLNetForQuestionAnswering,
				    XLNetForQuestionAnsweringSimple,
				    XLNetForSequenceClassification,
				    XLNetForTokenClassification,
				    XLNetLMHeadModel,
				    XLNetModel,
				    XLNetPreTrainedModel,
				    load_tf_weights_in_xlnet,
				)

		try:
				if not is_tf_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_tf_xlnet import (
				    TF_XLNET_PRETRAINED_MODEL_ARCHIVE_LIST,
				    TFXLNetForMultipleChoice,
				    TFXLNetForQuestionAnsweringSimple,
				    TFXLNetForSequenceClassification,
				    TFXLNetForTokenClassification,
				    TFXLNetLMHeadModel,
				    TFXLNetMainLayer,
				    TFXLNetModel,
				    TFXLNetPreTrainedModel,
				)

else:
		import sys

		A			      =	_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


SCREAMING_SNAKE_CASE							=						logging.get_logger(__name__)

SCREAMING_SNAKE_CASE							=						{
    'google/bit-50': 'https://huggingface.co/google/bit-50/resolve/main/config.json',
}
class UpperCAmelCase_       (     __A					,							__A					):




      """simple docstring"""




      UpperCamelCase_             =      '''bit'''
      UpperCamelCase_             =      ['''preactivation''', '''bottleneck''']
      UpperCamelCase_             =      ['''SAME''', '''VALID''']






      def __init__(			self      :		Any  ,   UpperCAmelCase      :		Optional[int]=3  ,   UpperCAmelCase      :		Any=64  ,   UpperCAmelCase      :		List[str]=[256, 512, 1024, 2048]  ,   UpperCAmelCase      :		Dict=[3, 4, 6, 3]  ,   UpperCAmelCase      :		List[Any]="preactivation"  ,   UpperCAmelCase      :		Tuple="relu"  ,   UpperCAmelCase      :		Tuple=None  ,   UpperCAmelCase      :		Tuple=32  ,   UpperCAmelCase      :		Optional[int]=0.0  ,   UpperCAmelCase      :		Union[str, Any]=False  ,   UpperCAmelCase      :		Dict=32  ,   UpperCAmelCase      :		Any=1  ,   UpperCAmelCase      :		str=None  ,   UpperCAmelCase      :		Union[str, Any]=None  ,   **UpperCAmelCase      :		str  ,   )	->	Dict:


       '''simple docstring'''

       super().__init__(**UpperCAmelCase		)
       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:
         lowercase       : Any						=global_padding.upper()
        else:
         raise ValueError(f'Padding strategy {global_padding} not supported'		)
       lowercase       : List[Any]						=num_channels
       lowercase       : List[str]						=embedding_size
       lowercase       : Union[str, Any]						=hidden_sizes
       lowercase       : Union[str, Any]						=depths
       lowercase       : Optional[int]						=layer_type
       lowercase       : Optional[Any]						=hidden_act
       lowercase       : List[str]						=global_padding
       lowercase       : Dict						=num_groups
       lowercase       : Optional[Any]						=drop_path_rate
       lowercase       : Union[str, Any]						=embedding_dynamic_padding
       lowercase       : Any						=output_stride
       lowercase       : Union[str, Any]						=width_factor

       lowercase       : Union[str, Any]						=['''stem'''] + [f'stage{idx}' for idx in range(1  ,   len(UpperCAmelCase		) + 1		)]
       lowercase	,		lowercase       : List[str]						=get_aligned_output_features_output_indices(
           out_features=UpperCAmelCase  ,   out_indices=UpperCAmelCase  ,   stage_names=self.stage_names		)



