import inspect
import unittest

from transformers import SwinaSRConfig
from transformers.testing_utils import require_torch, require_vision, slow, torch_device
from transformers.utils import is_torch_available, is_vision_available

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, _config_zero_init, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
    import torch
    from torch import nn

    from transformers import SwinaSRForImageSuperResolution, SwinaSRModel
    from transformers.models.swinasr.modeling_swinasr import SWIN2SR_PRETRAINED_MODEL_ARCHIVE_LIST

if is_vision_available():
    from PIL import Image

    from transformers import SwinaSRImageProcessor
class        a_				:






 '''simple docstring'''






 def __init__(    self      :						List[Any]    ,					lowercase__      :						Optional[int]    ,					lowercase__      :						Any=13    ,					lowercase__      :						Union[str, Any]=32    ,					lowercase__      :						Any=1    ,					lowercase__      :						Any=3    ,					lowercase__      :						int=16    ,					lowercase__      :						Dict=[1, 2, 1]    ,					lowercase__      :						Tuple=[2, 2, 4]    ,					lowercase__      :						List[Any]=2    ,					lowercase__      :						List[str]=2.0    ,					lowercase__      :						Dict=True    ,					lowercase__      :						Dict=0.0    ,					lowercase__      :						str=0.0    ,					lowercase__      :						Dict=0.1    ,					lowercase__      :						List[Any]="gelu"    ,					lowercase__      :						Optional[int]=False    ,					lowercase__      :						List[Any]=True    ,					lowercase__      :						Any=0.02    ,					lowercase__      :						Dict=1e-5    ,					lowercase__      :						int=True    ,					lowercase__      :						Any=None    ,					lowercase__      :						Tuple=False    ,					lowercase__      :						int=2    ,					):







        '''simple docstring'''



        lowerCAmelCase__  			=      parent
        lowerCAmelCase__  			=      batch_size
        lowerCAmelCase__  			=      image_size
        lowerCAmelCase__  			=      patch_size
        lowerCAmelCase__  			=      num_channels
        lowerCAmelCase__  			=      embed_dim
        lowerCAmelCase__  			=      depths
        lowerCAmelCase__  			=      num_heads
        lowerCAmelCase__  			=      window_size
        lowerCAmelCase__  			=      mlp_ratio
        lowerCAmelCase__  			=      qkv_bias
        lowerCAmelCase__  			=      hidden_dropout_prob
        lowerCAmelCase__  			=      attention_probs_dropout_prob
        lowerCAmelCase__  			=      drop_path_rate
        lowerCAmelCase__  			=      hidden_act
        lowerCAmelCase__  			=      use_absolute_embeddings
        lowerCAmelCase__  			=      patch_norm
        lowerCAmelCase__  			=      layer_norm_eps
        lowerCAmelCase__  			=      initializer_range
        lowerCAmelCase__  			=      is_training
        lowerCAmelCase__  			=      scope
        lowerCAmelCase__  			=      use_labels
        lowerCAmelCase__  			=      upscale

        # here we set some attributes to make tests pass
        lowerCAmelCase__  			=      len(lowercase__)
        lowerCAmelCase__  			=      embed_dim
        lowerCAmelCase__  			=      (image_size // patch_size) ** 2




 def 	__snake_case		(    self      :						Optional[Any]):







        '''simple docstring'''



        lowerCAmelCase__  			=      floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size])

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

        lowerCAmelCase__  			=      self.get_config()

        return config, pixel_values, labels




 def 	__snake_case		(    self      :						Optional[Any]):







        '''simple docstring'''



        return SwinaSRConfig(
            image_size=self.image_size    ,					patch_size=self.patch_size    ,					num_channels=self.num_channels    ,					embed_dim=self.embed_dim    ,					depths=self.depths    ,					num_heads=self.num_heads    ,					window_size=self.window_size    ,					mlp_ratio=self.mlp_ratio    ,					qkv_bias=self.qkv_bias    ,					hidden_dropout_prob=self.hidden_dropout_prob    ,					attention_probs_dropout_prob=self.attention_probs_dropout_prob    ,					drop_path_rate=self.drop_path_rate    ,					hidden_act=self.hidden_act    ,					use_absolute_embeddings=self.use_absolute_embeddings    ,					path_norm=self.patch_norm    ,					layer_norm_eps=self.layer_norm_eps    ,					initializer_range=self.initializer_range    ,					upscale=self.upscale    ,					)




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







        '''simple docstring'''



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

        self.parent.assertEqual(
            result.last_hidden_state.shape    ,					(self.batch_size, self.embed_dim, self.image_size, self.image_size))




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







        '''simple docstring'''



        lowerCAmelCase__  			=      SwinaSRForImageSuperResolution(lowercase__)
        model.to(lowercase__)
        model.eval()
        lowerCAmelCase__  			=      model(lowercase__)

        lowerCAmelCase__  			=      self.image_size * self.upscale
        self.parent.assertEqual(
            result.reconstruction.shape    ,					(self.batch_size, self.num_channels, expected_image_size, expected_image_size))




 def 	__snake_case		(    self      :						List[str]):







        '''simple docstring'''



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






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






 '''simple docstring'''






 UpperCAmelCase_							=      (SwinaSRModel, SwinaSRForImageSuperResolution) if is_torch_available() else ()
 UpperCAmelCase_							=      {'feature-extraction': SwinaSRModel} if is_torch_available() else {}

 UpperCAmelCase_							=      False
 UpperCAmelCase_							=      False
 UpperCAmelCase_							=      False
 UpperCAmelCase_							=      False
 UpperCAmelCase_							=      False




 def 	__snake_case		(    self      :						Optional[int]):







        '''simple docstring'''



        lowerCAmelCase__  			=      SwinaSRModelTester(self)
        lowerCAmelCase__  			=      ConfigTester(self    ,					config_class=lowercase__    ,					embed_dim=37)




 def 	__snake_case		(    self      :						Dict):







        '''simple docstring'''



        self.config_tester.create_and_test_config_to_json_string()
        self.config_tester.create_and_test_config_to_json_file()
        self.config_tester.create_and_test_config_from_and_save_pretrained()
        self.config_tester.create_and_test_config_with_num_labels()
        self.config_tester.check_config_can_be_init_without_params()
        self.config_tester.check_config_arguments_init()




 def 	__snake_case		(    self      :						Optional[Any]):







        '''simple docstring'''



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




 def 	__snake_case		(    self      :						str):







        '''simple docstring'''



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




 @unittest.skip(reason='Got `CUDA error: misaligned address` with PyTorch 2.0.0.')
 def 	__snake_case		(    self      :						int):







        '''simple docstring'''



        pass




 @unittest.skip(reason='Swin2SR does not use inputs_embeds')
 def 	__snake_case		(    self      :						List[str]):







        '''simple docstring'''



        pass




 @unittest.skip(reason='Swin2SR does not support training yet')
 def 	__snake_case		(    self      :						Union[str, Any]):







        '''simple docstring'''



        pass




 @unittest.skip(reason='Swin2SR does not support training yet')
 def 	__snake_case		(    self      :						int):







        '''simple docstring'''



        pass




 def 	__snake_case		(    self      :						int):







        '''simple docstring'''



        lowerCAmelCase__			,      lowerCAmelCase__  			=      self.model_tester.prepare_config_and_inputs_for_common()

        for model_class in self.all_model_classes:
               lowerCAmelCase__  			=      model_class(lowercase__)
               self.assertIsInstance(model.get_input_embeddings()    ,					(nn.Module))
               lowerCAmelCase__  			=      model.get_output_embeddings()
               self.assertTrue(x is None or isinstance(lowercase__    ,					nn.Linear))




 def 	__snake_case		(    self      :						List[Any]):







        '''simple docstring'''



        lowerCAmelCase__			,      lowerCAmelCase__  			=      self.model_tester.prepare_config_and_inputs_for_common()

        for model_class in self.all_model_classes:
               lowerCAmelCase__  			=      model_class(lowercase__)
               lowerCAmelCase__  			=      inspect.signature(model.forward)
               # signature.parameters is an OrderedDict => so arg_names order is deterministic
               lowerCAmelCase__  			=      [*signature.parameters.keys()]

               lowerCAmelCase__  			=      ['pixel_values']
               self.assertListEqual(arg_names[:1]    ,					lowercase__)




 @slow
 def 	__snake_case		(    self      :						Tuple):







        '''simple docstring'''



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




 def 	__snake_case		(    self      :						List[Any]):







        '''simple docstring'''



        lowerCAmelCase__			,      lowerCAmelCase__  			=      self.model_tester.prepare_config_and_inputs_for_common()

        lowerCAmelCase__  			=      _config_zero_init(lowercase__)
        for model_class in self.all_model_classes:
               lowerCAmelCase__  			=      model_class(config=lowercase__)
               for name, param in model.named_parameters():
                      if "logit_scale" in name:
                             continue
                      if param.requires_grad:
                             self.assertIn(
                                 ((param.data.mean() * 1e9).round() / 1e9).item()    ,					[0.0, 1.0]    ,					msg=F"""Parameter {name} of model {model_class} seems not properly initialized"""    ,					)




 def 	__snake_case		(    self      :						Tuple):







        '''simple docstring'''



        lowerCAmelCase__			,      lowerCAmelCase__  			=      self.model_tester.prepare_config_and_inputs_for_common()
        lowerCAmelCase__  			=      True

        for model_class in self.all_model_classes:
               lowerCAmelCase__  			=      True
               lowerCAmelCase__  			=      False
               lowerCAmelCase__  			=      True
               lowerCAmelCase__  			=      model_class(lowercase__)
               model.to(lowercase__)
               model.eval()
               with torch.no_grad():
                      lowerCAmelCase__  			=      model(**self._prepare_for_class(lowercase__    ,					lowercase__))
               lowerCAmelCase__  			=      outputs.attentions
               lowerCAmelCase__  			=      len(self.model_tester.depths)
               self.assertEqual(len(lowercase__)    ,					lowercase__)

               # check that output_attentions also work using config
               del inputs_dict["output_attentions"]
               lowerCAmelCase__  			=      True
               lowerCAmelCase__  			=      config.window_size**2
               lowerCAmelCase__  			=      model_class(lowercase__)
               model.to(lowercase__)
               model.eval()
               with torch.no_grad():
                      lowerCAmelCase__  			=      model(**self._prepare_for_class(lowercase__    ,					lowercase__))
               lowerCAmelCase__  			=      outputs.attentions
               self.assertEqual(len(lowercase__)    ,					lowercase__)

               self.assertListEqual(
                   list(attentions[0].shape[-3:])    ,					[self.model_tester.num_heads[0], window_size_squared, window_size_squared]    ,					)
               lowerCAmelCase__  			=      len(lowercase__)

               # Check attention is always last and order is fine
               lowerCAmelCase__  			=      True
               lowerCAmelCase__  			=      True
               lowerCAmelCase__  			=      model_class(lowercase__)
               model.to(lowercase__)
               model.eval()
               with torch.no_grad():
                      lowerCAmelCase__  			=      model(**self._prepare_for_class(lowercase__    ,					lowercase__))

               self.assertEqual(out_len + 1    ,					len(lowercase__))

               lowerCAmelCase__  			=      outputs.attentions

               self.assertEqual(len(lowercase__)    ,					lowercase__)

               self.assertListEqual(
                   list(self_attentions[0].shape[-3:])    ,					[self.model_tester.num_heads[0], window_size_squared, window_size_squared]    ,					)






@require_vision
@require_torch
@slow
class        a_				(		unittest.TestCase		):






 '''simple docstring'''






 def 	__snake_case		(    self      :						str):







        '''simple docstring'''



        lowerCAmelCase__  			=      SwinaSRImageProcessor()
        lowerCAmelCase__  			=      SwinaSRForImageSuperResolution.from_pretrained('caidas/swin2SR-classical-sr-x2-64').to(lowercase__)

        lowerCAmelCase__  			=      Image.open('./tests/fixtures/tests_samples/COCO/000000039769.png')
        lowerCAmelCase__  			=      processor(images=lowercase__    ,					return_tensors='pt').to(lowercase__)

        # forward pass
        with torch.no_grad():
               lowerCAmelCase__  			=      model(**lowercase__)

        # verify the logits
        lowerCAmelCase__  			=      torch.Size([1, 3, 976, 1_296])
        self.assertEqual(outputs.reconstruction.shape    ,					lowercase__)
        lowerCAmelCase__  			=      torch.tensor(
            [[0.5_458, 0.5_546, 0.5_638], [0.5_526, 0.5_565, 0.5_651], [0.5_396, 0.5_426, 0.5_621]]).to(lowercase__)
        self.assertTrue(torch.allclose(outputs.reconstruction[0, 0, :3, :3]    ,					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__)
