

import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

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


__A      		=     {'''vocab_file''': '''vocab.txt''', '''tokenizer_file''': '''tokenizer.json'''}

__A      		=     {
    '''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'''
        ),
    },
}

__A      		=     {
    '''unc-nlp/lxmert-base-uncased''': 5_12,
}

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



class   lowercase_   (  __lowercase					):
      UpperCamelCase_      :		List[str]										=    VOCAB_FILES_NAMES
      UpperCamelCase_      :		Optional[int]										=    PRETRAINED_VOCAB_FILES_MAP
      UpperCamelCase_      :		str										=    PRETRAINED_INIT_CONFIGURATION
      UpperCamelCase_      :		Any										=    PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
      UpperCamelCase_      :		Dict										=    LxmertTokenizer



      def __init__(      self				:    Tuple      , A__				:    Optional[int]=None      , A__				:    Dict=None      , A__				:    Optional[int]=True      , A__				:    List[Any]="[UNK]"      , A__				:    Any="[SEP]"      , A__				:    Optional[Any]="[PAD]"      , A__				:    Optional[int]="[CLS]"      , A__				:    str="[MASK]"      , A__				:    Dict=True      , A__				:    str=None      , **A__				:    Tuple      , )   ->					List[str]:
        super().__init__(
            A__      , tokenizer_file=A__      , do_lower_case=A__      , unk_token=A__      , sep_token=A__      , pad_token=A__      , cls_token=A__      , mask_token=A__      , tokenize_chinese_chars=A__      , strip_accents=A__      , **A__      , )

        _snake_case						=							json.loads(self.backend_tokenizer.normalizer.__getstate__()		)
        if (
            normalizer_state.get('''lowercase'''      , A__		) != do_lower_case
            or normalizer_state.get('''strip_accents'''      , A__		) != strip_accents
            or normalizer_state.get('''handle_chinese_chars'''      , A__		) != tokenize_chinese_chars
        ):
          _snake_case						=							getattr(A__      , normalizer_state.pop('''type'''		)		)
          _snake_case						=							do_lower_case
          _snake_case						=							strip_accents
          _snake_case						=							tokenize_chinese_chars
          _snake_case						=							normalizer_class(**A__		)

        _snake_case						=							do_lower_case



      def 						UpperCamelCase_		(      self				:    List[str]      , A__				:    List[str]      , A__				:    List[Any]=None		)   ->					Optional[Any]:
        _snake_case						=							[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 						UpperCamelCase_		(      self				:    Any      , A__				:    List[int]      , A__				:    Optional[List[int]] = None		)   ->					List[int]:
        _snake_case						=							[self.sep_token_id]
        _snake_case						=							[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 						UpperCamelCase_		(      self				:    List[str]      , A__				:    str      , A__				:    Optional[str] = None		)   ->					Tuple[str]:
        _snake_case						=							self._tokenizer.model.save(A__      , name=A__		)
        return tuple(A__		)




from ..utils import DummyObject, requires_backends



class   lowercase_   (  metaclass=__lowercase					):
      UpperCamelCase_      :		Optional[int]										=    ["speech"]



      def __init__(      self				:    str      , *A__				:    List[str]      , **A__				:    Tuple		)   ->					Optional[Any]:
        requires_backends(self      , ['''speech''']		)



class   lowercase_   (  metaclass=__lowercase					):
      UpperCamelCase_      :		Optional[Any]										=    ["speech"]



      def __init__(      self				:    Dict      , *A__				:    int      , **A__				:    int		)   ->					Tuple:
        requires_backends(self      , ['''speech''']		)

