





'''simple docstring'''


def       __a       (   UpperCAmelCase			)					->int:



	"""simple docstring"""







	if not head:
		return True
	# split the list to two parts
	A							     =					head.next, head
	while fast and fast.next:
		A							     =					fast.next.next
		A							     =					slow.next
	A							     =					slow.next
	A							     =					None  # Don't forget here! But forget still works!
	# reverse the second part
	A							     =					None
	while second:
		A							     =					second.next
		A							     =					node
		A							     =					second
		A							     =					nxt
	# compare two parts
	# second part has the same or one less node
	while node:
		if node.val != head.val:
			return False
		A							     =					node.next
		A							     =					head.next
	return True




def       __a       (   UpperCAmelCase			)					->Dict:



	"""simple docstring"""







	if not head or not head.next:
		return True

	# 1. Get the midpoint (slow)
	A							     =					head
	while fast and fast.next:
		A							     =					fast.next.next, slow.next

	# 2. Push the second half into the stack
	A							     =					[slow.val]
	while slow.next:
		A							     =					slow.next
		stack.append(slow.val			)

	# 3. Comparison
	while stack:
		if stack.pop() != cur.val:
			return False
		A							     =					cur.next

	return True




def       __a       (   UpperCAmelCase			)					->Tuple:



	"""simple docstring"""







	if not head or not head.next:
		return True
	A							     =					{}
	A							     =					0
	while head:
		if head.val in d:
			d[head.val].append(_lowerCamelCase			)
		else:
			A							     =					[pos]
		A							     =					head.next
		pos += 1
	A							     =					pos - 1
	A							     =					0
	for v in d.values():
		if len(_lowerCamelCase			) % 2 != 0:
			middle += 1
		else:
			A							     =					0
			for i in range(0				,	len(_lowerCamelCase			)			):
				if v[i] + v[len(_lowerCamelCase			) - 1 - step] != checksum:
					return False
				step += 1
		if middle > 1:
			return False
	return True



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


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

lowercase  :					Any													=       {
    '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  lowerCamelCase__							(				__lowercase):




	'''simple docstring'''




	_A								=     'pegasus'
	_A								=     ['past_key_values']
	_A								=     {'num_attention_heads': 'encoder_attention_heads', 'hidden_size': 'd_model'}







	def __init__(					self		:Dict     ,   a		:Dict=5_0_2_6_5     ,   a		:Dict=1_0_2_4     ,   a		:Union[str, Any]=1_2     ,   a		:Any=4_0_9_6     ,   a		:str=1_6     ,   a		:str=1_2     ,   a		:Optional[Any]=4_0_9_6     ,   a		:int=1_6     ,   a		:Optional[int]=0.0     ,   a		:Optional[int]=0.0     ,   a		:List[Any]=True     ,   a		:Union[str, Any]=True     ,   a		:int="gelu"     ,   a		:Dict=1_0_2_4     ,   a		:List[Any]=0.1     ,   a		:List[str]=0.0     ,   a		:List[Any]=0.0     ,   a		:str=0.02     ,   a		:int=0     ,   a		:Any=False     ,   a		:Dict=0     ,   a		:int=1     ,   a		:Optional[Any]=1     ,   **a		:Optional[int]     ,   )		-> str:
								__UpperCamelCase	:   List[Any]			   =					vocab_size
								__UpperCamelCase	:   Union[str, Any]			   =					max_position_embeddings
								__UpperCamelCase	:   str			   =					d_model
								__UpperCamelCase	:   Dict			   =					encoder_ffn_dim
								__UpperCamelCase	:   int			   =					encoder_layers
								__UpperCamelCase	:   int			   =					encoder_attention_heads
								__UpperCamelCase	:   List[Any]			   =					decoder_ffn_dim
								__UpperCamelCase	:   List[Any]			   =					decoder_layers
								__UpperCamelCase	:   List[str]			   =					decoder_attention_heads
								__UpperCamelCase	:   str			   =					dropout
								__UpperCamelCase	:   Union[str, Any]			   =					attention_dropout
								__UpperCamelCase	:   List[str]			   =					activation_dropout
								__UpperCamelCase	:   Optional[Any]			   =					activation_function
								__UpperCamelCase	:   Tuple			   =					init_std
								__UpperCamelCase	:   Optional[int]			   =					encoder_layerdrop
								__UpperCamelCase	:   Union[str, Any]			   =					decoder_layerdrop
								__UpperCamelCase	:   Optional[Any]			   =					use_cache
								__UpperCamelCase	:   Union[str, Any]			   =					encoder_layers
								__UpperCamelCase	:   int			   =					scale_embedding  # scale factor will be sqrt(d_model) if True
								super().__init__(
								    pad_token_id=a     ,   eos_token_id=a     ,   is_encoder_decoder=a     ,   decoder_start_token_id=a     ,   forced_eos_token_id=a     ,   **a     ,   )







	@property
	def    _lowerCamelCase				(					self		:Dict						)		-> int:
								return self.encoder_attention_heads







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