






"""simple docstring"""



from typing import Callable, Optional, Union

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


A_      =							logging.get_logger(__name__)

A_      =							{
    '''microsoft/xprophetnet-large-wiki100-cased''': (
        '''https://huggingface.co/microsoft/xprophetnet-large-wiki100-cased/resolve/main/config.json'''
    ),
}






class 							__SCREAMING_SNAKE_CASE  (			UpperCamelCase						):
							snake_case_       =							'xlm-prophetnet'
							snake_case_       =							['past_key_values']
							snake_case_       =							{
							    'num_attention_heads': 'num_encoder_attention_heads',
							}


							def __init__(     self :  Optional[int]     ,      snake_case :  Optional[float] = 0.1     ,      snake_case :  Optional[Union[str, Callable]] = "gelu"     ,      snake_case :  Optional[int] = 3_0522     ,      snake_case :  Optional[int] = 1024     ,      snake_case :  Optional[int] = 4096     ,      snake_case :  Optional[int] = 12     ,      snake_case :  Optional[int] = 16     ,      snake_case :  Optional[int] = 4096     ,      snake_case :  Optional[int] = 12     ,      snake_case :  Optional[int] = 16     ,      snake_case :  Optional[float] = 0.1     ,      snake_case :  Optional[float] = 0.1     ,      snake_case :  Optional[int] = 512     ,      snake_case :  Optional[float] = 0.02     ,      snake_case :  Optional[bool] = True     ,      snake_case :  Optional[bool] = True     ,      snake_case :  Optional[int] = 0     ,      snake_case :  Optional[int] = 2     ,      snake_case :  Optional[int] = 32     ,      snake_case :  Optional[int] = 128     ,      snake_case :  Optional[bool] = False     ,      snake_case :  Optional[float] = 0.0     ,      snake_case :  Optional[bool] = True     ,      snake_case :  Optional[int] = 0     ,      snake_case :  Optional[int] = 1     ,      snake_case :  Optional[int] = 2     ,      **snake_case :  Optional[Any]     ,      ):
													'''simple docstring'''





													A__  :					Union[str, Any]											=					vocab_size
													A__  :					Dict											=					hidden_size
													A__  :					List[Any]											=					encoder_ffn_dim
													A__  :					int											=					num_encoder_layers
													A__  :					str											=					num_encoder_attention_heads
													A__  :					Tuple											=					decoder_ffn_dim
													A__  :					str											=					num_decoder_layers
													A__  :					Union[str, Any]											=					num_decoder_attention_heads
													A__  :					int											=					max_position_embeddings
													A__  :					str											=					init_std  # Normal(0, this parameter)
													A__  :					Optional[int]											=					activation_function

													# parameters for xlmprophetnet
													A__  :					List[str]											=					ngram
													A__  :					Tuple											=					num_buckets
													A__  :					List[Any]											=					relative_max_distance
													A__  :					Dict											=					disable_ngram_loss
													A__  :					Any											=					eps

													# 3 Types of Dropout
													A__  :					str											=					attention_dropout
													A__  :					Any											=					activation_dropout
													A__  :					str											=					dropout

													A__  :					Optional[Any]											=					use_cache

													super().__init__(
													    pad_token_id=snake_case     ,      bos_token_id=snake_case     ,      eos_token_id=snake_case     ,      is_encoder_decoder=snake_case     ,      add_cross_attention=snake_case     ,      decoder_start_token_id=snake_case     ,      **snake_case     ,      )


							@property
							def   _UpperCamelCase    (     self :  List[str]							):
													'''simple docstring'''





													return self.num_encoder_layers + self.num_decoder_layers


							@num_hidden_layers.setter
							def   _UpperCamelCase    (     self :  str     ,      snake_case :  Tuple							):
													'''simple docstring'''





													raise NotImplementedError(
													    """This model does not support the setting of `num_hidden_layers`. Please set `num_encoder_layers` and"""
													    """ `num_decoder_layers`."""							)














"""simple docstring"""



import os
from distutils.util import strtobool




def        _lowerCAmelCase						(							UpperCAmelCase__    :   List[Any],  UpperCAmelCase__    :   Optional[Any] )						->List[str]:
						for e in env_keys:
												A__  :					List[Any]											=					int(os.environ.get(UpperCAmelCase__,  -1 ) )
												if val >= 0:
																		return val
						return default




def        _lowerCAmelCase						(							UpperCAmelCase__    :   Tuple,  UpperCAmelCase__    :   str=False )						->List[str]:
						A__  :					List[Any]											=					os.environ.get(UpperCAmelCase__,  str(UpperCAmelCase__ ) )
						return strtobool(UpperCAmelCase__ ) == 1  # As its name indicates `strtobool` actually returns an int...




def        _lowerCAmelCase						(							UpperCAmelCase__    :   Tuple,  UpperCAmelCase__    :   List[Any]="no" )						->int:
						A__  :					str											=					os.environ.get(UpperCAmelCase__,  str(UpperCAmelCase__ ) )
						return value






