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


UpperCamelCase_						:     List[Any]	       =							logging.get_logger(__name__)

UpperCamelCase_						:     Optional[int]	       =							{
    """google/pegasus-large""": """https://huggingface.co/google/pegasus-large/resolve/main/config.json""",
    # See all PEGASUS models at https://huggingface.co/models?filter=pegasus
}




class   __lowercase						(						__lowerCAmelCase       ):
	_A       =   '''pegasus'''
	_A       =   ['''past_key_values''']
	_A       =   {'''num_attention_heads''': '''encoder_attention_heads''', '''hidden_size''': '''d_model'''}






	def __init__(self				: Optional[Any]      ,	snake_case				: List[Any]=5_0265      ,	snake_case				: Optional[int]=1024      ,	snake_case				: Any=12      ,	snake_case				: Optional[Any]=4096      ,	snake_case				: str=16      ,	snake_case				: Any=12      ,	snake_case				: List[str]=4096      ,	snake_case				: Any=16      ,	snake_case				: Any=0.0      ,	snake_case				: Optional[Any]=0.0      ,	snake_case				: Union[str, Any]=True      ,	snake_case				: Union[str, Any]=True      ,	snake_case				: Optional[Any]="gelu"      ,	snake_case				: Any=1024      ,	snake_case				: List[str]=0.1      ,	snake_case				: int=0.0      ,	snake_case				: List[Any]=0.0      ,	snake_case				: Optional[Any]=0.02      ,	snake_case				: Tuple=0      ,	snake_case				: Optional[Any]=False      ,	snake_case				: Union[str, Any]=0      ,	snake_case				: Any=1      ,	snake_case				: Tuple=1      ,	**snake_case				: str      ,	) ->			int:
							_lowercase       :	int           =   vocab_size
							_lowercase       :	Dict           =   max_position_embeddings
							_lowercase       :	Any           =   d_model
							_lowercase       :	Optional[int]           =   encoder_ffn_dim
							_lowercase       :	Dict           =   encoder_layers
							_lowercase       :	Dict           =   encoder_attention_heads
							_lowercase       :	List[str]           =   decoder_ffn_dim
							_lowercase       :	Optional[Any]           =   decoder_layers
							_lowercase       :	List[str]           =   decoder_attention_heads
							_lowercase       :	int           =   dropout
							_lowercase       :	Union[str, Any]           =   attention_dropout
							_lowercase       :	str           =   activation_dropout
							_lowercase       :	Dict           =   activation_function
							_lowercase       :	Optional[Any]           =   init_std
							_lowercase       :	Tuple           =   encoder_layerdrop
							_lowercase       :	int           =   decoder_layerdrop
							_lowercase       :	List[Any]           =   use_cache
							_lowercase       :	List[str]           =   encoder_layers
							_lowercase       :	int           =   scale_embedding  # scale factor will be sqrt(d_model) if True
							super().__init__(
							    pad_token_id=_UpperCAmelCase      ,	eos_token_id=_UpperCAmelCase      ,	is_encoder_decoder=_UpperCAmelCase      ,	decoder_start_token_id=_UpperCAmelCase      ,	forced_eos_token_id=_UpperCAmelCase      ,	**_UpperCAmelCase      ,	)






	@property
	def       _a(self				: Optional[int]    ) ->			Tuple:
							return self.encoder_attention_heads






	@property
	def       _a(self				: Optional[int]    ) ->			List[Any]:
							return self.d_model










"""simple docstring"""

from datetime import datetime

import matplotlib.pyplot as plt
import torch






def 		_snake_case	(   _snake_case				:   Dict				)       ->   Optional[Any]:






      '''simple docstring'''


      for param in module.parameters():
            _A     =  False






def 		_snake_case	(   )       ->   Tuple:






      '''simple docstring'''


      _A     =  'cuda' if torch.cuda.is_available() else 'cpu'
      if torch.backends.mps.is_available() and torch.backends.mps.is_built():
            _A     =  'mps'
      if device == "mps":
            print(
                'WARNING: MPS currently doesn\'t seem to work, and messes up backpropagation without any visible torch'
                ' errors. I recommend using CUDA on a colab notebook or CPU instead if you\'re facing inexplicable issues'
                ' with generations.'				)
      return device






def 		_snake_case	(   _snake_case				:   Dict				)       ->   Optional[Any]:






      '''simple docstring'''


      _A     =  plt.imshow(_snake_case				)
      fig.axes.get_xaxis().set_visible(_snake_case				)
      fig.axes.get_yaxis().set_visible(_snake_case				)
      plt.show()







def 		_snake_case	(   )       ->   Optional[Any]:






      '''simple docstring'''


      _A     =  datetime.now()
      _A     =  current_time.strftime('%H:%M:%S'				)
      return timestamp

