


from .data_collator import (
    DataCollatorForLanguageModeling,
    DataCollatorForPermutationLanguageModeling,
    DataCollatorForSeqaSeq,
    DataCollatorForSOP,
    DataCollatorForTokenClassification,
    DataCollatorForWholeWordMask,
    DataCollatorWithPadding,
    DefaultDataCollator,
    default_data_collator,
)
from .metrics import glue_compute_metrics, xnli_compute_metrics
from .processors import (
    DataProcessor,
    InputExample,
    InputFeatures,
    SingleSentenceClassificationProcessor,
    SquadExample,
    SquadFeatures,
    SquadVaProcessor,
    SquadVaProcessor,
    glue_convert_examples_to_features,
    glue_output_modes,
    glue_processors,
    glue_tasks_num_labels,
    squad_convert_examples_to_features,
    xnli_output_modes,
    xnli_processors,
    xnli_tasks_num_labels,
)


import os
import unittest

from transformers import LxmertTokenizer, LxmertTokenizerFast
from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES
from transformers.testing_utils import require_tokenizers

from ...test_tokenization_common import TokenizerTesterMixin




@require_tokenizers
class 						lowercase__  (						_UpperCAmelCase     ,       unittest.TestCase  ):
	A__    :   Dict				       =LxmertTokenizer
	A__    :   List[Any]				       =LxmertTokenizerFast
	A__    :   Any				       =True
	A__    :   List[Any]				       =True
	def      A_				(			self							:   Optional[Any]							):
						super().setUp()

						SCREAMING_SNAKE_CASE__													= [
						    '[UNK]',
						    '[CLS]',
						    '[SEP]',
						    'want',
						    '##want',
						    '##ed',
						    'wa',
						    'un',
						    'runn',
						    '##ing',
						    ',',
						    'low',
						    'lowest',
						]
						SCREAMING_SNAKE_CASE__													= os.path.join(self.tmpdirname       ,   VOCAB_FILES_NAMES['vocab_file']							)
						with open(self.vocab_file       ,   'w'       ,   encoding='utf-8'							) as vocab_writer:
											vocab_writer.write(''.join([x + '\n' for x in vocab_tokens]							)							)
	def      A_				(			self							:   int       ,   UpperCAmelCase_							:   int							):
						SCREAMING_SNAKE_CASE__													= 'UNwant\u00E9d,running'
						SCREAMING_SNAKE_CASE__													= 'unwanted, running'
						return input_text, output_text
	def      A_				(			self							:   Optional[Any]							):
						SCREAMING_SNAKE_CASE__													= self.tokenizer_class(self.vocab_file							)

						SCREAMING_SNAKE_CASE__													= tokenizer.tokenize('UNwant\u00E9d,running'							)
						self.assertListEqual(UpperCAmelCase_       ,   ['un', '##want', '##ed', ',', 'runn', '##ing']							)
						self.assertListEqual(tokenizer.convert_tokens_to_ids(UpperCAmelCase_							)       ,   [7, 4, 5, 10, 8, 9]							)





	def      A_				(			self							:   List[str]							):
						if not self.test_rust_tokenizer:
											return

						SCREAMING_SNAKE_CASE__													= self.get_tokenizer()
						SCREAMING_SNAKE_CASE__													= self.get_rust_tokenizer()

						SCREAMING_SNAKE_CASE__													= 'I was born in 92000, and this is falsé.'

						SCREAMING_SNAKE_CASE__													= tokenizer.tokenize(UpperCAmelCase_							)
						SCREAMING_SNAKE_CASE__													= rust_tokenizer.tokenize(UpperCAmelCase_							)
						self.assertListEqual(UpperCAmelCase_       ,   UpperCAmelCase_							)

						SCREAMING_SNAKE_CASE__													= tokenizer.encode(UpperCAmelCase_       ,   add_special_tokens=UpperCAmelCase_							)
						SCREAMING_SNAKE_CASE__													= rust_tokenizer.encode(UpperCAmelCase_       ,   add_special_tokens=UpperCAmelCase_							)
						self.assertListEqual(UpperCAmelCase_       ,   UpperCAmelCase_							)

						SCREAMING_SNAKE_CASE__													= self.get_rust_tokenizer()
						SCREAMING_SNAKE_CASE__													= tokenizer.encode(UpperCAmelCase_							)
						SCREAMING_SNAKE_CASE__													= rust_tokenizer.encode(UpperCAmelCase_							)
						self.assertListEqual(UpperCAmelCase_       ,   UpperCAmelCase_							)





