

from typing import TYPE_CHECKING

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


__lowercase     : str       =						{'''configuration_xlnet''': ['''XLNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''XLNetConfig''']}

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

try:
     if not is_tokenizers_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     __lowercase     : Union[str, Any]       =						['''XLNetTokenizerFast''']

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     __lowercase     : str       =						[
         '''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:
     __lowercase     : Tuple       =						[
         '''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

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







from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


_lowerCAmelCase:						str   				=       logging.get_logger(__name__)

_lowerCAmelCase:						Any   				=       {
    'google/bigbird-roberta-base': 'https://huggingface.co/google/bigbird-roberta-base/resolve/main/config.json',
    'google/bigbird-roberta-large': 'https://huggingface.co/google/bigbird-roberta-large/resolve/main/config.json',
    'google/bigbird-base-trivia-itc': 'https://huggingface.co/google/bigbird-base-trivia-itc/resolve/main/config.json',
    # See all BigBird models at https://huggingface.co/models?filter=big_bird
}




class       lowercase_					(lowercase__   ):
				snake_case	    ='big_bird'





				def __init__(				self       ,  lowercase_=50358       ,  lowercase_=768       ,  lowercase_=12       ,  lowercase_=12       ,  lowercase_=3072       ,  lowercase_="gelu_new"       ,  lowercase_=0.1       ,  lowercase_=0.1       ,  lowercase_=4096       ,  lowercase_=2       ,  lowercase_=0.02       ,  lowercase_=1e-12       ,  lowercase_=True       ,  lowercase_=0       ,  lowercase_=1       ,  lowercase_=2       ,  lowercase_=66       ,  lowercase_="block_sparse"       ,  lowercase_=True       ,  lowercase_=False       ,  lowercase_=64       ,  lowercase_=3       ,  lowercase_=None       ,  **lowercase_       ,  )  -> Any:
											super().__init__(
											    pad_token_id=lowercase_       ,  bos_token_id=lowercase_       ,  eos_token_id=lowercase_       ,  sep_token_id=lowercase_       ,  **lowercase_       ,  )

											a__      =vocab_size
											a__      =max_position_embeddings
											a__      =hidden_size
											a__      =num_hidden_layers
											a__      =num_attention_heads
											a__      =intermediate_size
											a__      =hidden_act
											a__      =hidden_dropout_prob
											a__      =attention_probs_dropout_prob
											a__      =initializer_range
											a__      =type_vocab_size
											a__      =layer_norm_eps
											a__      =use_cache

											a__      =rescale_embeddings
											a__      =attention_type
											a__      =use_bias
											a__      =block_size
											a__      =num_random_blocks
											a__      =classifier_dropout







class       lowercase_					(lowercase__   ):





				@property
				def 						__UpperCamelCase    (				self)  -> Mapping[str, Mapping[int, str]]:
											if self.task == "multiple-choice":
																		a__      ={0: 'batch', 1: 'choice', 2: 'sequence'}
											else:
																		a__      ={0: 'batch', 1: 'sequence'}
											return OrderedDict(
											    [
											        ('input_ids', dynamic_axis),
											        ('attention_mask', dynamic_axis),
											    ])

