import tempfile
import unittest

from transformers import DPRConfig, is_torch_available
from transformers.testing_utils import require_torch, slow, torch_device

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
    import torch

    from transformers import DPRContextEncoder, DPRQuestionEncoder, DPRReader, DPRReaderTokenizer
    from transformers.models.dpr.modeling_dpr import (
        DPR_CONTEXT_ENCODER_PRETRAINED_MODEL_ARCHIVE_LIST,
        DPR_QUESTION_ENCODER_PRETRAINED_MODEL_ARCHIVE_LIST,
        DPR_READER_PRETRAINED_MODEL_ARCHIVE_LIST,
    )
class        a_				:






 '''simple docstring'''






 def __init__(    self      :						List[str]    ,					lowercase__      :						Union[str, Any]    ,					lowercase__      :						Union[str, Any]=13    ,					lowercase__      :						int=7    ,					lowercase__      :						Union[str, Any]=False    ,					lowercase__      :						Any=True    ,					lowercase__      :						Tuple=True    ,					lowercase__      :						int=True    ,					lowercase__      :						Dict=99    ,					lowercase__      :						Tuple=32    ,					lowercase__      :						List[Any]=5    ,					lowercase__      :						Tuple=4    ,					lowercase__      :						Dict=37    ,					lowercase__      :						int="gelu"    ,					lowercase__      :						int=0.1    ,					lowercase__      :						List[str]=0.1    ,					lowercase__      :						Any=512    ,					lowercase__      :						Optional[int]=16    ,					lowercase__      :						Any=2    ,					lowercase__      :						List[Any]=0.02    ,					lowercase__      :						int=3    ,					lowercase__      :						Any=4    ,					lowercase__      :						Optional[int]=None    ,					lowercase__      :						str=0    ,					):







        '''simple docstring'''



        lowerCAmelCase__  			=      parent
        lowerCAmelCase__  			=      batch_size
        lowerCAmelCase__  			=      seq_length
        lowerCAmelCase__  			=      is_training
        lowerCAmelCase__  			=      use_input_mask
        lowerCAmelCase__  			=      use_token_type_ids
        lowerCAmelCase__  			=      use_labels
        lowerCAmelCase__  			=      vocab_size
        lowerCAmelCase__  			=      hidden_size
        lowerCAmelCase__  			=      num_hidden_layers
        lowerCAmelCase__  			=      num_attention_heads
        lowerCAmelCase__  			=      intermediate_size
        lowerCAmelCase__  			=      hidden_act
        lowerCAmelCase__  			=      hidden_dropout_prob
        lowerCAmelCase__  			=      attention_probs_dropout_prob
        lowerCAmelCase__  			=      max_position_embeddings
        lowerCAmelCase__  			=      type_vocab_size
        lowerCAmelCase__  			=      type_sequence_label_size
        lowerCAmelCase__  			=      initializer_range
        lowerCAmelCase__  			=      num_labels
        lowerCAmelCase__  			=      num_choices
        lowerCAmelCase__  			=      scope
        lowerCAmelCase__  			=      projection_dim




 def 	__snake_case		(    self      :						Tuple):







        '''simple docstring'''



        lowerCAmelCase__  			=      ids_tensor([self.batch_size, self.seq_length]    ,					self.vocab_size)

        lowerCAmelCase__  			=      None
        if self.use_input_mask:
               lowerCAmelCase__  			=      random_attention_mask([self.batch_size, self.seq_length])

        lowerCAmelCase__  			=      None
        if self.use_token_type_ids:
               lowerCAmelCase__  			=      ids_tensor([self.batch_size, self.seq_length]    ,					self.type_vocab_size)

        lowerCAmelCase__  			=      None
        lowerCAmelCase__  			=      None
        lowerCAmelCase__  			=      None
        if self.use_labels:
               lowerCAmelCase__  			=      ids_tensor([self.batch_size]    ,					self.type_sequence_label_size)
               lowerCAmelCase__  			=      ids_tensor([self.batch_size, self.seq_length]    ,					self.num_labels)
               lowerCAmelCase__  			=      ids_tensor([self.batch_size]    ,					self.num_choices)

        lowerCAmelCase__  			=      self.get_config()

        return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels




 def 	__snake_case		(    self      :						int):







        '''simple docstring'''



        return DPRConfig(
            projection_dim=self.projection_dim    ,					vocab_size=self.vocab_size    ,					hidden_size=self.hidden_size    ,					num_hidden_layers=self.num_hidden_layers    ,					num_attention_heads=self.num_attention_heads    ,					intermediate_size=self.intermediate_size    ,					hidden_act=self.hidden_act    ,					hidden_dropout_prob=self.hidden_dropout_prob    ,					attention_probs_dropout_prob=self.attention_probs_dropout_prob    ,					max_position_embeddings=self.max_position_embeddings    ,					type_vocab_size=self.type_vocab_size    ,					initializer_range=self.initializer_range    ,					)




 def 	__snake_case		(    self      :						List[str]    ,					lowercase__      :						str    ,					lowercase__      :						Any    ,					lowercase__      :						Tuple    ,					lowercase__      :						Tuple    ,					lowercase__      :						List[Any]    ,					lowercase__      :						Any    ,					lowercase__      :						Any):







        '''simple docstring'''



        lowerCAmelCase__  			=      DPRContextEncoder(config=lowercase__)
        model.to(lowercase__)
        model.eval()
        lowerCAmelCase__  			=      model(lowercase__    ,					attention_mask=lowercase__    ,					token_type_ids=lowercase__)
        lowerCAmelCase__  			=      model(lowercase__    ,					token_type_ids=lowercase__)
        lowerCAmelCase__  			=      model(lowercase__)
        self.parent.assertEqual(result.pooler_output.shape    ,					(self.batch_size, self.projection_dim or self.hidden_size))




 def 	__snake_case		(    self      :						Optional[Any]    ,					lowercase__      :						Any    ,					lowercase__      :						List[str]    ,					lowercase__      :						List[Any]    ,					lowercase__      :						int    ,					lowercase__      :						str    ,					lowercase__      :						List[Any]    ,					lowercase__      :						int):







        '''simple docstring'''



        lowerCAmelCase__  			=      DPRQuestionEncoder(config=lowercase__)
        model.to(lowercase__)
        model.eval()
        lowerCAmelCase__  			=      model(lowercase__    ,					attention_mask=lowercase__    ,					token_type_ids=lowercase__)
        lowerCAmelCase__  			=      model(lowercase__    ,					token_type_ids=lowercase__)
        lowerCAmelCase__  			=      model(lowercase__)
        self.parent.assertEqual(result.pooler_output.shape    ,					(self.batch_size, self.projection_dim or self.hidden_size))




 def 	__snake_case		(    self      :						Any    ,					lowercase__      :						Optional[Any]    ,					lowercase__      :						str    ,					lowercase__      :						List[str]    ,					lowercase__      :						Tuple    ,					lowercase__      :						int    ,					lowercase__      :						Union[str, Any]    ,					lowercase__      :						Dict):







        '''simple docstring'''



        lowerCAmelCase__  			=      DPRReader(config=lowercase__)
        model.to(lowercase__)
        model.eval()
        lowerCAmelCase__  			=      model(
            lowercase__    ,					attention_mask=lowercase__    ,					)

        self.parent.assertEqual(result.start_logits.shape    ,					(self.batch_size, self.seq_length))
        self.parent.assertEqual(result.end_logits.shape    ,					(self.batch_size, self.seq_length))
        self.parent.assertEqual(result.relevance_logits.shape    ,					(self.batch_size,))




 def 	__snake_case		(    self      :						Union[str, Any]):







        '''simple docstring'''



        lowerCAmelCase__  			=      self.prepare_config_and_inputs()
        (
            (
            lowerCAmelCase__
        )			,      (
            lowerCAmelCase__
        )			,      (
            lowerCAmelCase__
        )			,      (
            lowerCAmelCase__
        )			,      (
            lowerCAmelCase__
        )			,      (
            lowerCAmelCase__
        )			,      (
            lowerCAmelCase__
        )			,      
        )  			=      config_and_inputs
        lowerCAmelCase__  			=      {'input_ids': input_ids}
        return config, inputs_dict






@require_torch
class        a_				(		SCREAMING_SNAKE_CASE ,  SCREAMING_SNAKE_CASE ,  unittest.TestCase		):






 '''simple docstring'''






 UpperCAmelCase_							=      (
     (
         DPRContextEncoder,
         DPRQuestionEncoder,
         DPRReader,
     )
     if is_torch_available()
     else ()
 )
 UpperCAmelCase_							=      {'feature-extraction': DPRQuestionEncoder} if is_torch_available() else {}

 UpperCAmelCase_							=      False
 UpperCAmelCase_							=      False  # why?
 UpperCAmelCase_							=      False
 UpperCAmelCase_							=      False




 def 	__snake_case		(    self      :						Union[str, Any]):







        '''simple docstring'''



        lowerCAmelCase__  			=      DPRModelTester(self)
        lowerCAmelCase__  			=      ConfigTester(self    ,					config_class=lowercase__    ,					hidden_size=37)




 def 	__snake_case		(    self      :						Optional[int]):







        '''simple docstring'''



        self.config_tester.run_common_tests()




 def 	__snake_case		(    self      :						Union[str, Any]):







        '''simple docstring'''



        lowerCAmelCase__  			=      self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_context_encoder(*lowercase__)




 def 	__snake_case		(    self      :						Optional[int]):







        '''simple docstring'''



        lowerCAmelCase__  			=      self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_question_encoder(*lowercase__)




 def 	__snake_case		(    self      :						List[str]):







        '''simple docstring'''



        lowerCAmelCase__  			=      self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_reader(*lowercase__)




 def 	__snake_case		(    self      :						Union[str, Any]):







        '''simple docstring'''



        lowerCAmelCase__  			=      self.model_tester.prepare_config_and_inputs()[0]

        lowerCAmelCase__  			=      DPRQuestionEncoder(config=lowercase__)
        model.to(lowercase__)
        model.eval()

        with tempfile.TemporaryDirectory() as tmp_dirname:
               model.save_pretrained(lowercase__)
               lowerCAmelCase__  			=      DPRQuestionEncoder.from_pretrained(lowercase__    ,					projection_dim=512)

        self.assertIsNotNone(lowercase__)




 @slow
 def 	__snake_case		(    self      :						Optional[int]):







        '''simple docstring'''



        for model_name in DPR_CONTEXT_ENCODER_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
               lowerCAmelCase__  			=      DPRContextEncoder.from_pretrained(lowercase__)
               self.assertIsNotNone(lowercase__)

        for model_name in DPR_CONTEXT_ENCODER_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
               lowerCAmelCase__  			=      DPRContextEncoder.from_pretrained(lowercase__)
               self.assertIsNotNone(lowercase__)

        for model_name in DPR_QUESTION_ENCODER_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
               lowerCAmelCase__  			=      DPRQuestionEncoder.from_pretrained(lowercase__)
               self.assertIsNotNone(lowercase__)

        for model_name in DPR_READER_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
               lowerCAmelCase__  			=      DPRReader.from_pretrained(lowercase__)
               self.assertIsNotNone(lowercase__)






@require_torch
class        a_				(		unittest.TestCase		):






 '''simple docstring'''






 @slow
 def 	__snake_case		(    self      :						Union[str, Any]):







        '''simple docstring'''



        lowerCAmelCase__  			=      DPRQuestionEncoder.from_pretrained('facebook/dpr-question_encoder-single-nq-base'    ,					return_dict=lowercase__)
        model.to(lowercase__)

        lowerCAmelCase__  			=      torch.tensor(
            [[101, 7_592, 1_010, 2_003, 2_026, 3_899, 10_140, 1_029, 102]]    ,					dtype=torch.long    ,					device=lowercase__)  # [CLS] hello, is my dog cute? [SEP]
        lowerCAmelCase__  			=      model(lowercase__)[0]  # embedding shape = (1, 768)
        # compare the actual values for a slice.
        lowerCAmelCase__  			=      torch.tensor(
            [
                [
                    0.03_236_253,
                    0.12_753_335,
                    0.16_818_509,
                    0.00_279_786,
                    0.3_896_933,
                    0.24_264_945,
                    0.2_178_971,
                    -0.02_335_227,
                    -0.08_481_959,
                    -0.14_324_117,
                ]
            ]    ,					dtype=torch.float    ,					device=lowercase__    ,					)
        self.assertTrue(torch.allclose(output[:, :10]    ,					lowercase__    ,					atol=1e-4))




 @slow
 def 	__snake_case		(    self      :						Optional[int]):







        '''simple docstring'''



        lowerCAmelCase__  			=      DPRReaderTokenizer.from_pretrained('facebook/dpr-reader-single-nq-base')
        lowerCAmelCase__  			=      DPRReader.from_pretrained('facebook/dpr-reader-single-nq-base')
        model.to(lowercase__)

        lowerCAmelCase__  			=      tokenizer(
            questions='What is love ?'    ,					titles='Haddaway'    ,					texts='What Is Love is a song recorded by the artist Haddaway'    ,					padding=lowercase__    ,					return_tensors='pt'    ,					)
        encoded_inputs.to(lowercase__)

        lowerCAmelCase__  			=      model(**lowercase__)

        # compare the actual values for a slice.
        lowerCAmelCase__  			=      torch.tensor(
            [[-10.3_005, -10.7_765, -11.4_872, -11.6_841, -11.9_312, -10.3_002, -9.8_544, -11.7_378, -12.0_821, -10.2_975]]    ,					dtype=torch.float    ,					device=lowercase__    ,					)

        lowerCAmelCase__  			=      torch.tensor(
            [[-11.0_684, -11.7_041, -11.5_397, -10.3_465, -10.8_791, -6.8_443, -11.9_959, -11.0_364, -10.0_096, -6.8_405]]    ,					dtype=torch.float    ,					device=lowercase__    ,					)
        self.assertTrue(torch.allclose(outputs.start_logits[:, :10]    ,					lowercase__    ,					atol=1e-4))
        self.assertTrue(torch.allclose(outputs.end_logits[:, :10]    ,					lowercase__    ,					atol=1e-4))

from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_torch_available,
)


lowerCAmelCase__					=				{
    'auto_factory': ['get_values'],
    'configuration_auto': ['ALL_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CONFIG_MAPPING', 'MODEL_NAMES_MAPPING', 'AutoConfig'],
    'feature_extraction_auto': ['FEATURE_EXTRACTOR_MAPPING', 'AutoFeatureExtractor'],
    'image_processing_auto': ['IMAGE_PROCESSOR_MAPPING', 'AutoImageProcessor'],
    'processing_auto': ['PROCESSOR_MAPPING', 'AutoProcessor'],
    'tokenization_auto': ['TOKENIZER_MAPPING', 'AutoTokenizer'],
}

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    lowerCAmelCase__					=				[
        'MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING',
        'MODEL_FOR_AUDIO_FRAME_CLASSIFICATION_MAPPING',
        'MODEL_FOR_AUDIO_XVECTOR_MAPPING',
        'MODEL_FOR_BACKBONE_MAPPING',
        'MODEL_FOR_CAUSAL_IMAGE_MODELING_MAPPING',
        'MODEL_FOR_CAUSAL_LM_MAPPING',
        'MODEL_FOR_CTC_MAPPING',
        'MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING',
        'MODEL_FOR_DEPTH_ESTIMATION_MAPPING',
        'MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING',
        'MODEL_FOR_IMAGE_SEGMENTATION_MAPPING',
        'MODEL_FOR_INSTANCE_SEGMENTATION_MAPPING',
        'MODEL_FOR_MASKED_IMAGE_MODELING_MAPPING',
        'MODEL_FOR_MASKED_LM_MAPPING',
        'MODEL_FOR_MASK_GENERATION_MAPPING',
        'MODEL_FOR_MULTIPLE_CHOICE_MAPPING',
        'MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING',
        'MODEL_FOR_OBJECT_DETECTION_MAPPING',
        'MODEL_FOR_PRETRAINING_MAPPING',
        'MODEL_FOR_QUESTION_ANSWERING_MAPPING',
        'MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING',
        'MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING',
        'MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING',
        'MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING',
        'MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING',
        'MODEL_FOR_TEXT_ENCODING_MAPPING',
        'MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING',
        'MODEL_FOR_UNIVERSAL_SEGMENTATION_MAPPING',
        'MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING',
        'MODEL_FOR_VISION_2_SEQ_MAPPING',
        'MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING',
        'MODEL_MAPPING',
        'MODEL_WITH_LM_HEAD_MAPPING',
        'MODEL_FOR_ZERO_SHOT_IMAGE_CLASSIFICATION_MAPPING',
        'MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING',
        'AutoModel',
        'AutoBackbone',
        'AutoModelForAudioClassification',
        'AutoModelForAudioFrameClassification',
        'AutoModelForAudioXVector',
        'AutoModelForCausalLM',
        'AutoModelForCTC',
        'AutoModelForDepthEstimation',
        'AutoModelForImageClassification',
        'AutoModelForImageSegmentation',
        'AutoModelForInstanceSegmentation',
        'AutoModelForMaskGeneration',
        'AutoModelForTextEncoding',
        'AutoModelForMaskedImageModeling',
        'AutoModelForMaskedLM',
        'AutoModelForMultipleChoice',
        'AutoModelForNextSentencePrediction',
        'AutoModelForObjectDetection',
        'AutoModelForPreTraining',
        'AutoModelForQuestionAnswering',
        'AutoModelForSemanticSegmentation',
        'AutoModelForSeq2SeqLM',
        'AutoModelForSequenceClassification',
        'AutoModelForSpeechSeq2Seq',
        'AutoModelForTableQuestionAnswering',
        'AutoModelForTokenClassification',
        'AutoModelForUniversalSegmentation',
        'AutoModelForVideoClassification',
        'AutoModelForVision2Seq',
        'AutoModelForVisualQuestionAnswering',
        'AutoModelForDocumentQuestionAnswering',
        'AutoModelWithLMHead',
        'AutoModelForZeroShotImageClassification',
        'AutoModelForZeroShotObjectDetection',
    ]

try:
    if not is_tf_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    lowerCAmelCase__					=				[
        'TF_MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING',
        'TF_MODEL_FOR_CAUSAL_LM_MAPPING',
        'TF_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING',
        'TF_MODEL_FOR_MASK_GENERATION_MAPPING',
        'TF_MODEL_FOR_MASKED_IMAGE_MODELING_MAPPING',
        'TF_MODEL_FOR_MASKED_LM_MAPPING',
        'TF_MODEL_FOR_MULTIPLE_CHOICE_MAPPING',
        'TF_MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING',
        'TF_MODEL_FOR_PRETRAINING_MAPPING',
        'TF_MODEL_FOR_QUESTION_ANSWERING_MAPPING',
        'TF_MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING',
        'TF_MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING',
        'TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING',
        'TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING',
        'TF_MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING',
        'TF_MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING',
        'TF_MODEL_FOR_TEXT_ENCODING_MAPPING',
        'TF_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING',
        'TF_MODEL_FOR_VISION_2_SEQ_MAPPING',
        'TF_MODEL_FOR_ZERO_SHOT_IMAGE_CLASSIFICATION_MAPPING',
        'TF_MODEL_MAPPING',
        'TF_MODEL_WITH_LM_HEAD_MAPPING',
        'TFAutoModel',
        'TFAutoModelForAudioClassification',
        'TFAutoModelForCausalLM',
        'TFAutoModelForImageClassification',
        'TFAutoModelForMaskedImageModeling',
        'TFAutoModelForMaskedLM',
        'TFAutoModelForMaskGeneration',
        'TFAutoModelForMultipleChoice',
        'TFAutoModelForNextSentencePrediction',
        'TFAutoModelForPreTraining',
        'TFAutoModelForDocumentQuestionAnswering',
        'TFAutoModelForQuestionAnswering',
        'TFAutoModelForSemanticSegmentation',
        'TFAutoModelForSeq2SeqLM',
        'TFAutoModelForSequenceClassification',
        'TFAutoModelForSpeechSeq2Seq',
        'TFAutoModelForTableQuestionAnswering',
        'TFAutoModelForTextEncoding',
        'TFAutoModelForTokenClassification',
        'TFAutoModelForVision2Seq',
        'TFAutoModelForZeroShotImageClassification',
        'TFAutoModelWithLMHead',
    ]

try:
    if not is_flax_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    lowerCAmelCase__					=				[
        'FLAX_MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING',
        'FLAX_MODEL_FOR_CAUSAL_LM_MAPPING',
        'FLAX_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING',
        'FLAX_MODEL_FOR_MASKED_LM_MAPPING',
        'FLAX_MODEL_FOR_MULTIPLE_CHOICE_MAPPING',
        'FLAX_MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING',
        'FLAX_MODEL_FOR_PRETRAINING_MAPPING',
        'FLAX_MODEL_FOR_QUESTION_ANSWERING_MAPPING',
        'FLAX_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING',
        'FLAX_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING',
        'FLAX_MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING',
        'FLAX_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING',
        'FLAX_MODEL_FOR_VISION_2_SEQ_MAPPING',
        'FLAX_MODEL_MAPPING',
        'FlaxAutoModel',
        'FlaxAutoModelForCausalLM',
        'FlaxAutoModelForImageClassification',
        'FlaxAutoModelForMaskedLM',
        'FlaxAutoModelForMultipleChoice',
        'FlaxAutoModelForNextSentencePrediction',
        'FlaxAutoModelForPreTraining',
        'FlaxAutoModelForQuestionAnswering',
        'FlaxAutoModelForSeq2SeqLM',
        'FlaxAutoModelForSequenceClassification',
        'FlaxAutoModelForSpeechSeq2Seq',
        'FlaxAutoModelForTokenClassification',
        'FlaxAutoModelForVision2Seq',
    ]


if TYPE_CHECKING:
    from .auto_factory import get_values
    from .configuration_auto import ALL_PRETRAINED_CONFIG_ARCHIVE_MAP, CONFIG_MAPPING, MODEL_NAMES_MAPPING, AutoConfig
    from .feature_extraction_auto import FEATURE_EXTRACTOR_MAPPING, AutoFeatureExtractor
    from .image_processing_auto import IMAGE_PROCESSOR_MAPPING, AutoImageProcessor
    from .processing_auto import PROCESSOR_MAPPING, AutoProcessor
    from .tokenization_auto import TOKENIZER_MAPPING, AutoTokenizer

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_auto import (
            MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING,
            MODEL_FOR_AUDIO_FRAME_CLASSIFICATION_MAPPING,
            MODEL_FOR_AUDIO_XVECTOR_MAPPING,
            MODEL_FOR_BACKBONE_MAPPING,
            MODEL_FOR_CAUSAL_IMAGE_MODELING_MAPPING,
            MODEL_FOR_CAUSAL_LM_MAPPING,
            MODEL_FOR_CTC_MAPPING,
            MODEL_FOR_DEPTH_ESTIMATION_MAPPING,
            MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING,
            MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING,
            MODEL_FOR_IMAGE_SEGMENTATION_MAPPING,
            MODEL_FOR_INSTANCE_SEGMENTATION_MAPPING,
            MODEL_FOR_MASK_GENERATION_MAPPING,
            MODEL_FOR_MASKED_IMAGE_MODELING_MAPPING,
            MODEL_FOR_MASKED_LM_MAPPING,
            MODEL_FOR_MULTIPLE_CHOICE_MAPPING,
            MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING,
            MODEL_FOR_OBJECT_DETECTION_MAPPING,
            MODEL_FOR_PRETRAINING_MAPPING,
            MODEL_FOR_QUESTION_ANSWERING_MAPPING,
            MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING,
            MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING,
            MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING,
            MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING,
            MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING,
            MODEL_FOR_TEXT_ENCODING_MAPPING,
            MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING,
            MODEL_FOR_UNIVERSAL_SEGMENTATION_MAPPING,
            MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING,
            MODEL_FOR_VISION_2_SEQ_MAPPING,
            MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING,
            MODEL_FOR_ZERO_SHOT_IMAGE_CLASSIFICATION_MAPPING,
            MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING,
            MODEL_MAPPING,
            MODEL_WITH_LM_HEAD_MAPPING,
            AutoBackbone,
            AutoModel,
            AutoModelForAudioClassification,
            AutoModelForAudioFrameClassification,
            AutoModelForAudioXVector,
            AutoModelForCausalLM,
            AutoModelForCTC,
            AutoModelForDepthEstimation,
            AutoModelForDocumentQuestionAnswering,
            AutoModelForImageClassification,
            AutoModelForImageSegmentation,
            AutoModelForInstanceSegmentation,
            AutoModelForMaskedImageModeling,
            AutoModelForMaskedLM,
            AutoModelForMaskGeneration,
            AutoModelForMultipleChoice,
            AutoModelForNextSentencePrediction,
            AutoModelForObjectDetection,
            AutoModelForPreTraining,
            AutoModelForQuestionAnswering,
            AutoModelForSemanticSegmentation,
            AutoModelForSeqaSeqLM,
            AutoModelForSequenceClassification,
            AutoModelForSpeechSeqaSeq,
            AutoModelForTableQuestionAnswering,
            AutoModelForTextEncoding,
            AutoModelForTokenClassification,
            AutoModelForUniversalSegmentation,
            AutoModelForVideoClassification,
            AutoModelForVisionaSeq,
            AutoModelForVisualQuestionAnswering,
            AutoModelForZeroShotImageClassification,
            AutoModelForZeroShotObjectDetection,
            AutoModelWithLMHead,
        )

    try:
        if not is_tf_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_tf_auto import (
            TF_MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING,
            TF_MODEL_FOR_CAUSAL_LM_MAPPING,
            TF_MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING,
            TF_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING,
            TF_MODEL_FOR_MASK_GENERATION_MAPPING,
            TF_MODEL_FOR_MASKED_IMAGE_MODELING_MAPPING,
            TF_MODEL_FOR_MASKED_LM_MAPPING,
            TF_MODEL_FOR_MULTIPLE_CHOICE_MAPPING,
            TF_MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING,
            TF_MODEL_FOR_PRETRAINING_MAPPING,
            TF_MODEL_FOR_QUESTION_ANSWERING_MAPPING,
            TF_MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING,
            TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING,
            TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING,
            TF_MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING,
            TF_MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING,
            TF_MODEL_FOR_TEXT_ENCODING_MAPPING,
            TF_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING,
            TF_MODEL_FOR_VISION_2_SEQ_MAPPING,
            TF_MODEL_FOR_ZERO_SHOT_IMAGE_CLASSIFICATION_MAPPING,
            TF_MODEL_MAPPING,
            TF_MODEL_WITH_LM_HEAD_MAPPING,
            TFAutoModel,
            TFAutoModelForAudioClassification,
            TFAutoModelForCausalLM,
            TFAutoModelForDocumentQuestionAnswering,
            TFAutoModelForImageClassification,
            TFAutoModelForMaskedImageModeling,
            TFAutoModelForMaskedLM,
            TFAutoModelForMaskGeneration,
            TFAutoModelForMultipleChoice,
            TFAutoModelForNextSentencePrediction,
            TFAutoModelForPreTraining,
            TFAutoModelForQuestionAnswering,
            TFAutoModelForSemanticSegmentation,
            TFAutoModelForSeqaSeqLM,
            TFAutoModelForSequenceClassification,
            TFAutoModelForSpeechSeqaSeq,
            TFAutoModelForTableQuestionAnswering,
            TFAutoModelForTextEncoding,
            TFAutoModelForTokenClassification,
            TFAutoModelForVisionaSeq,
            TFAutoModelForZeroShotImageClassification,
            TFAutoModelWithLMHead,
        )

    try:
        if not is_flax_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_flax_auto import (
            FLAX_MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING,
            FLAX_MODEL_FOR_CAUSAL_LM_MAPPING,
            FLAX_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING,
            FLAX_MODEL_FOR_MASKED_LM_MAPPING,
            FLAX_MODEL_FOR_MULTIPLE_CHOICE_MAPPING,
            FLAX_MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING,
            FLAX_MODEL_FOR_PRETRAINING_MAPPING,
            FLAX_MODEL_FOR_QUESTION_ANSWERING_MAPPING,
            FLAX_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING,
            FLAX_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING,
            FLAX_MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING,
            FLAX_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING,
            FLAX_MODEL_FOR_VISION_2_SEQ_MAPPING,
            FLAX_MODEL_MAPPING,
            FlaxAutoModel,
            FlaxAutoModelForCausalLM,
            FlaxAutoModelForImageClassification,
            FlaxAutoModelForMaskedLM,
            FlaxAutoModelForMultipleChoice,
            FlaxAutoModelForNextSentencePrediction,
            FlaxAutoModelForPreTraining,
            FlaxAutoModelForQuestionAnswering,
            FlaxAutoModelForSeqaSeqLM,
            FlaxAutoModelForSequenceClassification,
            FlaxAutoModelForSpeechSeqaSeq,
            FlaxAutoModelForTokenClassification,
            FlaxAutoModelForVisionaSeq,
        )

else:
    import sys

    lowerCAmelCase__					=				_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)
