





import logging

from transformers import PretrainedConfig


UpperCAmelCase_           =	logging.getLogger(__name__)


UpperCAmelCase_           =	{
    "bertabs-finetuned-cnndm": "https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-abstractive-summarization/resolve/main/config.json",
}




class 			__UpperCamelCase    (							A__    ):
     __A	:  Tuple							  =   """bertabs"""





     def __init__(     self				,							_UpperCamelCase=30522				,							_UpperCamelCase=512				,							_UpperCamelCase=6				,							_UpperCamelCase=512				,							_UpperCamelCase=8				,							_UpperCamelCase=512				,							_UpperCamelCase=0.2				,							_UpperCamelCase=6				,							_UpperCamelCase=768				,							_UpperCamelCase=8				,							_UpperCamelCase=2048				,							_UpperCamelCase=0.2				,							**_UpperCamelCase				,							):
        super().__init__(**_UpperCamelCase					)

        _UpperCAmelCase           =   vocab_size
        _UpperCAmelCase           =   max_pos

        _UpperCAmelCase           =   enc_layers
        _UpperCAmelCase           =   enc_hidden_size
        _UpperCAmelCase           =   enc_heads
        _UpperCAmelCase           =   enc_ff_size
        _UpperCAmelCase           =   enc_dropout

        _UpperCAmelCase           =   dec_layers
        _UpperCAmelCase           =   dec_hidden_size
        _UpperCAmelCase           =   dec_heads
        _UpperCAmelCase           =   dec_ff_size
        _UpperCAmelCase           =   dec_dropout







def     a_   (__A      )				->						Dict:



					"""simple docstring"""
					if not head:
										return True
					# split the list to two parts
					__a      ,			__a					:						Any      =					head.next, head
					while fast and fast.next:
										__a					:						Optional[int]      =					fast.next.next
										__a					:						Optional[int]      =					slow.next
					__a					:						Optional[int]      =					slow.next
					__a					:						Tuple      =					None  # Don't forget here! But forget still works!
					# reverse the second part
					__a					:						Any      =					None
					while second:
										__a					:						int      =					second.next
										__a					:						int      =					node
										__a					:						Union[str, Any]      =					second
										__a					:						Union[str, Any]      =					nxt
					# compare two parts
					# second part has the same or one less node
					while node:
										if node.val != head.val:
															return False
										__a					:						int      =					node.next
										__a					:						Dict      =					head.next
					return True







def     a_   (__A      )				->						Union[str, Any]:



					"""simple docstring"""
					if not head or not head.next:
										return True

					# 1. Get the midpoint (slow)
					__a					:						Union[str, Any]      =					head
					while fast and fast.next:
										__a      ,			__a					:						List[str]      =					fast.next.next, slow.next

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

					# 3. Comparison
					while stack:
										if stack.pop() != cur.val:
															return False
										__a					:						List[str]      =					cur.next

					return True







def     a_   (__A      )				->						List[str]:



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





