


'''simple docstring'''
import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_lxmert import LxmertTokenizer


UpperCAmelCase_ :     Union[str, Any]								=      {'vocab_file': 'vocab.txt', 'tokenizer_file': 'tokenizer.json'}

UpperCAmelCase_ :     Dict								=      {
    'vocab_file': {
        'unc-nlp/lxmert-base-uncased': 'https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/vocab.txt',
    },
    'tokenizer_file': {
        'unc-nlp/lxmert-base-uncased': (
            'https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/tokenizer.json'
        ),
    },
}

UpperCAmelCase_ :     Optional[Any]								=      {
    'unc-nlp/lxmert-base-uncased': 5_1_2,
}

UpperCAmelCase_ :     Dict								=      {
    'unc-nlp/lxmert-base-uncased': {'do_lower_case': True},
}

class 						_lowerCamelCase					(    snake_case_				):




 '''simple docstring'''
 __lowercase				:		Union[str, Any]    							=						VOCAB_FILES_NAMES
 __lowercase				:		Optional[Any]    							=						PRETRAINED_VOCAB_FILES_MAP
 __lowercase				:		Any    							=						PRETRAINED_INIT_CONFIGURATION
 __lowercase				:		Optional[int]    							=						PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
 __lowercase				:		Union[str, Any]    							=						LxmertTokenizer


 def __init__(      self      ,      __lowercase=None      ,      __lowercase=None      ,      __lowercase=True      ,      __lowercase="[UNK]"      ,      __lowercase="[SEP]"      ,      __lowercase="[PAD]"      ,      __lowercase="[CLS]"      ,      __lowercase="[MASK]"      ,      __lowercase=True      ,      __lowercase=None      ,      **__lowercase      ,      ):

  """simple docstring"""







  super().__init__(
      __lowercase      ,      tokenizer_file=__lowercase      ,      do_lower_case=__lowercase      ,      unk_token=__lowercase      ,      sep_token=__lowercase      ,      pad_token=__lowercase      ,      cls_token=__lowercase      ,      mask_token=__lowercase      ,      tokenize_chinese_chars=__lowercase      ,      strip_accents=__lowercase      ,      **__lowercase      ,      )

  __A  :		int       =			json.loads(self.backend_tokenizer.normalizer.__getstate__()						)
  if (
      normalizer_state.get('lowercase'      ,      __lowercase						) != do_lower_case
      or normalizer_state.get('strip_accents'      ,      __lowercase						) != strip_accents
      or normalizer_state.get('handle_chinese_chars'      ,      __lowercase						) != tokenize_chinese_chars
  ):
   __A  :		List[str]       =			getattr(__lowercase      ,      normalizer_state.pop('type'						)						)
   __A  :		Any       =			do_lower_case
   __A  :		Union[str, Any]       =			strip_accents
   __A  :		List[str]       =			tokenize_chinese_chars
   __A  :		Union[str, Any]       =			normalizer_class(**__lowercase						)

  __A  :		List[Any]       =			do_lower_case


 def  snake_case__   (      self      ,      __lowercase      ,      __lowercase=None						):

  """simple docstring"""







  __A  :		List[str]       =			[self.cls_token_id] + token_ids_a + [self.sep_token_id]

  if token_ids_a:
   output += token_ids_a + [self.sep_token_id]

  return output


 def  snake_case__   (      self      ,      __lowercase      ,      __lowercase = None						):

  """simple docstring"""







  __A  :		Optional[int]       =			[self.sep_token_id]
  __A  :		int       =			[self.cls_token_id]
  if token_ids_a is None:
   return len(cls + token_ids_a + sep						) * [0]
  return len(cls + token_ids_a + sep						) * [0] + len(token_ids_a + sep						) * [1]







 def  snake_case__   (      self      ,      __lowercase      ,      __lowercase = None						):

  """simple docstring"""







  __A  :		List[str]       =			self._tokenizer.model.save(__lowercase      ,      name=__lowercase						)
  return tuple(__lowercase						)










'''simple docstring'''
from heapq import heappop, heappush

import numpy as np


def 			_lowercase       (				UpperCamelCase__       :					np.ndarray,				UpperCamelCase__       :					tuple[int, int],				UpperCamelCase__       :					tuple[int, int],				UpperCamelCase__       :					bool,				):
 __A     ,__A  :		Optional[Any]       =			grid.shape
 __A  :		List[Any]       =			[-1, 1, 0, 0]
 __A  :		Optional[int]       =			[0, 0, -1, 1]
 if allow_diagonal:
  dx += [-1, -1, 1, 1]
  dy += [-1, 1, -1, 1]

 __A     ,__A  :		int       =			[(0, source)], set()
 __A  :		Any       =			np.full((rows, cols),				np.inf			)
 __A  :		int       =			0
 __A  :		Any       =			np.empty((rows, cols),				dtype=UpperCamelCase__			)
 __A  :		List[Any]       =			None

 while queue:
  ((__A)     ,(__A))  :		List[Any]       =			heappop(UpperCamelCase__			)
  if (x, y) in visited:
   continue
  visited.add((x, y)			)

  if (x, y) == destination:
   __A  :		Tuple       =			[]
   while (x, y) != source:
    path.append((x, y)			)
    __A     ,__A  :		int       =			predecessors[x, y]
   path.append(UpperCamelCase__			)  # add the source manually
   path.reverse()
   return matrix[destination], path

  for i in range(len(UpperCamelCase__			)			):
   __A     ,__A  :		List[Any]       =			x + dx[i], y + dy[i]
   if 0 <= nx < rows and 0 <= ny < cols:
    __A  :		str       =			grid[nx][ny]
    if next_node == 1 and matrix[nx, ny] > dist + 1:
     heappush(UpperCamelCase__,				(dist + 1, (nx, ny))			)
     __A  :		int       =			dist + 1
     __A  :		List[str]       =			(x, y)

 return np.inf, []


if __name__ == "__main__":
 import doctest

 doctest.testmod()






