






from typing import Callable, Optional, Union

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


a      =       logging.get_logger(__name__)

a      =       {
    '''microsoft/prophetnet-large-uncased''': (
        '''https://huggingface.co/microsoft/prophetnet-large-uncased/resolve/main/config.json'''
    ),
}
class        __snake_case(					UpperCamelCase_      ):
 lowercase :       Optional[int]		      =		"""prophetnet"""
 lowercase :       Optional[int]		      =		["""past_key_values"""]
 lowercase :       Any		      =		{
     """num_attention_heads""": """num_encoder_attention_heads""",
 }



 def __init__(	self   :   Optional[Any] ,		UpperCAmelCase__   :   Union[str, Any] = 0.1 ,		UpperCAmelCase__   :   List[Any] = "gelu" ,		UpperCAmelCase__   :   Any = 30_522 ,		UpperCAmelCase__   :   Dict = 1_024 ,		UpperCAmelCase__   :   Optional[Any] = 4_096 ,		UpperCAmelCase__   :   Union[str, Any] = 12 ,		UpperCAmelCase__   :   Union[str, Any] = 16 ,		UpperCAmelCase__   :   Optional[int] = 4_096 ,		UpperCAmelCase__   :   Dict = 12 ,		UpperCAmelCase__   :   List[str] = 16 ,		UpperCAmelCase__   :   Tuple = 0.1 ,		UpperCAmelCase__   :   str = 0.1 ,		UpperCAmelCase__   :   List[Any] = 512 ,		UpperCAmelCase__   :   Any = 0.02 ,		UpperCAmelCase__   :   Union[str, Any] = True ,		UpperCAmelCase__   :   List[str] = True ,		UpperCAmelCase__   :   Optional[Any] = 0 ,		UpperCAmelCase__   :   Union[str, Any] = 2 ,		UpperCAmelCase__   :   Dict = 32 ,		UpperCAmelCase__   :   List[Any] = 128 ,		UpperCAmelCase__   :   Union[str, Any] = False ,		UpperCAmelCase__   :   int = 0.0 ,		UpperCAmelCase__   :   List[Any] = True ,		UpperCAmelCase__   :   List[Any] = 0 ,		UpperCAmelCase__   :   Any = 1 ,		UpperCAmelCase__   :   Optional[Any] = 2 ,		**UpperCAmelCase__   :   Dict ,		):

    """simple docstring"""






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

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

    # 3 Types of Dropout
    lowercase__						:	List[str]         = attention_dropout
    lowercase__						:	List[Any]         = activation_dropout
    lowercase__						:	Any         = dropout

    lowercase__						:	Dict         = 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 						UpperCAmelCase    (	self   :   Union[str, Any]	):

    """simple docstring"""






    return self.num_encoder_layers + self.num_decoder_layers







 @num_hidden_layers.setter
 def 						UpperCAmelCase    (	self   :   List[str] ,		UpperCAmelCase__   :   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`."""	)










from dataclasses import dataclass
from typing import Callable, Optional

import datasets
@dataclass
class        __snake_case(					datasets.BuilderConfig      ):
 lowercase :       Optional[Callable]		      =		None
 lowercase :       Optional[dict]		      =		None
 lowercase :       Optional[datasets.Features]		      =		None



 def 						UpperCAmelCase    (	self   :   int	):

    """simple docstring"""






    assert self.generator is not None, "generator must be specified"

    if self.gen_kwargs is None:
       lowercase__						:	List[Any]         = {}
class        __snake_case(					datasets.GeneratorBasedBuilder      ):
 lowercase :       Dict		      =		GeneratorConfig



 def 						UpperCAmelCase    (	self   :   Any	):

    """simple docstring"""






    return datasets.DatasetInfo(features=self.config.features	)



 def 						UpperCAmelCase    (	self   :   List[str] ,		UpperCAmelCase__   :   Optional[int]	):

    """simple docstring"""






    return [datasets.SplitGenerator(name=datasets.Split.TRAIN ,		gen_kwargs=self.config.gen_kwargs	)]







 def 						UpperCAmelCase    (	self   :   Dict ,		**UpperCAmelCase__   :   List[str]	):

    """simple docstring"""






    for idx, ex in enumerate(self.config.generator(**UpperCAmelCase__	)	):
       yield idx, ex


