



import tempfile

import torch

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

from .test_schedulers import SchedulerCommonTest



class 	__lowerCAmelCase       (		lowerCAmelCase__				):
	lowerCAmelCase__       =					(DPMSolverMultistepScheduler,)
	lowerCAmelCase__       =					(("""num_inference_steps""", 2_5),)




	def     lowerCamelCase (  self		,			**__UpperCAmelCase			):



				'''simple docstring'''
				__lowerCamelCase  							=      {
				    '''num_train_timesteps''': 1000,
				    '''beta_start''': 0.0_001,
				    '''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(**__UpperCAmelCase			)
				return config




	def     lowerCamelCase (  self		,			__UpperCAmelCase=0		,			**__UpperCAmelCase			):



				'''simple docstring'''
				__lowerCamelCase  							=      dict(self.forward_default_kwargs			)
				__lowerCamelCase  							=      kwargs.pop('''num_inference_steps'''		,			__UpperCAmelCase			)
				__lowerCamelCase  							=      self.dummy_sample
				__lowerCamelCase  							=      0.1 * sample
				__lowerCamelCase  							=      [residual + 0.2, residual + 0.15, residual + 0.10]

				for scheduler_class in self.scheduler_classes:
							__lowerCamelCase  							=      self.get_scheduler_config(**__UpperCAmelCase			)
							__lowerCamelCase  							=      scheduler_class(**__UpperCAmelCase			)
							scheduler.set_timesteps(__UpperCAmelCase			)
							# copy over dummy past residuals
							__lowerCamelCase  							=      dummy_past_residuals[: scheduler.config.solver_order]

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

							__lowerCamelCase							,__lowerCamelCase  							=      sample, sample
							for t in range(__UpperCAmelCase		,			time_step + scheduler.config.solver_order + 1			):
										__lowerCamelCase  							=      scheduler.step(__UpperCAmelCase		,			__UpperCAmelCase		,			__UpperCAmelCase		,			**__UpperCAmelCase			).prev_sample
										__lowerCamelCase  							=      new_scheduler.step(__UpperCAmelCase		,			__UpperCAmelCase		,			__UpperCAmelCase		,			**__UpperCAmelCase			).prev_sample

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




	def     lowerCamelCase (  self			):



				'''simple docstring'''
				pass




	def     lowerCamelCase (  self		,			__UpperCAmelCase=0		,			**__UpperCAmelCase			):



				'''simple docstring'''
				__lowerCamelCase  							=      dict(self.forward_default_kwargs			)
				__lowerCamelCase  							=      kwargs.pop('''num_inference_steps'''		,			__UpperCAmelCase			)
				__lowerCamelCase  							=      self.dummy_sample
				__lowerCamelCase  							=      0.1 * sample
				__lowerCamelCase  							=      [residual + 0.2, residual + 0.15, residual + 0.10]

				for scheduler_class in self.scheduler_classes:
							__lowerCamelCase  							=      self.get_scheduler_config()
							__lowerCamelCase  							=      scheduler_class(**__UpperCAmelCase			)
							scheduler.set_timesteps(__UpperCAmelCase			)

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

							with tempfile.TemporaryDirectory() as tmpdirname:
										scheduler.save_config(__UpperCAmelCase			)
										__lowerCamelCase  							=      scheduler_class.from_pretrained(__UpperCAmelCase			)
										# copy over dummy past residuals
										new_scheduler.set_timesteps(__UpperCAmelCase			)

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

							__lowerCamelCase  							=      scheduler.step(__UpperCAmelCase		,			__UpperCAmelCase		,			__UpperCAmelCase		,			**__UpperCAmelCase			).prev_sample
							__lowerCamelCase  							=      new_scheduler.step(__UpperCAmelCase		,			__UpperCAmelCase		,			__UpperCAmelCase		,			**__UpperCAmelCase			).prev_sample

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




	def     lowerCamelCase (  self		,			__UpperCAmelCase=None		,			**__UpperCAmelCase			):



				'''simple docstring'''
				if scheduler is None:
							__lowerCamelCase  							=      self.scheduler_classes[0]
							__lowerCamelCase  							=      self.get_scheduler_config(**__UpperCAmelCase			)
							__lowerCamelCase  							=      scheduler_class(**__UpperCAmelCase			)

				__lowerCamelCase  							=      10
				__lowerCamelCase  							=      self.dummy_model()
				__lowerCamelCase  							=      self.dummy_sample_deter
				scheduler.set_timesteps(__UpperCAmelCase			)

				for i, t in enumerate(scheduler.timesteps			):
							__lowerCamelCase  							=      model(__UpperCAmelCase		,			__UpperCAmelCase			)
							__lowerCamelCase  							=      scheduler.step(__UpperCAmelCase		,			__UpperCAmelCase		,			__UpperCAmelCase			).prev_sample

				return sample




	def     lowerCamelCase (  self			):



				'''simple docstring'''
				__lowerCamelCase  							=      dict(self.forward_default_kwargs			)

				__lowerCamelCase  							=      kwargs.pop('''num_inference_steps'''		,			__UpperCAmelCase			)

				for scheduler_class in self.scheduler_classes:
							__lowerCamelCase  							=      self.get_scheduler_config()
							__lowerCamelCase  							=      scheduler_class(**__UpperCAmelCase			)

							__lowerCamelCase  							=      self.dummy_sample
							__lowerCamelCase  							=      0.1 * sample

							if num_inference_steps is not None and hasattr(__UpperCAmelCase		,			'''set_timesteps'''			):
										scheduler.set_timesteps(__UpperCAmelCase			)
							elif num_inference_steps is not None and not hasattr(__UpperCAmelCase		,			'''set_timesteps'''			):
										__lowerCamelCase  							=      num_inference_steps

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

							__lowerCamelCase  							=      scheduler.timesteps[5]
							__lowerCamelCase  							=      scheduler.timesteps[6]

							__lowerCamelCase  							=      scheduler.step(__UpperCAmelCase		,			__UpperCAmelCase		,			__UpperCAmelCase		,			**__UpperCAmelCase			).prev_sample
							__lowerCamelCase  							=      scheduler.step(__UpperCAmelCase		,			__UpperCAmelCase		,			__UpperCAmelCase		,			**__UpperCAmelCase			).prev_sample

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




	def     lowerCamelCase (  self			):



				'''simple docstring'''
				for timesteps in [25, 50, 100, 999, 1000]:
							self.check_over_configs(num_train_timesteps=__UpperCAmelCase			)




	def     lowerCamelCase (  self			):



				'''simple docstring'''
				self.check_over_configs(thresholding=__UpperCAmelCase			)
				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=__UpperCAmelCase		,			prediction_type=__UpperCAmelCase		,			sample_max_value=__UpperCAmelCase		,			algorithm_type='''dpmsolver++'''		,			solver_order=__UpperCAmelCase		,			solver_type=__UpperCAmelCase		,			)




	def     lowerCamelCase (  self			):



				'''simple docstring'''
				for prediction_type in ["epsilon", "v_prediction"]:
							self.check_over_configs(prediction_type=__UpperCAmelCase			)




	def     lowerCamelCase (  self			):



				'''simple docstring'''
				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=__UpperCAmelCase		,			solver_type=__UpperCAmelCase		,			prediction_type=__UpperCAmelCase		,			algorithm_type=__UpperCAmelCase		,			)
																__lowerCamelCase  							=      self.full_loop(
																    solver_order=__UpperCAmelCase		,			solver_type=__UpperCAmelCase		,			prediction_type=__UpperCAmelCase		,			algorithm_type=__UpperCAmelCase		,			)
																assert not torch.isnan(__UpperCAmelCase			).any(), "Samples have nan numbers"




	def     lowerCamelCase (  self			):



				'''simple docstring'''
				self.check_over_configs(lower_order_final=__UpperCAmelCase			)
				self.check_over_configs(lower_order_final=__UpperCAmelCase			)




	def     lowerCamelCase (  self			):



				'''simple docstring'''
				self.check_over_configs(lambda_min_clipped=-float('''inf'''			)			)
				self.check_over_configs(lambda_min_clipped=-5.1			)




	def     lowerCamelCase (  self			):



				'''simple docstring'''
				self.check_over_configs(variance_type=__UpperCAmelCase			)
				self.check_over_configs(variance_type='''learned_range'''			)




	def     lowerCamelCase (  self			):



				'''simple docstring'''
				for num_inference_steps in [1, 2, 3, 5, 10, 50, 100, 999, 1000]:
							self.check_over_forward(num_inference_steps=__UpperCAmelCase		,			time_step=0			)




	def     lowerCamelCase (  self			):



				'''simple docstring'''
				__lowerCamelCase  							=      self.full_loop()
				__lowerCamelCase  							=      torch.mean(torch.abs(__UpperCAmelCase			)			)

				assert abs(result_mean.item() - 0.3_301			) < 1E-3




	def     lowerCamelCase (  self			):



				'''simple docstring'''
				__lowerCamelCase  							=      self.full_loop(thresholding=__UpperCAmelCase		,			dynamic_thresholding_ratio=0.87		,			sample_max_value=0.5			)
				__lowerCamelCase  							=      torch.mean(torch.abs(__UpperCAmelCase			)			)

				assert abs(result_mean.item() - 1.1_364			) < 1E-3




	def     lowerCamelCase (  self			):



				'''simple docstring'''
				__lowerCamelCase  							=      self.full_loop(prediction_type='''v_prediction'''			)
				__lowerCamelCase  							=      torch.mean(torch.abs(__UpperCAmelCase			)			)

				assert abs(result_mean.item() - 0.2_251			) < 1E-3




	def     lowerCamelCase (  self			):



				'''simple docstring'''
				__lowerCamelCase  							=      self.full_loop(prediction_type='''v_prediction'''		,			use_karras_sigmas=__UpperCAmelCase			)
				__lowerCamelCase  							=      torch.mean(torch.abs(__UpperCAmelCase			)			)

				assert abs(result_mean.item() - 0.2_096			) < 1E-3




	def     lowerCamelCase (  self			):



				'''simple docstring'''
				__lowerCamelCase  							=      DPMSolverMultistepScheduler(**self.get_scheduler_config()			)
				__lowerCamelCase  							=      self.full_loop(scheduler=__UpperCAmelCase			)
				__lowerCamelCase  							=      torch.mean(torch.abs(__UpperCAmelCase			)			)

				assert abs(result_mean.item() - 0.3_301			) < 1E-3

				__lowerCamelCase  							=      DPMSolverSinglestepScheduler.from_config(scheduler.config			)
				__lowerCamelCase  							=      UniPCMultistepScheduler.from_config(scheduler.config			)
				__lowerCamelCase  							=      DEISMultistepScheduler.from_config(scheduler.config			)
				__lowerCamelCase  							=      DPMSolverMultistepScheduler.from_config(scheduler.config			)

				__lowerCamelCase  							=      self.full_loop(scheduler=__UpperCAmelCase			)
				__lowerCamelCase  							=      torch.mean(torch.abs(__UpperCAmelCase			)			)

				assert abs(result_mean.item() - 0.3_301			) < 1E-3




	def     lowerCamelCase (  self			):



				'''simple docstring'''
				__lowerCamelCase  							=      self.scheduler_classes[0]
				__lowerCamelCase  							=      self.get_scheduler_config(thresholding=__UpperCAmelCase		,			dynamic_thresholding_ratio=0			)
				__lowerCamelCase  							=      scheduler_class(**__UpperCAmelCase			)

				__lowerCamelCase  							=      10
				__lowerCamelCase  							=      self.dummy_model()
				__lowerCamelCase  							=      self.dummy_sample_deter.half()
				scheduler.set_timesteps(__UpperCAmelCase			)

				for i, t in enumerate(scheduler.timesteps			):
							__lowerCamelCase  							=      model(__UpperCAmelCase		,			__UpperCAmelCase			)
							__lowerCamelCase  							=      scheduler.step(__UpperCAmelCase		,			__UpperCAmelCase		,			__UpperCAmelCase			).prev_sample

				assert sample.dtype == torch.floataa




	def     lowerCamelCase (  self		,			**__UpperCAmelCase			):



				'''simple docstring'''
				for scheduler_class in self.scheduler_classes:
							__lowerCamelCase  							=      self.get_scheduler_config(**__UpperCAmelCase			)
							__lowerCamelCase  							=      scheduler_class(**__UpperCAmelCase			)

							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,
)


a_								=   {
    """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:
  a_								=   [
      """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:
  a_								=   [
      """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:
  a_								=   [
      """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

  a_								=   _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)






