





'''simple docstring'''




from transformers import (
    DPRContextEncoderTokenizer,
    DPRContextEncoderTokenizerFast,
    DPRQuestionEncoderTokenizer,
    DPRQuestionEncoderTokenizerFast,
    DPRReaderOutput,
    DPRReaderTokenizer,
    DPRReaderTokenizerFast,
)
from transformers.testing_utils import require_tokenizers, slow
from transformers.tokenization_utils_base import BatchEncoding

from ..bert.test_tokenization_bert import BertTokenizationTest




@require_tokenizers
class       UpperCamelCase__			(			lowercase_	):




					"""simple docstring"""
					SCREAMING_SNAKE_CASE__						=					DPRContextEncoderTokenizer
					SCREAMING_SNAKE_CASE__						=					DPRContextEncoderTokenizerFast
					SCREAMING_SNAKE_CASE__						=					True







@require_tokenizers
class       UpperCamelCase__			(			lowercase_	):




					"""simple docstring"""
					SCREAMING_SNAKE_CASE__						=					DPRQuestionEncoderTokenizer
					SCREAMING_SNAKE_CASE__						=					DPRQuestionEncoderTokenizerFast
					SCREAMING_SNAKE_CASE__						=					True







@require_tokenizers
class       UpperCamelCase__			(			lowercase_	):




					"""simple docstring"""
					SCREAMING_SNAKE_CASE__						=					DPRReaderTokenizer
					SCREAMING_SNAKE_CASE__						=					DPRReaderTokenizerFast
					SCREAMING_SNAKE_CASE__						=					True


					@slow
					def lowerCamelCase_	(		self							:	List[str]		):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE				:							str						=	self.tokenizer_class.from_pretrained("""bert-base-uncased"""		)

							SCREAMING_SNAKE_CASE				:							List[str]						=	tokenizer.encode("""question sequence"""     ,		add_special_tokens=lowerCamelCase_		)
							SCREAMING_SNAKE_CASE				:							Optional[int]						=	tokenizer.encode("""title sequence"""     ,		add_special_tokens=lowerCamelCase_		)
							SCREAMING_SNAKE_CASE				:							Tuple						=	tokenizer.encode("""text sequence """ * 4     ,		add_special_tokens=lowerCamelCase_		)
							SCREAMING_SNAKE_CASE				:							Any						=	[[1_01] + text_a + [1_02] + text_a + [1_02] + text_a]
							SCREAMING_SNAKE_CASE				:							Optional[int]						=	BatchEncoding({"""input_ids""": input_ids}		)

							SCREAMING_SNAKE_CASE				:							str						=	[[0] * len(input_ids[0]		)]
							SCREAMING_SNAKE_CASE				:							int						=	[[0] * len(input_ids[0]		)]
							SCREAMING_SNAKE_CASE				:							Any						=	[0]
							SCREAMING_SNAKE_CASE				:							List[Any]						=	DPRReaderOutput(lowerCamelCase_     ,		lowerCamelCase_     ,		lowerCamelCase_		)

							SCREAMING_SNAKE_CASE,    SCREAMING_SNAKE_CASE				:							str						=	8, 9
							SCREAMING_SNAKE_CASE				:							Optional[Any]						=	10
							SCREAMING_SNAKE_CASE				:							int						=	10
							SCREAMING_SNAKE_CASE				:							int						=	tokenizer.decode_best_spans(lowerCamelCase_     ,		lowerCamelCase_		)
							self.assertEqual(predicted_spans[0].start_index     ,		lowerCamelCase_		)
							self.assertEqual(predicted_spans[0].end_index     ,		lowerCamelCase_		)
							self.assertEqual(predicted_spans[0].doc_id     ,		0		)



					@slow
					def lowerCamelCase_	(		self							:	List[str]		):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE				:							Dict						=	self.tokenizer_class.from_pretrained("""bert-base-uncased"""		)

							SCREAMING_SNAKE_CASE				:							int						=	tokenizer.encode("""question sequence"""     ,		add_special_tokens=lowerCamelCase_		)
							SCREAMING_SNAKE_CASE				:							Union[str, Any]						=	tokenizer.encode("""title sequence"""     ,		add_special_tokens=lowerCamelCase_		)
							SCREAMING_SNAKE_CASE				:							Optional[Any]						=	tokenizer.encode("""text sequence"""     ,		add_special_tokens=lowerCamelCase_		)
							SCREAMING_SNAKE_CASE				:							str						=	[1_01] + text_a + [1_02] + text_a + [1_02] + text_a
							SCREAMING_SNAKE_CASE				:							List[Any]						=	tokenizer(questions=["""question sequence"""]     ,		titles=["""title sequence"""]     ,		texts=["""text sequence"""]		)
							self.assertIn("""input_ids"""     ,		lowerCamelCase_		)
							self.assertIn("""attention_mask"""     ,		lowerCamelCase_		)
							self.assertListEqual(encoded_input["""input_ids"""][0]     ,		lowerCamelCase_		)










'''simple docstring'''




import warnings

from ...utils import logging
from .image_processing_detr import DetrImageProcessor


__UpperCAmelCase         =   logging.get_logger(__name__)




class       UpperCamelCase__			(			lowercase_	):




					"""simple docstring"""


					def __init__(		self							:	Dict     ,		*lowerCamelCase_							:	Optional[int]     ,		**lowerCamelCase_							:	Optional[int]		):

							'''simple docstring'''



							warnings.warn(
							    """The class DetrFeatureExtractor is deprecated and will be removed in version 5 of Transformers."""
							    """ Please use DetrImageProcessor instead."""     ,		lowerCamelCase_     ,		)
							super().__init__(*lowerCamelCase_     ,		**lowerCamelCase_		)



