from dataclasses import dataclass
from typing import List, Optional, Tuple, Union

import numpy as np
import torch

from ..configuration_utils import ConfigMixin, register_to_config
from ..utils import BaseOutput, logging, randn_tensor
from .scheduling_utils import SchedulerMixin


_lowerCAmelCase        =       logging.get_logger(__name__)  # pylint: disable=invalid-name






@dataclass
class     __UpperCAmelCase(    A__				):






 """simple docstring"""




 __magic_name__          =   42






class     __UpperCAmelCase(    A__      ,	A__				):






 """simple docstring"""




 __magic_name__          =   1
 @register_to_config
 def __init__(    self ,       __magic_name__ = 40 ,       __magic_name__ = 0.0_02 ,       __magic_name__ = 80.0 ,       __magic_name__ = 0.5 ,       __magic_name__ = 1.0 ,       __magic_name__ = 7.0 ,       __magic_name__ = True ,       ):

        """simple docstring"""

        A_							:       Union[str, Any]	      =				sigma_max

        A_							:       List[Any]	      =				np.linspace(0 ,       1 ,       __magic_name__      )
        A_							:       str	      =				self._convert_to_karras(__magic_name__      )
        A_							:       Dict	      =				self.sigma_to_t(__magic_name__      )

        # setable values
        A_							:       Dict	      =				None
        A_							:       List[Any]	      =				torch.from_numpy(__magic_name__      )
        A_							:       Dict	      =				torch.from_numpy(__magic_name__      )
        A_							:       Tuple	      =				False
        A_							:       int	      =				False
 def  UpperCAmelCase   (    self ,       __magic_name__ ,       __magic_name__=None      ):

        """simple docstring"""

        if schedule_timesteps is None:
               A_							:       List[str]	      =				self.timesteps

        A_							:       Tuple	      =				(schedule_timesteps == timestep).nonzero()
        return indices.item()
 def  UpperCAmelCase   (    self ,       __magic_name__ ,       __magic_name__      ):

        """simple docstring"""

        if isinstance(__magic_name__ ,       torch.Tensor      ):
               A_							:       List[Any]	      =				timestep.to(self.timesteps.device      )
        A_							:       List[Any]	      =				self.index_for_timestep(__magic_name__      )
        A_							:       List[Any]	      =				self.sigmas[step_idx]

        A_							:       List[str]	      =				sample / ((sigma**2 + self.config.sigma_data**2) ** 0.5)

        A_							:       int	      =				True
        return sample
 def  UpperCAmelCase   (    self ,       __magic_name__      ):

        """simple docstring"""

        if not isinstance(__magic_name__ ,       np.ndarray      ):
               A_							:       int	      =				np.array(__magic_name__ ,       dtype=np.floataa      )

        A_							:       Optional[Any]	      =				1000 * 0.25 * np.log(sigmas + 1e-44      )

        return timesteps
 def  UpperCAmelCase   (    self ,       __magic_name__ = None ,       __magic_name__ = None ,       __magic_name__ = None ,       ):

        """simple docstring"""

        if num_inference_steps is None and timesteps is None:
               raise ValueError('''Exactly one of `num_inference_steps` or `timesteps` must be supplied.'''      )

        if num_inference_steps is not None and timesteps is not None:
               raise ValueError('''Can only pass one of `num_inference_steps` or `timesteps`.'''      )

        # Follow DDPMScheduler custom timesteps logic
        if timesteps is not None:
               for i in range(1 ,       len(__magic_name__      )      ):
                      if timesteps[i] >= timesteps[i - 1]:
                             raise ValueError('''`timesteps` must be in descending order.'''      )

               if timesteps[0] >= self.config.num_train_timesteps:
                      raise ValueError(
                          f"""`timesteps` must start before `self.config.train_timesteps`:"""
                          f""" {self.config.num_train_timesteps}."""      )

               A_							:       Dict	      =				np.array(__magic_name__ ,       dtype=np.intaa      )
               A_							:       int	      =				True
        else:
               if num_inference_steps > self.config.num_train_timesteps:
                      raise ValueError(
                          f"""`num_inference_steps`: {num_inference_steps} cannot be larger than `self.config.train_timesteps`:"""
                          f""" {self.config.num_train_timesteps} as the unet model trained with this scheduler can only handle"""
                          f""" maximal {self.config.num_train_timesteps} timesteps."""      )

               A_							:       int	      =				num_inference_steps

               A_							:       Tuple	      =				self.config.num_train_timesteps // self.num_inference_steps
               A_							:       Optional[Any]	      =				(np.arange(0 ,       __magic_name__      ) * step_ratio).round()[::-1].copy().astype(np.intaa      )
               A_							:       Dict	      =				False

        # Map timesteps to Karras sigmas directly for multistep sampling
        # See https://github.com/openai/consistency_models/blob/main/cm/karras_diffusion.py#L675
        A_							:       Optional[int]	      =				self.config.num_train_timesteps
        A_							:       Optional[int]	      =				timesteps[::-1].copy()
        A_							:       str	      =				ramp / (num_train_timesteps - 1)
        A_							:       Dict	      =				self._convert_to_karras(__magic_name__      )
        A_							:       int	      =				self.sigma_to_t(__magic_name__      )

        A_							:       List[Any]	      =				np.concatenate([sigmas, [self.sigma_min]]      ).astype(np.floataa      )
        A_							:       Union[str, Any]	      =				torch.from_numpy(__magic_name__      ).to(device=__magic_name__      )

        if str(__magic_name__      ).startswith('''mps'''      ):
               # mps does not support float64
               A_							:       Optional[int]	      =				torch.from_numpy(__magic_name__      ).to(__magic_name__ ,       dtype=torch.floataa      )
        else:
               A_							:       Any	      =				torch.from_numpy(__magic_name__      ).to(device=__magic_name__      )
 def  UpperCAmelCase   (    self ,       __magic_name__      ):

        """simple docstring"""

        A_							:       float	      =				self.config.sigma_min
        A_							:       float	      =				self.config.sigma_max

        A_							:       Any	      =				self.config.rho
        A_							:       Optional[Any]	      =				sigma_min ** (1 / rho)
        A_							:       List[Any]	      =				sigma_max ** (1 / rho)
        A_							:       Optional[int]	      =				(max_inv_rho + ramp * (min_inv_rho - max_inv_rho)) ** rho
        return sigmas
 def  UpperCAmelCase   (    self ,       __magic_name__      ):

        """simple docstring"""

        A_							:       List[str]	      =				self.config.sigma_data

        A_							:       int	      =				sigma_data**2 / (sigma**2 + sigma_data**2)
        A_							:       Optional[int]	      =				sigma * sigma_data / (sigma**2 + sigma_data**2) ** 0.5
        return c_skip, c_out
 def  UpperCAmelCase   (    self ,       __magic_name__      ):

        """simple docstring"""

        A_							:       List[str]	      =				self.config.sigma_min
        A_							:       str	      =				self.config.sigma_data

        A_							:       List[Any]	      =				sigma_data**2 / ((sigma - sigma_min) ** 2 + sigma_data**2)
        A_							:       Tuple	      =				(sigma - sigma_min) * sigma_data / (sigma**2 + sigma_data**2) ** 0.5
        return c_skip, c_out
 def  UpperCAmelCase   (    self ,       __magic_name__ ,       __magic_name__ ,       __magic_name__ ,       __magic_name__ = None ,       __magic_name__ = True ,       ):

        """simple docstring"""

        if (
            isinstance(__magic_name__ ,       __magic_name__      )
            or isinstance(__magic_name__ ,       torch.IntTensor      )
            or isinstance(__magic_name__ ,       torch.LongTensor      )
        ):
               raise ValueError(
                   (
                       '''Passing integer indices (e.g. from `enumerate(timesteps)`) as timesteps to'''
                       f""" `{self.__class__}.step()` is not supported. Make sure to pass"""
                       ''' one of the `scheduler.timesteps` as a timestep.'''
                   ) ,       )

        if not self.is_scale_input_called:
               logger.warning(
                   '''The `scale_model_input` function should be called before `step` to ensure correct denoising. '''
                   '''See `StableDiffusionPipeline` for a usage example.'''      )

        if isinstance(__magic_name__ ,       torch.Tensor      ):
               A_							:       Optional[Any]	      =				timestep.to(self.timesteps.device      )

        A_							:       str	      =				self.config.sigma_min
        A_							:       str	      =				self.config.sigma_max

        A_							:       str	      =				self.index_for_timestep(__magic_name__      )

        # sigma_next corresponds to next_t in original implementation
        A_							:       List[Any]	      =				self.sigmas[step_index]
        if step_index + 1 < self.config.num_train_timesteps:
               A_							:       Dict	      =				self.sigmas[step_index + 1]
        else:
               # Set sigma_next to sigma_min
               A_							:       int	      =				self.sigmas[-1]

        # Get scalings for boundary conditions
        A_      ,							A_							:       Any	      =				self.get_scalings_for_boundary_condition(__magic_name__      )

        # 1. Denoise model output using boundary conditions
        A_							:       Tuple	      =				c_out * model_output + c_skip * sample
        if self.config.clip_denoised:
               A_							:       Union[str, Any]	      =				denoised.clamp(-1 ,       1      )

        # 2. Sample z ~ N(0, s_noise^2 * I)
        # Noise is not used for onestep sampling.
        if len(self.timesteps      ) > 1:
               A_							:       Optional[Any]	      =				randn_tensor(
                   model_output.shape ,       dtype=model_output.dtype ,       device=model_output.device ,       generator=__magic_name__      )
        else:
               A_							:       Optional[int]	      =				torch.zeros_like(__magic_name__      )
        A_							:       List[str]	      =				noise * self.config.s_noise

        A_							:       Optional[int]	      =				sigma_next.clamp(min=__magic_name__ ,       max=__magic_name__      )

        # 3. Return noisy sample
        # tau = sigma_hat, eps = sigma_min
        A_							:       List[Any]	      =				denoised + z * (sigma_hat**2 - sigma_min**2) ** 0.5

        if not return_dict:
               return (prev_sample,)

        return CMStochasticIterativeSchedulerOutput(prev_sample=__magic_name__      )
 def  UpperCAmelCase   (    self ,       __magic_name__ ,       __magic_name__ ,       __magic_name__ ,       ):

        """simple docstring"""

        A_							:       Any	      =				self.sigmas.to(device=original_samples.device ,       dtype=original_samples.dtype      )
        if original_samples.device.type == "mps" and torch.is_floating_point(__magic_name__      ):
               # mps does not support float64
               A_							:       List[Any]	      =				self.timesteps.to(original_samples.device ,       dtype=torch.floataa      )
               A_							:       int	      =				timesteps.to(original_samples.device ,       dtype=torch.floataa      )
        else:
               A_							:       List[str]	      =				self.timesteps.to(original_samples.device      )
               A_							:       List[str]	      =				timesteps.to(original_samples.device      )

        A_							:       Optional[Any]	      =				[(schedule_timesteps == t).nonzero().item() for t in timesteps]

        A_							:       str	      =				sigmas[step_indices].flatten()
        while len(sigma.shape      ) < len(original_samples.shape      ):
               A_							:       Dict	      =				sigma.unsqueeze(-1      )

        A_							:       str	      =				original_samples + noise * sigma
        return noisy_samples
 def __len__(    self      ):

        """simple docstring"""

        return self.config.num_train_timesteps



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


