


import tempfile

import torch

from diffusers import (
    DEISMultistepScheduler,
    DPMSolverMultistepScheduler,
    DPMSolverSinglestepScheduler,
    UniPCMultistepScheduler,
)

from .test_schedulers import SchedulerCommonTest







class 					snake_case__(				A__				):







						'''simple docstring'''




						SCREAMING_SNAKE_CASE__   :	Tuple       =				(DPMSolverMultistepScheduler,)
						SCREAMING_SNAKE_CASE__   :	List[Any]       =				(("""num_inference_steps""", 25),)




						def     lowercase_			(					self ,    **__lowercase				)       ->     int:
										lowerCAmelCase_			:   Union[str, Any]     					=					{
										    '''num_train_timesteps''': 1_0_0_0,
										    '''beta_start''': 0.00_01,
										    '''beta_end''': 0.02,
										    '''beta_schedule''': '''linear''',
										    '''solver_order''': 2,
										    '''prediction_type''': '''epsilon''',
										    '''thresholding''': False,
										    '''sample_max_value''': 1.0,
										    '''algorithm_type''': '''dpmsolver++''',
										    '''solver_type''': '''midpoint''',
										    '''lower_order_final''': False,
										    '''lambda_min_clipped''': -float('''inf'''				),
										    '''variance_type''': None,
										}

										config.update(**__lowercase				)
										return config




						def     lowercase_			(					self ,    __lowercase=0 ,    **__lowercase				)       ->     Any:
										lowerCAmelCase_			:   Dict     					=					dict(self.forward_default_kwargs				)
										lowerCAmelCase_			:   Union[str, Any]     					=					kwargs.pop('''num_inference_steps''' ,    __lowercase				)
										lowerCAmelCase_			:   Tuple     					=					self.dummy_sample
										lowerCAmelCase_			:   Tuple     					=					0.1 * sample
										lowerCAmelCase_			:   Tuple     					=					[residual + 0.2, residual + 0.15, residual + 0.10]

										for scheduler_class in self.scheduler_classes:
														lowerCAmelCase_			:   Optional[Any]     					=					self.get_scheduler_config(**__lowercase				)
														lowerCAmelCase_			:   Tuple     					=					scheduler_class(**__lowercase				)
														scheduler.set_timesteps(__lowercase				)
														# copy over dummy past residuals
														lowerCAmelCase_			:   Any     					=					dummy_past_residuals[: scheduler.config.solver_order]

														with tempfile.TemporaryDirectory() as tmpdirname:
																		scheduler.save_config(__lowercase				)
																		lowerCAmelCase_			:   Tuple     					=					scheduler_class.from_pretrained(__lowercase				)
																		new_scheduler.set_timesteps(__lowercase				)
																		# copy over dummy past residuals
																		lowerCAmelCase_			:   Dict     					=					dummy_past_residuals[: new_scheduler.config.solver_order]

														lowerCAmelCase_			:   Optional[Any]     					=					sample, sample
														for t in range(__lowercase ,    time_step + scheduler.config.solver_order + 1				):
																		lowerCAmelCase_			:   Union[str, Any]     					=					scheduler.step(__lowercase ,    __lowercase ,    __lowercase ,    **__lowercase				).prev_sample
																		lowerCAmelCase_			:   Any     					=					new_scheduler.step(__lowercase ,    __lowercase ,    __lowercase ,    **__lowercase				).prev_sample

																		assert torch.sum(torch.abs(output - new_output				)				) < 1e-5, "Scheduler outputs are not identical"




						def     lowercase_			(					self				)       ->     int:
										pass




						def     lowercase_			(					self ,    __lowercase=0 ,    **__lowercase				)       ->     Tuple:
										lowerCAmelCase_			:   Union[str, Any]     					=					dict(self.forward_default_kwargs				)
										lowerCAmelCase_			:   Union[str, Any]     					=					kwargs.pop('''num_inference_steps''' ,    __lowercase				)
										lowerCAmelCase_			:   Optional[int]     					=					self.dummy_sample
										lowerCAmelCase_			:   str     					=					0.1 * sample
										lowerCAmelCase_			:   Dict     					=					[residual + 0.2, residual + 0.15, residual + 0.10]

										for scheduler_class in self.scheduler_classes:
														lowerCAmelCase_			:   List[Any]     					=					self.get_scheduler_config()
														lowerCAmelCase_			:   int     					=					scheduler_class(**__lowercase				)
														scheduler.set_timesteps(__lowercase				)

														# copy over dummy past residuals (must be after setting timesteps)
														lowerCAmelCase_			:   List[Any]     					=					dummy_past_residuals[: scheduler.config.solver_order]

														with tempfile.TemporaryDirectory() as tmpdirname:
																		scheduler.save_config(__lowercase				)
																		lowerCAmelCase_			:   Union[str, Any]     					=					scheduler_class.from_pretrained(__lowercase				)
																		# copy over dummy past residuals
																		new_scheduler.set_timesteps(__lowercase				)

																		# copy over dummy past residual (must be after setting timesteps)
																		lowerCAmelCase_			:   Optional[int]     					=					dummy_past_residuals[: new_scheduler.config.solver_order]

														lowerCAmelCase_			:   str     					=					scheduler.step(__lowercase ,    __lowercase ,    __lowercase ,    **__lowercase				).prev_sample
														lowerCAmelCase_			:   Union[str, Any]     					=					new_scheduler.step(__lowercase ,    __lowercase ,    __lowercase ,    **__lowercase				).prev_sample

														assert torch.sum(torch.abs(output - new_output				)				) < 1e-5, "Scheduler outputs are not identical"




						def     lowercase_			(					self ,    __lowercase=None ,    **__lowercase				)       ->     int:

										if scheduler is None:
														lowerCAmelCase_			:   Any     					=					self.scheduler_classes[0]
														lowerCAmelCase_			:   Dict     					=					self.get_scheduler_config(**__lowercase				)
														lowerCAmelCase_			:   Any     					=					scheduler_class(**__lowercase				)

										lowerCAmelCase_			:   List[Any]     					=					1_0
										lowerCAmelCase_			:   List[str]     					=					self.dummy_model()
										lowerCAmelCase_			:   Tuple     					=					self.dummy_sample_deter
										scheduler.set_timesteps(__lowercase				)

										for i, t in enumerate(scheduler.timesteps				):
														lowerCAmelCase_			:   Optional[int]     					=					model(__lowercase ,    __lowercase				)
														lowerCAmelCase_			:   Optional[int]     					=					scheduler.step(__lowercase ,    __lowercase ,    __lowercase				).prev_sample

										return sample




						def     lowercase_			(					self				)       ->     str:
										lowerCAmelCase_			:   str     					=					dict(self.forward_default_kwargs				)

										lowerCAmelCase_			:   Optional[Any]     					=					kwargs.pop('''num_inference_steps''' ,    __lowercase				)

										for scheduler_class in self.scheduler_classes:
														lowerCAmelCase_			:   Union[str, Any]     					=					self.get_scheduler_config()
														lowerCAmelCase_			:   int     					=					scheduler_class(**__lowercase				)

														lowerCAmelCase_			:   Tuple     					=					self.dummy_sample
														lowerCAmelCase_			:   List[Any]     					=					0.1 * sample

														if num_inference_steps is not None and hasattr(__lowercase ,    '''set_timesteps'''				):
																		scheduler.set_timesteps(__lowercase				)
														elif num_inference_steps is not None and not hasattr(__lowercase ,    '''set_timesteps'''				):
																		lowerCAmelCase_			:   Optional[int]     					=					num_inference_steps

														# copy over dummy past residuals (must be done after set_timesteps)
														lowerCAmelCase_			:   List[Any]     					=					[residual + 0.2, residual + 0.15, residual + 0.10]
														lowerCAmelCase_			:   Union[str, Any]     					=					dummy_past_residuals[: scheduler.config.solver_order]

														lowerCAmelCase_			:   Optional[Any]     					=					scheduler.timesteps[5]
														lowerCAmelCase_			:   int     					=					scheduler.timesteps[6]

														lowerCAmelCase_			:   List[str]     					=					scheduler.step(__lowercase ,    __lowercase ,    __lowercase ,    **__lowercase				).prev_sample
														lowerCAmelCase_			:   str     					=					scheduler.step(__lowercase ,    __lowercase ,    __lowercase ,    **__lowercase				).prev_sample

														self.assertEqual(output_a.shape ,    sample.shape				)
														self.assertEqual(output_a.shape ,    output_a.shape				)




						def     lowercase_			(					self				)       ->     Any:

										for timesteps in [2_5, 5_0, 1_0_0, 9_9_9, 1_0_0_0]:
														self.check_over_configs(num_train_timesteps=__lowercase				)




						def     lowercase_			(					self				)       ->     Optional[Any]:
										self.check_over_configs(thresholding=__lowercase				)
										for order in [1, 2, 3]:
														for solver_type in ["midpoint", "heun"]:
																		for threshold in [0.5, 1.0, 2.0]:
																						for prediction_type in ["epsilon", "sample"]:
																										self.check_over_configs(
																										    thresholding=__lowercase ,    prediction_type=__lowercase ,    sample_max_value=__lowercase ,    algorithm_type='''dpmsolver++''' ,    solver_order=__lowercase ,    solver_type=__lowercase ,    )




						def     lowercase_			(					self				)       ->     Dict:

										for prediction_type in ["epsilon", "v_prediction"]:
														self.check_over_configs(prediction_type=__lowercase				)




						def     lowercase_			(					self				)       ->     Optional[int]:

										for algorithm_type in ["dpmsolver", "dpmsolver++", "sde-dpmsolver", "sde-dpmsolver++"]:
														for solver_type in ["midpoint", "heun"]:
																		for order in [1, 2, 3]:
																						for prediction_type in ["epsilon", "sample"]:
																										if algorithm_type in ["sde-dpmsolver", "sde-dpmsolver++"]:
																														if order == 3:
																																		continue
																										else:
																														self.check_over_configs(
																														    solver_order=__lowercase ,    solver_type=__lowercase ,    prediction_type=__lowercase ,    algorithm_type=__lowercase ,    )
																										lowerCAmelCase_			:   int     					=					self.full_loop(
																										    solver_order=__lowercase ,    solver_type=__lowercase ,    prediction_type=__lowercase ,    algorithm_type=__lowercase ,    )
																										assert not torch.isnan(__lowercase				).any(), "Samples have nan numbers"




						def     lowercase_			(					self				)       ->     Optional[Any]:
										self.check_over_configs(lower_order_final=__lowercase				)
										self.check_over_configs(lower_order_final=__lowercase				)




						def     lowercase_			(					self				)       ->     Optional[Any]:
										self.check_over_configs(lambda_min_clipped=-float('''inf'''				)				)
										self.check_over_configs(lambda_min_clipped=-5.1				)




						def     lowercase_			(					self				)       ->     Optional[Any]:
										self.check_over_configs(variance_type=__lowercase				)
										self.check_over_configs(variance_type='''learned_range'''				)




						def     lowercase_			(					self				)       ->     Optional[Any]:

										for num_inference_steps in [1, 2, 3, 5, 1_0, 5_0, 1_0_0, 9_9_9, 1_0_0_0]:
														self.check_over_forward(num_inference_steps=__lowercase ,    time_step=0				)




						def     lowercase_			(					self				)       ->     Optional[int]:
										lowerCAmelCase_			:   Optional[int]     					=					self.full_loop()
										lowerCAmelCase_			:   Tuple     					=					torch.mean(torch.abs(__lowercase				)				)

										assert abs(result_mean.item() - 0.33_01				) < 1e-3




						def     lowercase_			(					self				)       ->     List[Any]:
										lowerCAmelCase_			:   Tuple     					=					self.full_loop(thresholding=__lowercase ,    dynamic_thresholding_ratio=0.87 ,    sample_max_value=0.5				)
										lowerCAmelCase_			:   Any     					=					torch.mean(torch.abs(__lowercase				)				)

										assert abs(result_mean.item() - 1.13_64				) < 1e-3




						def     lowercase_			(					self				)       ->     int:
										lowerCAmelCase_			:   List[str]     					=					self.full_loop(prediction_type='''v_prediction'''				)
										lowerCAmelCase_			:   Union[str, Any]     					=					torch.mean(torch.abs(__lowercase				)				)

										assert abs(result_mean.item() - 0.22_51				) < 1e-3




						def     lowercase_			(					self				)       ->     Union[str, Any]:
										lowerCAmelCase_			:   List[Any]     					=					self.full_loop(prediction_type='''v_prediction''' ,    use_karras_sigmas=__lowercase				)
										lowerCAmelCase_			:   Tuple     					=					torch.mean(torch.abs(__lowercase				)				)

										assert abs(result_mean.item() - 0.20_96				) < 1e-3




						def     lowercase_			(					self				)       ->     Dict:
										lowerCAmelCase_			:   int     					=					DPMSolverMultistepScheduler(**self.get_scheduler_config()				)
										lowerCAmelCase_			:   List[Any]     					=					self.full_loop(scheduler=__lowercase				)
										lowerCAmelCase_			:   str     					=					torch.mean(torch.abs(__lowercase				)				)

										assert abs(result_mean.item() - 0.33_01				) < 1e-3

										lowerCAmelCase_			:   List[str]     					=					DPMSolverSinglestepScheduler.from_config(scheduler.config				)
										lowerCAmelCase_			:   int     					=					UniPCMultistepScheduler.from_config(scheduler.config				)
										lowerCAmelCase_			:   Any     					=					DEISMultistepScheduler.from_config(scheduler.config				)
										lowerCAmelCase_			:   List[Any]     					=					DPMSolverMultistepScheduler.from_config(scheduler.config				)

										lowerCAmelCase_			:   str     					=					self.full_loop(scheduler=__lowercase				)
										lowerCAmelCase_			:   int     					=					torch.mean(torch.abs(__lowercase				)				)

										assert abs(result_mean.item() - 0.33_01				) < 1e-3




						def     lowercase_			(					self				)       ->     Union[str, Any]:
										lowerCAmelCase_			:   int     					=					self.scheduler_classes[0]
										lowerCAmelCase_			:   List[str]     					=					self.get_scheduler_config(thresholding=__lowercase ,    dynamic_thresholding_ratio=0				)
										lowerCAmelCase_			:   str     					=					scheduler_class(**__lowercase				)

										lowerCAmelCase_			:   Optional[Any]     					=					1_0
										lowerCAmelCase_			:   str     					=					self.dummy_model()
										lowerCAmelCase_			:   str     					=					self.dummy_sample_deter.half()
										scheduler.set_timesteps(__lowercase				)

										for i, t in enumerate(scheduler.timesteps				):
														lowerCAmelCase_			:   Optional[Any]     					=					model(__lowercase ,    __lowercase				)
														lowerCAmelCase_			:   int     					=					scheduler.step(__lowercase ,    __lowercase ,    __lowercase				).prev_sample

										assert sample.dtype == torch.floataa




						def     lowercase_			(					self ,    **__lowercase				)       ->     int:

										for scheduler_class in self.scheduler_classes:
														lowerCAmelCase_			:   Optional[Any]     					=					self.get_scheduler_config(**__lowercase				)
														lowerCAmelCase_			:   int     					=					scheduler_class(**__lowercase				)

														scheduler.set_timesteps(scheduler.config.num_train_timesteps				)
														assert len(scheduler.timesteps.unique()				) == scheduler.num_inference_steps
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__)


