'''simple docstring'''




import warnings

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


_lowercase		:				List[str]	       =		logging.get_logger(__name__)

_lowercase		:				Union[str, Any]	       =		{
    '''xlnet-base-cased''': '''https://huggingface.co/xlnet-base-cased/resolve/main/config.json''',
    '''xlnet-large-cased''': '''https://huggingface.co/xlnet-large-cased/resolve/main/config.json''',
}





class 					__magic_name__		(					a__):
			UpperCamelCase__       = """xlnet"""
			UpperCamelCase__       = ["""mems"""]
			UpperCamelCase__       = {
			    """n_token""": """vocab_size""",  # Backward compatibility
			    """hidden_size""": """d_model""",
			    """num_attention_heads""": """n_head""",
			    """num_hidden_layers""": """n_layer""",
			}







			def __init__(			self       :						str       ,    lowercase_       :						Dict=32000       ,    lowercase_       :						List[str]=1024       ,    lowercase_       :						Any=24       ,    lowercase_       :						List[str]=16       ,    lowercase_       :						Optional[Any]=4096       ,    lowercase_       :						List[Any]="gelu"       ,    lowercase_       :						int=True       ,    lowercase_       :						List[str]="bi"       ,    lowercase_       :						Union[str, Any]=0.02       ,    lowercase_       :						List[str]=1E-12       ,    lowercase_       :						int=0.1       ,    lowercase_       :						str=512       ,    lowercase_       :						Dict=None       ,    lowercase_       :						Union[str, Any]=True       ,    lowercase_       :						Any=False       ,    lowercase_       :						int=False       ,    lowercase_       :						List[str]=-1       ,    lowercase_       :						Optional[int]=False       ,    lowercase_       :						Dict="last"       ,    lowercase_       :						Dict=True       ,    lowercase_       :						str="tanh"       ,    lowercase_       :						Union[str, Any]=0.1       ,    lowercase_       :						List[str]=5       ,    lowercase_       :						List[str]=5       ,    lowercase_       :						Any=5       ,    lowercase_       :						Dict=1       ,    lowercase_       :						List[str]=2       ,    **lowercase_       :						List[str]       ,    ):
										lowercase_      :    Any       		= vocab_size
										lowercase_      :    Tuple       		= d_model
										lowercase_      :    Tuple       		= n_layer
										lowercase_      :    Tuple       		= n_head
										if d_model % n_head != 0:
																	raise ValueError(f'''\'d_model % n_head\' ({d_model % n_head}) should be equal to 0'''					)
										if "d_head" in kwargs:
																	if kwargs["d_head"] != d_model // n_head:
																								raise ValueError(
																								    f'''`d_head` ({kwargs['d_head']}) should be equal to `d_model // n_head` ({d_model // n_head})'''					)
										lowercase_      :    Tuple       		= d_model // n_head
										lowercase_      :    Optional[Any]       		= ff_activation
										lowercase_      :    List[Any]       		= d_inner
										lowercase_      :    Any       		= untie_r
										lowercase_      :    str       		= attn_type

										lowercase_      :    List[Any]       		= initializer_range
										lowercase_      :    Any       		= layer_norm_eps

										lowercase_      :    List[Any]       		= dropout
										lowercase_      :    List[Any]       		= mem_len
										lowercase_      :    Optional[Any]       		= reuse_len
										lowercase_      :    List[str]       		= bi_data
										lowercase_      :    Dict       		= clamp_len
										lowercase_      :    Any       		= same_length

										lowercase_      :    int       		= summary_type
										lowercase_      :    str       		= summary_use_proj
										lowercase_      :    Tuple       		= summary_activation
										lowercase_      :    Tuple       		= summary_last_dropout
										lowercase_      :    List[Any]       		= start_n_top
										lowercase_      :    Tuple       		= end_n_top

										lowercase_      :    Dict       		= bos_token_id
										lowercase_      :    List[Any]       		= pad_token_id
										lowercase_      :    Dict       		= eos_token_id

										if "use_cache" in kwargs:
																	warnings.warn(
																	    """The `use_cache` argument is deprecated and will be removed in a future version, use `use_mems_eval`"""
																	    """ instead."""       ,    lowerCAmelCase__       ,    )
																	lowercase_      :    Union[str, Any]       		= kwargs["use_cache"]

										lowercase_      :    Optional[Any]       		= use_mems_eval
										lowercase_      :    Dict       		= use_mems_train
										super().__init__(pad_token_id=lowerCAmelCase__       ,    bos_token_id=lowerCAmelCase__       ,    eos_token_id=lowerCAmelCase__       ,    **lowerCAmelCase__					)







			@property
			def 			SCREAMING_SNAKE_CASE_  (			self       :						Optional[Any]					):
										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 			SCREAMING_SNAKE_CASE_  (			self       :						Optional[int]       ,    lowercase_       :						Optional[Any]					):
										# 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.'''					)






'''simple docstring'''




import pytest

import datasets.config
from datasets.utils.info_utils import is_small_dataset




@pytest.mark.parametrize("""dataset_size"""   ,   [None, 400 * 2**20, 600 * 2**20]				)
@pytest.mark.parametrize("""input_in_memory_max_size"""   ,   ["""default""", 0, 100 * 2**20, 900 * 2**20]				)
def 							lowerCamelCase			(   UpperCAmelCase__ :      Union[str, Any]   ,   UpperCAmelCase__ :      List[Any]   ,   UpperCAmelCase__ :      str				)    ->   Any:
							if input_in_memory_max_size != "default":
														monkeypatch.setattr(datasets.config   ,   """IN_MEMORY_MAX_SIZE"""   ,   UpperCAmelCase__				)
							lowercase_      :    List[Any]       		= datasets.config.IN_MEMORY_MAX_SIZE
							if input_in_memory_max_size == "default":
														assert in_memory_max_size == 0
							else:
														assert in_memory_max_size == input_in_memory_max_size
							if dataset_size and in_memory_max_size:
														lowercase_      :    str       		= dataset_size < in_memory_max_size
							else:
														lowercase_      :    List[Any]       		= False
							lowercase_      :    Any       		= is_small_dataset(UpperCAmelCase__				)
							assert result == expected





