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

import torch
import torch.nn as nn

from ..configuration_utils import ConfigMixin, register_to_config
from ..utils import BaseOutput
from .embeddings import GaussianFourierProjection, TimestepEmbedding, Timesteps
from .modeling_utils import ModelMixin
from .unet_ad_blocks import UNetMidBlockaD, get_down_block, get_up_block



@dataclass
class 			UpperCamelCase					(			_UpperCAmelCase			):

     '''simple docstring'''

     A_					    =	42





class 			UpperCamelCase					(			_UpperCAmelCase ,	_UpperCAmelCase			):

     '''simple docstring'''

     @register_to_config
     def __init__(       self					,					A_ = None					,					A_ = 3					,					A_ = 3					,					A_ = False					,					A_ = "positional"					,					A_ = 0					,					A_ = True					,					A_ = ("DownBlock2D", "AttnDownBlock2D", "AttnDownBlock2D", "AttnDownBlock2D")					,					A_ = ("AttnUpBlock2D", "AttnUpBlock2D", "AttnUpBlock2D", "UpBlock2D")					,					A_ = (2_24, 4_48, 6_72, 8_96)					,					A_ = 2					,					A_ = 1					,					A_ = 1					,					A_ = "conv"					,					A_ = "conv"					,					A_ = "silu"					,					A_ = 8					,					A_ = 32					,					A_ = 1E-5					,					A_ = "default"					,					A_ = True					,					A_ = None					,					A_ = None					,					)			->					List[Any]:






           """simple docstring"""
           super().__init__()

           _lowerCamelCase           =					sample_size
           _lowerCamelCase           =					block_out_channels[0] * 4

           # Check inputs
           if len(__UpperCAmelCase    ) != len(__UpperCAmelCase    ):
                 raise ValueError(
                     F'Must provide the same number of `down_block_types` as `up_block_types`. `down_block_types`: {down_block_types}. `up_block_types`: {up_block_types}.'    )

           if len(__UpperCAmelCase    ) != len(__UpperCAmelCase    ):
                 raise ValueError(
                     F'Must provide the same number of `block_out_channels` as `down_block_types`. `block_out_channels`: {block_out_channels}. `down_block_types`: {down_block_types}.'    )

           # input
           _lowerCamelCase           =					nn.Convad(__UpperCAmelCase					,					block_out_channels[0]					,					kernel_size=3					,					padding=(1, 1)    )

           # time
           if time_embedding_type == "fourier":
                 _lowerCamelCase           =					GaussianFourierProjection(embedding_size=block_out_channels[0]					,					scale=16    )
                 _lowerCamelCase           =					2 * block_out_channels[0]
           elif time_embedding_type == "positional":
                 _lowerCamelCase           =					Timesteps(block_out_channels[0]					,					__UpperCAmelCase					,					__UpperCAmelCase    )
                 _lowerCamelCase           =					block_out_channels[0]

           _lowerCamelCase           =					TimestepEmbedding(__UpperCAmelCase					,					__UpperCAmelCase    )

           # class embedding
           if class_embed_type is None and num_class_embeds is not None:
                 _lowerCamelCase           =					nn.Embedding(__UpperCAmelCase					,					__UpperCAmelCase    )
           elif class_embed_type == "timestep":
                 _lowerCamelCase           =					TimestepEmbedding(__UpperCAmelCase					,					__UpperCAmelCase    )
           elif class_embed_type == "identity":
                 _lowerCamelCase           =					nn.Identity(__UpperCAmelCase					,					__UpperCAmelCase    )
           else:
                 _lowerCamelCase           =					None

           _lowerCamelCase           =					nn.ModuleList([]    )
           _lowerCamelCase           =					None
           _lowerCamelCase           =					nn.ModuleList([]    )

           # down
           _lowerCamelCase           =					block_out_channels[0]
           for i, down_block_type in enumerate(__UpperCAmelCase    ):
                 _lowerCamelCase           =					output_channel
                 _lowerCamelCase           =					block_out_channels[i]
                 _lowerCamelCase           =					i == len(__UpperCAmelCase    ) - 1

                 _lowerCamelCase           =					get_down_block(
                     __UpperCAmelCase					,					num_layers=__UpperCAmelCase					,					in_channels=__UpperCAmelCase					,					out_channels=__UpperCAmelCase					,					temb_channels=__UpperCAmelCase					,					add_downsample=not is_final_block					,					resnet_eps=__UpperCAmelCase					,					resnet_act_fn=__UpperCAmelCase					,					resnet_groups=__UpperCAmelCase					,					attention_head_dim=attention_head_dim if attention_head_dim is not None else output_channel					,					downsample_padding=__UpperCAmelCase					,					resnet_time_scale_shift=__UpperCAmelCase					,					downsample_type=__UpperCAmelCase					,					)
                 self.down_blocks.append(__UpperCAmelCase    )

           # mid
           _lowerCamelCase           =					UNetMidBlockaD(
               in_channels=block_out_channels[-1]					,					temb_channels=__UpperCAmelCase					,					resnet_eps=__UpperCAmelCase					,					resnet_act_fn=__UpperCAmelCase					,					output_scale_factor=__UpperCAmelCase					,					resnet_time_scale_shift=__UpperCAmelCase					,					attention_head_dim=attention_head_dim if attention_head_dim is not None else block_out_channels[-1]					,					resnet_groups=__UpperCAmelCase					,					add_attention=__UpperCAmelCase					,					)

           # up
           _lowerCamelCase           =					list(reversed(__UpperCAmelCase    )    )
           _lowerCamelCase           =					reversed_block_out_channels[0]
           for i, up_block_type in enumerate(__UpperCAmelCase    ):
                 _lowerCamelCase           =					output_channel
                 _lowerCamelCase           =					reversed_block_out_channels[i]
                 _lowerCamelCase           =					reversed_block_out_channels[min(i + 1					,					len(__UpperCAmelCase    ) - 1    )]

                 _lowerCamelCase           =					i == len(__UpperCAmelCase    ) - 1

                 _lowerCamelCase           =					get_up_block(
                     __UpperCAmelCase					,					num_layers=layers_per_block + 1					,					in_channels=__UpperCAmelCase					,					out_channels=__UpperCAmelCase					,					prev_output_channel=__UpperCAmelCase					,					temb_channels=__UpperCAmelCase					,					add_upsample=not is_final_block					,					resnet_eps=__UpperCAmelCase					,					resnet_act_fn=__UpperCAmelCase					,					resnet_groups=__UpperCAmelCase					,					attention_head_dim=attention_head_dim if attention_head_dim is not None else output_channel					,					resnet_time_scale_shift=__UpperCAmelCase					,					upsample_type=__UpperCAmelCase					,					)
                 self.up_blocks.append(__UpperCAmelCase    )
                 _lowerCamelCase           =					output_channel

           # out
           _lowerCamelCase           =					norm_num_groups if norm_num_groups is not None else min(block_out_channels[0] // 4					,					32    )
           _lowerCamelCase           =					nn.GroupNorm(num_channels=block_out_channels[0]					,					num_groups=__UpperCAmelCase					,					eps=__UpperCAmelCase    )
           _lowerCamelCase           =					nn.SiLU()
           _lowerCamelCase           =					nn.Convad(block_out_channels[0]					,					__UpperCAmelCase					,					kernel_size=3					,					padding=1    )





     def 		UpperCamelCase_    (       self					,					A_					,					A_					,					A_ = None					,					A_ = True					,					)			->					Union[UNetaDOutput, Tuple]:






           """simple docstring"""
           # 0. center input if necessary
           if self.config.center_input_sample:
                 _lowerCamelCase           =					2 * sample - 1.0

           # 1. time
           _lowerCamelCase           =					timestep
           if not torch.is_tensor(__UpperCAmelCase    ):
                 _lowerCamelCase           =					torch.tensor([timesteps]					,					dtype=torch.long					,					device=sample.device    )
           elif torch.is_tensor(__UpperCAmelCase    ) and len(timesteps.shape    ) == 0:
                 _lowerCamelCase           =					timesteps[None].to(sample.device    )

           # broadcast to batch dimension in a way that's compatible with ONNX/Core ML
           _lowerCamelCase           =					timesteps * torch.ones(sample.shape[0]					,					dtype=timesteps.dtype					,					device=timesteps.device    )

           _lowerCamelCase           =					self.time_proj(__UpperCAmelCase    )

           # timesteps does not contain any weights and will always return f32 tensors
           # but time_embedding might actually be running in fp16. so we need to cast here.
           # there might be better ways to encapsulate this.
           _lowerCamelCase           =					t_emb.to(dtype=self.dtype    )
           _lowerCamelCase           =					self.time_embedding(__UpperCAmelCase    )

           if self.class_embedding is not None:
                 if class_labels is None:
                       raise ValueError('''class_labels should be provided when doing class conditioning'''    )

                 if self.config.class_embed_type == "timestep":
                       _lowerCamelCase           =					self.time_proj(__UpperCAmelCase    )

                 _lowerCamelCase           =					self.class_embedding(__UpperCAmelCase    ).to(dtype=self.dtype    )
                 _lowerCamelCase           =					emb + class_emb

           # 2. pre-process
           _lowerCamelCase           =					sample
           _lowerCamelCase           =					self.conv_in(__UpperCAmelCase    )

           # 3. down
           _lowerCamelCase           =					(sample,)
           for downsample_block in self.down_blocks:
                 if hasattr(__UpperCAmelCase					,					'''skip_conv'''    ):
                       _lowerCamelCase           =					downsample_block(
                           hidden_states=__UpperCAmelCase					,					temb=__UpperCAmelCase					,					skip_sample=__UpperCAmelCase    )
                 else:
                       _lowerCamelCase           =					downsample_block(hidden_states=__UpperCAmelCase					,					temb=__UpperCAmelCase    )

                 down_block_res_samples += res_samples

           # 4. mid
           _lowerCamelCase           =					self.mid_block(__UpperCAmelCase					,					__UpperCAmelCase    )

           # 5. up
           _lowerCamelCase           =					None
           for upsample_block in self.up_blocks:
                 _lowerCamelCase           =					down_block_res_samples[-len(upsample_block.resnets    ) :]
                 _lowerCamelCase           =					down_block_res_samples[: -len(upsample_block.resnets    )]

                 if hasattr(__UpperCAmelCase					,					'''skip_conv'''    ):
                       _lowerCamelCase           =					upsample_block(__UpperCAmelCase					,					__UpperCAmelCase					,					__UpperCAmelCase					,					__UpperCAmelCase    )
                 else:
                       _lowerCamelCase           =					upsample_block(__UpperCAmelCase					,					__UpperCAmelCase					,					__UpperCAmelCase    )

                 # 6. post-process
           _lowerCamelCase           =					self.conv_norm_out(__UpperCAmelCase    )
           _lowerCamelCase           =					self.conv_act(__UpperCAmelCase    )
           _lowerCamelCase           =					self.conv_out(__UpperCAmelCase    )

           if skip_sample is not None:
                 sample += skip_sample

           if self.config.time_embedding_type == "fourier":
                 _lowerCamelCase           =					timesteps.reshape((sample.shape[0], *([1] * len(sample.shape[1:]    )))    )
                 _lowerCamelCase           =					sample / timesteps

           if not return_dict:
                 return (sample,)

           return UNetaDOutput(sample=__UpperCAmelCase    )



"""simple docstring"""






from typing import TYPE_CHECKING

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


SCREAMING_SNAKE_CASE__				:  int						= {
    "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:
 SCREAMING_SNAKE_CASE__				:  Optional[int]						= [
     "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:
 SCREAMING_SNAKE_CASE__				:  int						= [
     "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:
 SCREAMING_SNAKE_CASE__				:  Optional[int]						= [
     "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

 SCREAMING_SNAKE_CASE__				:  Optional[int]						= _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)





