
from typing import Callable, Optional, Union

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


__UpperCAmelCase   						=     logging.get_logger(__name__)

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





class 				UpperCamelCase__		(	__lowerCamelCase	):






       """simple docstring"""


       UpperCAmelCase_				       ="prophetnet"
       UpperCAmelCase_				       =["past_key_values"]
       UpperCAmelCase_				       ={
           "num_attention_heads": "num_encoder_attention_heads",
       }



       def __init__(							self ,     _A = 0.1 ,     _A = "gelu" ,     _A = 30522 ,     _A = 1024 ,     _A = 4096 ,     _A = 12 ,     _A = 16 ,     _A = 4096 ,     _A = 12 ,     _A = 16 ,     _A = 0.1 ,     _A = 0.1 ,     _A = 512 ,     _A = 0.02 ,     _A = True ,     _A = True ,     _A = 0 ,     _A = 2 ,     _A = 32 ,     _A = 128 ,     _A = False ,     _A = 0.0 ,     _A = True ,     _A = 0 ,     _A = 1 ,     _A = 2 ,     **_A ,     )				->				str:
          SCREAMING_SNAKE_CASE_	=      vocab_size
          SCREAMING_SNAKE_CASE_	=      hidden_size
          SCREAMING_SNAKE_CASE_	=      encoder_ffn_dim
          SCREAMING_SNAKE_CASE_	=      num_encoder_layers
          SCREAMING_SNAKE_CASE_	=      num_encoder_attention_heads
          SCREAMING_SNAKE_CASE_	=      decoder_ffn_dim
          SCREAMING_SNAKE_CASE_	=      num_decoder_layers
          SCREAMING_SNAKE_CASE_	=      num_decoder_attention_heads
          SCREAMING_SNAKE_CASE_	=      max_position_embeddings
          SCREAMING_SNAKE_CASE_	=      init_std  # Normal(0, this parameter)
          SCREAMING_SNAKE_CASE_	=      activation_function

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

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

          SCREAMING_SNAKE_CASE_	=      use_cache

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



       @property
       def     _UpperCamelCase	(							self	)				->				List[str]:
          return self.num_encoder_layers + self.num_decoder_layers




       @num_hidden_layers.setter
       def     _UpperCamelCase	(							self ,     _A	)				->				Union[str, 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 ...configuration_utils import PretrainedConfig
from ...utils import logging


SCREAMING_SNAKE_CASE						=    logging.get_logger(__name__)

SCREAMING_SNAKE_CASE						=    {
    'facebook/regnet-y-040': 'https://huggingface.co/facebook/regnet-y-040/blob/main/config.json',
}



class 			_lowerCamelCase      (__lowerCamelCase  ):
				_snake_case  =	"regnet"
				_snake_case  =	["x", "y"]







				def __init__(			self     :							Any      ,       lowerCamelCase_     :							Optional[Any]=3      ,       lowerCamelCase_     :							List[str]=3_2      ,       lowerCamelCase_     :							str=[1_2_8, 1_9_2, 5_1_2, 1_0_8_8]      ,       lowerCamelCase_     :							int=[2, 6, 1_2, 2]      ,       lowerCamelCase_     :							Union[str, Any]=6_4      ,       lowerCamelCase_     :							int="y"      ,       lowerCamelCase_     :							Optional[Any]="relu"      ,       **lowerCamelCase_     :							Optional[Any]      ,       ):

					"""simple docstring"""






					super().__init__(**lowerCamelCase_    )
					if layer_type not in self.layer_types:
						raise ValueError(F'''layer_type={layer_type} is not one of {','.join(self.layer_types    )}'''    )
					_lowercase			:     str      					=				num_channels
					_lowercase			:     Optional[Any]      					=				embedding_size
					_lowercase			:     Union[str, Any]      					=				hidden_sizes
					_lowercase			:     Optional[int]      					=				depths
					_lowercase			:     Optional[int]      					=				groups_width
					_lowercase			:     Tuple      					=				layer_type
					_lowercase			:     Union[str, Any]      					=				hidden_act
					# always downsample in the first stage
					_lowercase			:     Optional[int]      					=				True



