






"""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


lowerCamelCase_							      = {"""vocab_file""": """vocab.txt""", """tokenizer_file""": """tokenizer.json"""}

lowerCamelCase_							      = {
    """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"""
        ),
    },
}

lowerCamelCase_							      = {
    """unc-nlp/lxmert-base-uncased""": 512,
}

lowerCamelCase_							      = {
    """unc-nlp/lxmert-base-uncased""": {"""do_lower_case""": True},
}







class      UpperCamelCase_			(a_	):
	__magic_name__       =							VOCAB_FILES_NAMES
	__magic_name__       =							PRETRAINED_VOCAB_FILES_MAP
	__magic_name__       =							PRETRAINED_INIT_CONFIGURATION
	__magic_name__       =							PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
	__magic_name__       =							LxmertTokenizer





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

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

				UpperCAmelCase_	:					Dict     	=   do_lower_case





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











"""simple docstring"""
from datetime import datetime

import matplotlib.pyplot as plt
import torch


def 							A						(				__snake_case: Optional[int]  )    ->		Tuple:

       """simple docstring"""





       for param in module.parameters():
              __magic_name__      				=    False


def 							A						(				)    ->		Optional[Any]:

       """simple docstring"""





       __magic_name__      				=    'cuda' if torch.cuda.is_available() else 'cpu'
       if torch.backends.mps.is_available() and torch.backends.mps.is_built():
              __magic_name__      				=    'mps'
       if device == "mps":
              print(
                  'WARNING: MPS currently doesn\'t seem to work, and messes up backpropagation without any visible torch'
                  ' errors. I recommend using CUDA on a colab notebook or CPU instead if you\'re facing inexplicable issues'
                  ' with generations.'  )
       return device


def 							A						(				__snake_case: int  )    ->		List[Any]:

       """simple docstring"""





       __magic_name__      				=    plt.imshow(__snake_case  )
       fig.axes.get_xaxis().set_visible(__snake_case  )
       fig.axes.get_yaxis().set_visible(__snake_case  )
       plt.show()






def 							A						(				)    ->		List[Any]:

       """simple docstring"""





       __magic_name__      				=    datetime.now()
       __magic_name__      				=    current_time.strftime('%H:%M:%S'  )
       return timestamp