



"""simple docstring"""





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


lowerCamelCase      =		logging.get_logger(__name__)

lowerCamelCase      =		{
    """uclanlp/visualbert-vqa""": """https://huggingface.co/uclanlp/visualbert-vqa/resolve/main/config.json""",
    """uclanlp/visualbert-vqa-pre""": """https://huggingface.co/uclanlp/visualbert-vqa-pre/resolve/main/config.json""",
    """uclanlp/visualbert-vqa-coco-pre""": (
        """https://huggingface.co/uclanlp/visualbert-vqa-coco-pre/resolve/main/config.json"""
    ),
    """uclanlp/visualbert-vcr""": """https://huggingface.co/uclanlp/visualbert-vcr/resolve/main/config.json""",
    """uclanlp/visualbert-vcr-pre""": """https://huggingface.co/uclanlp/visualbert-vcr-pre/resolve/main/config.json""",
    """uclanlp/visualbert-vcr-coco-pre""": (
        """https://huggingface.co/uclanlp/visualbert-vcr-coco-pre/resolve/main/config.json"""
    ),
    """uclanlp/visualbert-nlvr2""": """https://huggingface.co/uclanlp/visualbert-nlvr2/resolve/main/config.json""",
    """uclanlp/visualbert-nlvr2-pre""": """https://huggingface.co/uclanlp/visualbert-nlvr2-pre/resolve/main/config.json""",
    """uclanlp/visualbert-nlvr2-coco-pre""": (
        """https://huggingface.co/uclanlp/visualbert-nlvr2-coco-pre/resolve/main/config.json"""
    )
    # See all VisualBERT models at https://huggingface.co/models?filter=visual_bert
}
class    lowercase__     (					SCREAMING_SNAKE_CASE   ):







       '''simple docstring'''


       UpperCamelCase		=  '''visual_bert'''



       def __init__(							self    :						Union[str, Any]	,       _UpperCAmelCase    :						Tuple=30522	,       _UpperCAmelCase    :						List[str]=768	,       _UpperCAmelCase    :						List[Any]=512	,       _UpperCAmelCase    :						List[Any]=12	,       _UpperCAmelCase    :						Optional[Any]=12	,       _UpperCAmelCase    :						Any=3072	,       _UpperCAmelCase    :						List[Any]="gelu"	,       _UpperCAmelCase    :						Any=0.1	,       _UpperCAmelCase    :						int=0.1	,       _UpperCAmelCase    :						int=512	,       _UpperCAmelCase    :						Dict=2	,       _UpperCAmelCase    :						Optional[int]=0.02	,       _UpperCAmelCase    :						Dict=1e-12	,       _UpperCAmelCase    :						Any=False	,       _UpperCAmelCase    :						Optional[Any]=True	,       _UpperCAmelCase    :						List[str]=1	,       _UpperCAmelCase    :						Optional[int]=0	,       _UpperCAmelCase    :						Optional[int]=2	,       **_UpperCAmelCase    :						Optional[int]	,       )				->		List[Any]:


             '''simple docstring'''




             super().__init__(pad_token_id=_UpperCAmelCase	,       bos_token_id=_UpperCAmelCase	,       eos_token_id=_UpperCAmelCase	,       **_UpperCAmelCase					)

             UpperCAmelCase_    				=							vocab_size
             UpperCAmelCase_    				=							max_position_embeddings
             UpperCAmelCase_    				=							hidden_size
             UpperCAmelCase_    				=							visual_embedding_dim
             UpperCAmelCase_    				=							num_hidden_layers
             UpperCAmelCase_    				=							num_attention_heads
             UpperCAmelCase_    				=							intermediate_size
             UpperCAmelCase_    				=							hidden_act
             UpperCAmelCase_    				=							hidden_dropout_prob
             UpperCAmelCase_    				=							attention_probs_dropout_prob
             UpperCAmelCase_    				=							initializer_range
             UpperCAmelCase_    				=							type_vocab_size
             UpperCAmelCase_    				=							layer_norm_eps
             UpperCAmelCase_    				=							bypass_transformer
             UpperCAmelCase_    				=							special_visual_initialize









"""simple docstring"""





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

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

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

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

      return True


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




