

"""simple docstring"""






from typing import Callable, Optional, Union

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


lowerCamelCase__				:  Optional[Any]													=  logging.get_logger(__name__)

lowerCamelCase__				:  Any													=  {
    '''microsoft/prophetnet-large-uncased''': (
        '''https://huggingface.co/microsoft/prophetnet-large-uncased/resolve/main/config.json'''
    ),
}






class     _UpperCAmelCase			(		__a):
			__a :       int									=							"""prophetnet"""
			__a :       Dict									=							["""past_key_values"""]
			__a :       str									=							{
			    """num_attention_heads""": """num_encoder_attention_heads""",
			}
			def __init__(		self      ,		_A = 0.1      ,		_A = "gelu"      ,		_A = 3_05_22      ,		_A = 10_24      ,		_A = 40_96      ,		_A = 12      ,		_A = 16      ,		_A = 40_96      ,		_A = 12      ,		_A = 16      ,		_A = 0.1      ,		_A = 0.1      ,		_A = 5_12      ,		_A = 0.02      ,		_A = True      ,		_A = True      ,		_A = 0      ,		_A = 2      ,		_A = 32      ,		_A = 1_28      ,		_A = False      ,		_A = 0.0      ,		_A = True      ,		_A = 0      ,		_A = 1      ,		_A = 2      ,		**_A      ,		)    ->    Tuple:






				'''simple docstring'''







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

				# parameters for prophetnet
				_UpperCAmelCase    :							Optional[int]									=					ngram
				_UpperCAmelCase    :							Tuple									=					num_buckets
				_UpperCAmelCase    :							Optional[Any]									=					relative_max_distance
				_UpperCAmelCase    :							Optional[int]									=					disable_ngram_loss
				_UpperCAmelCase    :							Tuple									=					eps

				# 3 Types of Dropout
				_UpperCAmelCase    :							Dict									=					attention_dropout
				_UpperCAmelCase    :							Dict									=					activation_dropout
				_UpperCAmelCase    :							Dict									=					dropout

				_UpperCAmelCase    :							int									=					use_cache

				super().__init__(
				    pad_token_id=_A      ,		bos_token_id=_A      ,		eos_token_id=_A      ,		is_encoder_decoder=_A      ,		add_cross_attention=_A      ,		decoder_start_token_id=_A      ,		**_A      ,		)
			@property
			def 							__snake_case (		self     )    ->    int:






				'''simple docstring'''







				return self.num_encoder_layers + self.num_decoder_layers
			@num_hidden_layers.setter
			def 							__snake_case (		self      ,		_A     )    ->    List[str]:






				'''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"""






from __future__ import annotations
def       UpperCamelCase					(			_lowerCAmelCase     :						list,  _lowerCAmelCase     :						list )				->			list:
	_UpperCAmelCase    :							List[Any]									=					[None] * (len(_lowerCAmelCase ) + len(_lowerCAmelCase ))

	_UpperCAmelCase    :							Union[str, Any]									=					0  # pointer to current index for left Half
	_UpperCAmelCase    :							str									=					0  # pointer to current index for the right Half
	_UpperCAmelCase    :							Optional[int]									=					0  # pointer to current index for the sorted array Half

	while pointera < len(_lowerCAmelCase ) and pointera < len(_lowerCAmelCase ):
		if left_half[pointera] < right_half[pointera]:
			_UpperCAmelCase    :							Tuple									=					left_half[pointera]
			pointera += 1
			index += 1
		else:
			_UpperCAmelCase    :							int									=					right_half[pointera]
			pointera += 1
			index += 1
	while pointera < len(_lowerCAmelCase ):
		_UpperCAmelCase    :							Tuple									=					left_half[pointera]
		pointera += 1
		index += 1

	while pointera < len(_lowerCAmelCase ):
		_UpperCAmelCase    :							Union[str, Any]									=					right_half[pointera]
		pointera += 1
		index += 1

	return sorted_array
def       UpperCamelCase					(			_lowerCAmelCase     :						list )				->			list:
	if len(_lowerCAmelCase ) <= 1:
		return array
	# the actual formula to calculate the middle element = left + (right - left) // 2
	# this avoids integer overflow in case of large N
	_UpperCAmelCase    :							Any									=					0 + (len(_lowerCAmelCase ) - 0) // 2

	# Split the array into halves till the array length becomes equal to One
	# merge the arrays of single length returned by mergeSort function and
	# pass them into the merge arrays function which merges the array
	_UpperCAmelCase    :							Optional[Any]									=					array[:middle]
	_UpperCAmelCase    :							Optional[int]									=					array[middle:]

	return merge(merge_sort(_lowerCAmelCase ),  merge_sort(_lowerCAmelCase ) )


if __name__ == "__main__":
						import doctest

						doctest.testmod()





