



from typing import Callable, Optional, Union

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


lowerCAmelCase__					  =  logging.get_logger(__name__)

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

class 				snake_case__(_UpperCamelCase      ):

					"""simple docstring"""






					lowercase_								=		"""xlm-prophetnet"""
					lowercase_								=		["""past_key_values"""]
					lowercase_								=		{
					    """num_attention_heads""": """num_encoder_attention_heads""",
					}







					def __init__(							self :     Any				,       SCREAMING_SNAKE_CASE :     Optional[float] = 0.1				,       SCREAMING_SNAKE_CASE :     Optional[Union[str, Callable]] = "gelu"				,       SCREAMING_SNAKE_CASE :     Optional[int] = 30_522				,       SCREAMING_SNAKE_CASE :     Optional[int] = 1_024				,       SCREAMING_SNAKE_CASE :     Optional[int] = 4_096				,       SCREAMING_SNAKE_CASE :     Optional[int] = 12				,       SCREAMING_SNAKE_CASE :     Optional[int] = 16				,       SCREAMING_SNAKE_CASE :     Optional[int] = 4_096				,       SCREAMING_SNAKE_CASE :     Optional[int] = 12				,       SCREAMING_SNAKE_CASE :     Optional[int] = 16				,       SCREAMING_SNAKE_CASE :     Optional[float] = 0.1				,       SCREAMING_SNAKE_CASE :     Optional[float] = 0.1				,       SCREAMING_SNAKE_CASE :     Optional[int] = 512				,       SCREAMING_SNAKE_CASE :     Optional[float] = 0.02				,       SCREAMING_SNAKE_CASE :     Optional[bool] = True				,       SCREAMING_SNAKE_CASE :     Optional[bool] = True				,       SCREAMING_SNAKE_CASE :     Optional[int] = 0				,       SCREAMING_SNAKE_CASE :     Optional[int] = 2				,       SCREAMING_SNAKE_CASE :     Optional[int] = 32				,       SCREAMING_SNAKE_CASE :     Optional[int] = 128				,       SCREAMING_SNAKE_CASE :     Optional[bool] = False				,       SCREAMING_SNAKE_CASE :     Optional[float] = 0.0				,       SCREAMING_SNAKE_CASE :     Optional[bool] = True				,       SCREAMING_SNAKE_CASE :     Optional[int] = 0				,       SCREAMING_SNAKE_CASE :     Optional[int] = 1				,       SCREAMING_SNAKE_CASE :     Optional[int] = 2				,       **SCREAMING_SNAKE_CASE :     Optional[int]				,       ):
									lowercase__					:   Any													=					vocab_size
									lowercase__					:   Dict													=					hidden_size
									lowercase__					:   List[Any]													=					encoder_ffn_dim
									lowercase__					:   int													=					num_encoder_layers
									lowercase__					:   str													=					num_encoder_attention_heads
									lowercase__					:   Optional[int]													=					decoder_ffn_dim
									lowercase__					:   Optional[int]													=					num_decoder_layers
									lowercase__					:   int													=					num_decoder_attention_heads
									lowercase__					:   Tuple													=					max_position_embeddings
									lowercase__					:   Dict													=					init_std  # Normal(0, this parameter)
									lowercase__					:   int													=					activation_function

									# parameters for xlmprophetnet
									lowercase__					:   int													=					ngram
									lowercase__					:   int													=					num_buckets
									lowercase__					:   Optional[int]													=					relative_max_distance
									lowercase__					:   int													=					disable_ngram_loss
									lowercase__					:   List[Any]													=					eps

									# 3 Types of Dropout
									lowercase__					:   Union[str, Any]													=					attention_dropout
									lowercase__					:   Tuple													=					activation_dropout
									lowercase__					:   Tuple													=					dropout

									lowercase__					:   Any													=					use_cache

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







					@property
					def 			snake_case					(							self :     Union[str, Any]					):
									return self.num_encoder_layers + self.num_decoder_layers







					@num_hidden_layers.setter
					def 			snake_case					(							self :     Dict				,       SCREAMING_SNAKE_CASE :     Optional[int]					):
									raise NotImplementedError(
									    "This model does not support the setting of `num_hidden_layers`. Please set `num_encoder_layers` and"
									    " `num_decoder_layers`."					)









from typing import TYPE_CHECKING

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


lowerCAmelCase__					  =  {}

try:
				if not is_sentencepiece_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				lowerCAmelCase__					  =  ['''NllbTokenizer''']

try:
				if not is_tokenizers_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				lowerCAmelCase__					  =  ['''NllbTokenizerFast''']


if TYPE_CHECKING:
				try:
								if not is_sentencepiece_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .tokenization_nllb import NllbTokenizer

				try:
								if not is_tokenizers_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .tokenization_nllb_fast import NllbTokenizerFast

else:
				import sys

				lowerCAmelCase__					  =  _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)




