


'''simple docstring'''




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


_lowerCAmelCase  :		List[str]		     =	logging.get_logger(__name__)

_lowerCAmelCase  :		List[Any]		     =	{
    'unc-nlp/lxmert-base-uncased': 'https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/config.json',
}



class  lowerCAmelCase				(				a							):
	_lowerCamelCase   :					Optional[Any]			      = """lxmert"""
	_lowerCamelCase   :					List[Any]			      = {}



	def __init__(					self ,					snake_case__=3_0522 ,					snake_case__=768 ,					snake_case__=12 ,					snake_case__=9500 ,					snake_case__=1600 ,					snake_case__=400 ,					snake_case__=3072 ,					snake_case__="gelu" ,					snake_case__=0.1 ,					snake_case__=0.1 ,					snake_case__=512 ,					snake_case__=2 ,					snake_case__=0.0_2 ,					snake_case__=1e-1_2 ,					snake_case__=9 ,					snake_case__=5 ,					snake_case__=5 ,					snake_case__=2048 ,					snake_case__=4 ,					snake_case__=6.6_7 ,					snake_case__=True ,					snake_case__=True ,					snake_case__=True ,					snake_case__=True ,					snake_case__=True ,					snake_case__=True ,					snake_case__=True ,					**snake_case__ ,					):
		lowerCAmelCase					:    Tuple      							= vocab_size
		lowerCAmelCase					:    str      							= hidden_size
		lowerCAmelCase					:    Optional[Any]      							= num_attention_heads
		lowerCAmelCase					:    Dict      							= hidden_act
		lowerCAmelCase					:    List[str]      							= intermediate_size
		lowerCAmelCase					:    List[Any]      							= hidden_dropout_prob
		lowerCAmelCase					:    List[Any]      							= attention_probs_dropout_prob
		lowerCAmelCase					:    str      							= max_position_embeddings
		lowerCAmelCase					:    Union[str, Any]      							= type_vocab_size
		lowerCAmelCase					:    List[str]      							= initializer_range
		lowerCAmelCase					:    Dict      							= layer_norm_eps
		lowerCAmelCase					:    List[Any]      							= num_qa_labels
		lowerCAmelCase					:    Dict      							= num_object_labels
		lowerCAmelCase					:    str      							= num_attr_labels
		lowerCAmelCase					:    Union[str, Any]      							= l_layers
		lowerCAmelCase					:    int      							= x_layers
		lowerCAmelCase					:    Dict      							= r_layers
		lowerCAmelCase					:    int      							= visual_feat_dim
		lowerCAmelCase					:    Union[str, Any]      							= visual_pos_dim
		lowerCAmelCase					:    List[Any]      							= visual_loss_normalizer
		lowerCAmelCase					:    Dict      							= task_matched
		lowerCAmelCase					:    List[str]      							= task_mask_lm
		lowerCAmelCase					:    str      							= task_obj_predict
		lowerCAmelCase					:    Optional[int]      							= task_qa
		lowerCAmelCase					:    int      							= visual_obj_loss
		lowerCAmelCase					:    Dict      							= visual_attr_loss
		lowerCAmelCase					:    str      							= visual_feat_loss
		lowerCAmelCase					:    Optional[Any]      							= {'vision': r_layers, 'cross_encoder': x_layers, 'language': l_layers}
		super().__init__(**snake_case__    )




'''simple docstring'''




def 			__UpperCamelCase    (    _A    :				List[str]				)    ->      Optional[Any]:




	"""simple docstring"""





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

def 			__UpperCamelCase    (    _A    :				Optional[Any]				)    ->      Optional[int]:




	"""simple docstring"""





	if not head or not head.next:
		return True

	# 1. Get the midpoint (slow)
	lowerCAmelCase					:    Optional[int]      							= head
	while fast and fast.next:
		lowerCAmelCase							,   lowerCAmelCase					:    Optional[Any]      							= fast.next.next, slow.next

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

	# 3. Comparison
	while stack:
		if stack.pop() != cur.val:
			return False
		lowerCAmelCase					:    Union[str, Any]      							= cur.next

	return True






def 			__UpperCamelCase    (    _A    :				Tuple				)    ->      Optional[int]:




	"""simple docstring"""





	if not head or not head.next:
		return True
	lowerCAmelCase					:    Optional[int]      							= {}
	lowerCAmelCase					:    int      							= 0
	while head:
		if head.val in d:
			d[head.val].append(_A				)
		else:
			lowerCAmelCase					:    Any      							= [pos]
		lowerCAmelCase					:    int      							= head.next
		pos += 1
	lowerCAmelCase					:    str      							= pos - 1
	lowerCAmelCase					:    Optional[Any]      							= 0
	for v in d.values():
		if len(_A				) % 2 != 0:
			middle += 1
		else:
			lowerCAmelCase					:    Any      							= 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
