






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


__SCREAMING_SNAKE_CASE      =      logging.get_logger(__name__)

__SCREAMING_SNAKE_CASE      =      {
    'google/pegasus-x-base': 'https://huggingface.co/google/pegasus-x-base/resolve/main/config.json',
    'google/pegasus-x-large': 'https://huggingface.co/google/pegasus-x-large/resolve/main/config.json',
    # See all PEGASUS-X models at https://huggingface.co/models?filter=pegasus-x
}




class 	__UpperCamelCase    (    UpperCamelCase	):
					lowercase_						:							List[Any]			=     """pegasus_x"""
					lowercase_						:							Optional[int]			=     ["""past_key_values"""]
					lowercase_						:							Union[str, Any]			=     {"""num_attention_heads""": """encoder_attention_heads""", """hidden_size""": """d_model"""}
					def __init__(       self       :  Dict    ,   UpperCAmelCase       :  Union[str, Any]=9_6103    ,   UpperCAmelCase       :  Tuple=1_6384    ,   UpperCAmelCase       :  List[Any]=16    ,   UpperCAmelCase       :  Tuple=4096    ,   UpperCAmelCase       :  Any=16    ,   UpperCAmelCase       :  Optional[int]=16    ,   UpperCAmelCase       :  Tuple=4096    ,   UpperCAmelCase       :  Tuple=16    ,   UpperCAmelCase       :  int=0.0    ,   UpperCAmelCase       :  Dict=0.0    ,   UpperCAmelCase       :  Dict=True    ,   UpperCAmelCase       :  Optional[Any]=True    ,   UpperCAmelCase       :  Union[str, Any]="gelu"    ,   UpperCAmelCase       :  Optional[Any]=1024    ,   UpperCAmelCase       :  Tuple=0.1    ,   UpperCAmelCase       :  Optional[int]=0.0    ,   UpperCAmelCase       :  Any=0.0    ,   UpperCAmelCase       :  List[Any]=0.0_2    ,   UpperCAmelCase       :  int=0    ,   UpperCAmelCase       :  List[str]=True    ,   UpperCAmelCase       :  int=0    ,   UpperCAmelCase       :  int=1    ,   UpperCAmelCase       :  Tuple=1    ,   UpperCAmelCase       :  Optional[Any]=32    ,   UpperCAmelCase       :  List[Any]=512    ,   UpperCAmelCase       :  Optional[int]=True    ,   **UpperCAmelCase       :  List[str]    ,   )  ->					Optional[Any]:
											lowerCAmelCase      :Any				  = vocab_size
											lowerCAmelCase      :Any				  = max_position_embeddings
											lowerCAmelCase      :List[Any]				  = d_model
											lowerCAmelCase      :Any				  = encoder_ffn_dim
											lowerCAmelCase      :List[Any]				  = encoder_layers
											lowerCAmelCase      :Optional[int]				  = encoder_attention_heads
											lowerCAmelCase      :Dict				  = decoder_ffn_dim
											lowerCAmelCase      :List[str]				  = decoder_layers
											lowerCAmelCase      :Optional[Any]				  = decoder_attention_heads
											lowerCAmelCase      :Optional[int]				  = dropout
											lowerCAmelCase      :Tuple				  = attention_dropout
											lowerCAmelCase      :int				  = activation_dropout
											lowerCAmelCase      :List[str]				  = activation_function
											lowerCAmelCase      :List[Any]				  = init_std
											lowerCAmelCase      :Union[str, Any]				  = encoder_layerdrop
											lowerCAmelCase      :Union[str, Any]				  = decoder_layerdrop
											lowerCAmelCase      :int				  = use_cache
											lowerCAmelCase      :Optional[Any]				  = encoder_layers
											lowerCAmelCase      :Dict				  = scale_embedding  # scale factor will be sqrt(d_model) if True

											lowerCAmelCase      :str				  = num_global_tokens
											lowerCAmelCase      :List[str]				  = block_size
											lowerCAmelCase      :Dict				  = stagger_local_blocks

											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 					UpperCAmelCase__   (       self       :  Optional[int]      )  ->					int:
											return self.encoder_attention_heads
					@property
					def 					UpperCAmelCase__   (       self       :  Tuple      )  ->					int:
											return self.d_model







"""simple docstring"""


from __future__ import annotations


def 					UpperCAmelCase			(				a__   ):





						'''simple docstring'''






						lowerCAmelCase      :Union[str, Any]				  = [0] * len(a__   )
						for i in range(1    ,			len(a__   )   ):
												lowerCAmelCase      :Optional[int]				  = duration_times[i - 1] + waiting_times[i - 1]
						return waiting_times


def 					UpperCAmelCase			(				a__    ,			a__   ):





						'''simple docstring'''






						return [
						    duration_time + waiting_times[i]
						    for i, duration_time in enumerate(a__   )
						]


def 					UpperCAmelCase			(				a__   ):





						'''simple docstring'''






						return sum(a__   ) / len(a__   )


def 					UpperCAmelCase			(				a__   ):





						'''simple docstring'''






						return sum(a__   ) / len(a__   )


if __name__ == "__main__":
		# process id's
		__SCREAMING_SNAKE_CASE      =      [1, 2, 3]

		# ensure that we actually have processes
		if len(processes) == 0:
				print('Zero amount of processes')
				raise SystemExit(0)

		# duration time of all processes
		__SCREAMING_SNAKE_CASE      =      [19, 8, 9]

		# ensure we can match each id to a duration time
		if len(duration_times) != len(processes):
				print('Unable to match all id\'s with their duration time')
				raise SystemExit(0)

		# get the waiting times and the turnaround times
		__SCREAMING_SNAKE_CASE      =      calculate_waiting_times(duration_times)
		__SCREAMING_SNAKE_CASE      =      calculate_turnaround_times(duration_times, waiting_times)

		# get the average times
		__SCREAMING_SNAKE_CASE      =      calculate_average_waiting_time(waiting_times)
		__SCREAMING_SNAKE_CASE      =      calculate_average_turnaround_time(turnaround_times)

		# print all the results
		print('Process ID\tDuration Time\tWaiting Time\tTurnaround Time')
		for i, process in enumerate(processes):
				print(
				    F"""{process}\t\t{duration_times[i]}\t\t{waiting_times[i]}\t\t"""
				    F"""{turnaround_times[i]}"""
				)
		print(F"""Average waiting time = {average_waiting_time}""")
		print(F"""Average turn around time = {average_turnaround_time}""")