'''simple docstring'''

from typing import Callable, Optional, Union

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


_A      :				str 				=    logging.get_logger(__name__)

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







class     _lowercase					(    UpperCAmelCase__      ):


	'''simple docstring'''






	_SCREAMING_SNAKE_CASE					:	Union[str, Any]				     = """prophetnet"""
	_SCREAMING_SNAKE_CASE					:	Any				     = ["""past_key_values"""]
	_SCREAMING_SNAKE_CASE					:	Optional[Any]				     = {
	    """num_attention_heads""": """num_encoder_attention_heads""",
	}
	def __init__(				self       :     int				,	SCREAMING_SNAKE_CASE__       :     Optional[float] = 0.1				,	SCREAMING_SNAKE_CASE__       :     Optional[Union[str, Callable]] = "gelu"				,	SCREAMING_SNAKE_CASE__       :     Optional[int] = 3_05_22				,	SCREAMING_SNAKE_CASE__       :     Optional[int] = 10_24				,	SCREAMING_SNAKE_CASE__       :     Optional[int] = 40_96				,	SCREAMING_SNAKE_CASE__       :     Optional[int] = 12				,	SCREAMING_SNAKE_CASE__       :     Optional[int] = 16				,	SCREAMING_SNAKE_CASE__       :     Optional[int] = 40_96				,	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] = 5_12				,	SCREAMING_SNAKE_CASE__       :     Optional[float] = 0.0_2				,	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] = 1_28				,	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__       :     List[Any]				,	)  ->   Optional[Any]:
		__lowerCAmelCase    							=						vocab_size
		__lowerCAmelCase    							=						hidden_size
		__lowerCAmelCase    							=						encoder_ffn_dim
		__lowerCAmelCase    							=						num_encoder_layers
		__lowerCAmelCase    							=						num_encoder_attention_heads
		__lowerCAmelCase    							=						decoder_ffn_dim
		__lowerCAmelCase    							=						num_decoder_layers
		__lowerCAmelCase    							=						num_decoder_attention_heads
		__lowerCAmelCase    							=						max_position_embeddings
		__lowerCAmelCase    							=						init_std  # Normal(0, this parameter)
		__lowerCAmelCase    							=						activation_function

		# parameters for prophetnet
		__lowerCAmelCase    							=						ngram
		__lowerCAmelCase    							=						num_buckets
		__lowerCAmelCase    							=						relative_max_distance
		__lowerCAmelCase    							=						disable_ngram_loss
		__lowerCAmelCase    							=						eps

		# 3 Types of Dropout
		__lowerCAmelCase    							=						attention_dropout
		__lowerCAmelCase    							=						activation_dropout
		__lowerCAmelCase    							=						dropout

		__lowerCAmelCase    							=						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 a (				self       :     Optional[Any]							)  ->   int:
		return self.num_encoder_layers + self.num_decoder_layers





	@num_hidden_layers.setter
	def a (				self       :     Optional[Any]				,	SCREAMING_SNAKE_CASE__       :     Union[str, Any]							)  ->   Any:
		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 unittest.mock import patch

import datasets
from datasets import Dataset







def 					UpperCamelCase_						( ) ->					Dict:






 '''simple docstring'''

 __lowerCAmelCase    							=						Dataset.from_dict({"""col_1""": [3, 2, 0, 1]}				)

 with patch("""tqdm.auto.tqdm"""				) as mock_tqdm:
  datasets.disable_progress_bar()
  dset.map(lambda snake_case_				: {"col_2": x["col_1"] + 1}				)
  mock_tqdm.assert_not_called()

  mock_tqdm.reset_mock()

  datasets.enable_progress_bar()
  dset.map(lambda snake_case_				: {"col_2": x["col_1"] + 1}				)
  mock_tqdm.assert_called()






