


"""simple docstring"""







from ...configuration_utils import PretrainedConfig
from ...utils import logging


a__				:							Any						=     logging.get_logger(__name__)

a__				:							Union[str, Any]						=     {
    '''transfo-xl-wt103''': '''https://huggingface.co/transfo-xl-wt103/resolve/main/config.json''',
}




class  UpperCamelCase_	( UpperCamelCase):

	"""simple docstring"""





	snake_case__				:  Optional[int]    					=			"transfo-xl"
	snake_case__				:  Optional[Any]    					=			["mems"]
	snake_case__				:  List[Any]    					=			{
	    "n_token": "vocab_size",
	    "hidden_size": "d_model",
	    "num_attention_heads": "n_head",
	    "num_hidden_layers": "n_layer",
	}




	def __init__( self			:				List[Any]			,			UpperCAmelCase__			:				Union[str, Any]=2_6_7_7_3_5			,			UpperCAmelCase__			:				str=[2_0_0_0_0, 4_0_0_0_0, 2_0_0_0_0_0]			,			UpperCAmelCase__			:				int=1_0_2_4			,			UpperCAmelCase__			:				Optional[int]=1_0_2_4			,			UpperCAmelCase__			:				Union[str, Any]=1_6			,			UpperCAmelCase__			:				Union[str, Any]=6_4			,			UpperCAmelCase__			:				List[Any]=4_0_9_6			,			UpperCAmelCase__			:				Any=4			,			UpperCAmelCase__			:				Any=False			,			UpperCAmelCase__			:				List[str]=1_8			,			UpperCAmelCase__			:				Dict=1_6_0_0			,			UpperCAmelCase__			:				Optional[Any]=1_0_0_0			,			UpperCAmelCase__			:				List[str]=True			,			UpperCAmelCase__			:				Dict=True			,			UpperCAmelCase__			:				Union[str, Any]=0			,			UpperCAmelCase__			:				str=-1			,			UpperCAmelCase__			:				str=True			,			UpperCAmelCase__			:				Optional[int]=0.1			,			UpperCAmelCase__			:				Any=0.0			,			UpperCAmelCase__			:				Any=True			,			UpperCAmelCase__			:				List[Any]="normal"			,			UpperCAmelCase__			:				Any=0.01			,			UpperCAmelCase__			:				str=0.01			,			UpperCAmelCase__			:				Any=0.02			,			UpperCAmelCase__			:				Tuple=1E-5			,			UpperCAmelCase__			:				Optional[int]=0			,			**UpperCAmelCase__			:				Optional[Any]			,			)       ->	List[Any]:
						__SCREAMING_SNAKE_CASE						   =				vocab_size
						__SCREAMING_SNAKE_CASE						   =				[]
						self.cutoffs.extend(UpperCAmelCase__   )
						if proj_share_all_but_first:
											__SCREAMING_SNAKE_CASE						   =				[False] + [True] * len(self.cutoffs   )
						else:
											__SCREAMING_SNAKE_CASE						   =				[False] + [False] * len(self.cutoffs   )
						__SCREAMING_SNAKE_CASE						   =				d_model
						__SCREAMING_SNAKE_CASE						   =				d_embed
						__SCREAMING_SNAKE_CASE						   =				d_head
						__SCREAMING_SNAKE_CASE						   =				d_inner
						__SCREAMING_SNAKE_CASE						   =				div_val
						__SCREAMING_SNAKE_CASE						   =				pre_lnorm
						__SCREAMING_SNAKE_CASE						   =				n_layer
						__SCREAMING_SNAKE_CASE						   =				n_head
						__SCREAMING_SNAKE_CASE						   =				mem_len
						__SCREAMING_SNAKE_CASE						   =				same_length
						__SCREAMING_SNAKE_CASE						   =				attn_type
						__SCREAMING_SNAKE_CASE						   =				clamp_len
						__SCREAMING_SNAKE_CASE						   =				sample_softmax
						__SCREAMING_SNAKE_CASE						   =				adaptive
						__SCREAMING_SNAKE_CASE						   =				dropout
						__SCREAMING_SNAKE_CASE						   =				dropatt
						__SCREAMING_SNAKE_CASE						   =				untie_r
						__SCREAMING_SNAKE_CASE						   =				init
						__SCREAMING_SNAKE_CASE						   =				init_range
						__SCREAMING_SNAKE_CASE						   =				proj_init_std
						__SCREAMING_SNAKE_CASE						   =				init_std
						__SCREAMING_SNAKE_CASE						   =				layer_norm_epsilon
						super().__init__(eos_token_id=UpperCAmelCase__			,			**UpperCAmelCase__   )




	@property
	def   UpperCAmelCase_      ( self			:				Union[str, Any]   )       ->	str:
						# Message copied from Transformer-XL documentation
						logger.info(F"""The model {self.model_type} is one of the few models that has no sequence length limit."""   )
						return -1




	@max_position_embeddings.setter
	def   UpperCAmelCase_      ( self			:				str			,			UpperCAmelCase__			:				str   )       ->	Optional[int]:
						# Message copied from Transformer-XL documentation
						raise NotImplementedError(
						    F"""The model {self.model_type} is one of the few models that has no sequence length limit."""   )


from typing import TYPE_CHECKING

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


lowercase  :					str						    =							{
    """configuration_funnel""": ["""FUNNEL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """FunnelConfig"""],
    """convert_funnel_original_tf_checkpoint_to_pytorch""": [],
    """tokenization_funnel""": ["""FunnelTokenizer"""],
}

try:
  if not is_tokenizers_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  lowercase  :					Tuple						    =							["""FunnelTokenizerFast"""]

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  lowercase  :					List[str]						    =							[
      """FUNNEL_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """FunnelBaseModel""",
      """FunnelForMaskedLM""",
      """FunnelForMultipleChoice""",
      """FunnelForPreTraining""",
      """FunnelForQuestionAnswering""",
      """FunnelForSequenceClassification""",
      """FunnelForTokenClassification""",
      """FunnelModel""",
      """FunnelPreTrainedModel""",
      """load_tf_weights_in_funnel""",
  ]

try:
  if not is_tf_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  lowercase  :					Optional[Any]						    =							[
      """TF_FUNNEL_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """TFFunnelBaseModel""",
      """TFFunnelForMaskedLM""",
      """TFFunnelForMultipleChoice""",
      """TFFunnelForPreTraining""",
      """TFFunnelForQuestionAnswering""",
      """TFFunnelForSequenceClassification""",
      """TFFunnelForTokenClassification""",
      """TFFunnelModel""",
      """TFFunnelPreTrainedModel""",
  ]


if TYPE_CHECKING:
  from .configuration_funnel import FUNNEL_PRETRAINED_CONFIG_ARCHIVE_MAP, FunnelConfig
  from .tokenization_funnel import FunnelTokenizer

  try:
    if not is_tokenizers_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .tokenization_funnel_fast import FunnelTokenizerFast

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_funnel import (
        FUNNEL_PRETRAINED_MODEL_ARCHIVE_LIST,
        FunnelBaseModel,
        FunnelForMaskedLM,
        FunnelForMultipleChoice,
        FunnelForPreTraining,
        FunnelForQuestionAnswering,
        FunnelForSequenceClassification,
        FunnelForTokenClassification,
        FunnelModel,
        FunnelPreTrainedModel,
        load_tf_weights_in_funnel,
    )

  try:
    if not is_tf_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_tf_funnel import (
        TF_FUNNEL_PRETRAINED_MODEL_ARCHIVE_LIST,
        TFFunnelBaseModel,
        TFFunnelForMaskedLM,
        TFFunnelForMultipleChoice,
        TFFunnelForPreTraining,
        TFFunnelForQuestionAnswering,
        TFFunnelForSequenceClassification,
        TFFunnelForTokenClassification,
        TFFunnelModel,
        TFFunnelPreTrainedModel,
    )

else:
  import sys

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