


'''simple docstring'''




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


_a   :   Dict												=   logging.get_logger(__name__)

_a   :   Optional[Any]												=   {
    "google/bit-50": "https://huggingface.co/google/bit-50/resolve/main/config.json",
}




class 			_lowercase (	__lowercase						,					__lowercase							):
   _SCREAMING_SNAKE_CASE  :  Any          =	"bit"
   _SCREAMING_SNAKE_CASE  :  List[str]          =	["preactivation", "bottleneck"]
   _SCREAMING_SNAKE_CASE  :  List[str]          =	["SAME", "VALID"]
   def __init__(						self       :      List[Any]       ,   SCREAMING_SNAKE_CASE_       :      List[str]=3       ,   SCREAMING_SNAKE_CASE_       :      int=64       ,   SCREAMING_SNAKE_CASE_       :      str=[256, 512, 1024, 2048]       ,   SCREAMING_SNAKE_CASE_       :      Any=[3, 4, 6, 3]       ,   SCREAMING_SNAKE_CASE_       :      Union[str, Any]="preactivation"       ,   SCREAMING_SNAKE_CASE_       :      str="relu"       ,   SCREAMING_SNAKE_CASE_       :      Union[str, Any]=None       ,   SCREAMING_SNAKE_CASE_       :      Any=32       ,   SCREAMING_SNAKE_CASE_       :      Union[str, Any]=0.0       ,   SCREAMING_SNAKE_CASE_       :      int=False       ,   SCREAMING_SNAKE_CASE_       :      str=32       ,   SCREAMING_SNAKE_CASE_       :      List[Any]=1       ,   SCREAMING_SNAKE_CASE_       :      str=None       ,   SCREAMING_SNAKE_CASE_       :      Dict=None       ,   **SCREAMING_SNAKE_CASE_       :      Tuple       ,   ) ->							Any:
        super().__init__(**SCREAMING_SNAKE_CASE_      )
        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(SCREAMING_SNAKE_CASE_      ) + 1      )]
        __snake_case      ,       __snake_case           =						get_aligned_output_features_output_indices(
            out_features=SCREAMING_SNAKE_CASE_       ,   out_indices=SCREAMING_SNAKE_CASE_       ,   stage_names=self.stage_names      )







"""simple docstring"""





from typing import TYPE_CHECKING

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


__UpperCamelCase    : List[str]				 =						{'''configuration_xglm''': ['''XGLM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''XGLMConfig''']}

try:
							if not is_sentencepiece_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__UpperCamelCase    : Union[str, Any]				 =						['''XGLMTokenizer''']

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

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__UpperCamelCase    : Optional[int]				 =						[
							    '''XGLM_PRETRAINED_MODEL_ARCHIVE_LIST''',
							    '''XGLMForCausalLM''',
							    '''XGLMModel''',
							    '''XGLMPreTrainedModel''',
							]


try:
							if not is_flax_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__UpperCamelCase    : str				 =						[
							    '''FlaxXGLMForCausalLM''',
							    '''FlaxXGLMModel''',
							    '''FlaxXGLMPreTrainedModel''',
							]


try:
							if not is_tf_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__UpperCamelCase    : str				 =						[
							    '''TF_XGLM_PRETRAINED_MODEL_ARCHIVE_LIST''',
							    '''TFXGLMForCausalLM''',
							    '''TFXGLMModel''',
							    '''TFXGLMPreTrainedModel''',
							]


if TYPE_CHECKING:
							from .configuration_xglm import XGLM_PRETRAINED_CONFIG_ARCHIVE_MAP, XGLMConfig

							try:
														if not is_sentencepiece_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .tokenization_xglm import XGLMTokenizer

							try:
														if not is_tokenizers_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .tokenization_xglm_fast import XGLMTokenizerFast

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_xglm import XGLM_PRETRAINED_MODEL_ARCHIVE_LIST, XGLMForCausalLM, XGLMModel, XGLMPreTrainedModel

							try:
														if not is_flax_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_flax_xglm import FlaxXGLMForCausalLM, FlaxXGLMModel, FlaxXGLMPreTrainedModel

							try:
														if not is_tf_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_tf_xglm import (
														    TF_XGLM_PRETRAINED_MODEL_ARCHIVE_LIST,
														    TFXGLMForCausalLM,
														    TFXGLMModel,
														    TFXGLMPreTrainedModel,
														)


else:
							import sys

							__UpperCamelCase    : Optional[int]				 =						_LazyModule(__name__, globals()['''__file__'''], _import_structure)




