


"""simple docstring"""
import math
from typing import Any, Callable, List, Optional, Tuple, Union

import numpy as np
import torch

from ...models import TaFilmDecoder
from ...schedulers import DDPMScheduler
from ...utils import is_onnx_available, logging, randn_tensor


if is_onnx_available():
 from ..onnx_utils import OnnxRuntimeModel

from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline
from .continous_encoder import SpectrogramContEncoder
from .notes_encoder import SpectrogramNotesEncoder


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

UpperCAmelCase				=						256




class 	lowercase__				(					A_				):
   __UpperCAmelCase							       =					['''melgan''']





   def __init__(							self      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   )  ->  None:
      super().__init__()

      # From MELGAN
      _lowerCamelCase	:					Dict   =		math.log(1e-5)  # Matches MelGAN training.
      _lowerCamelCase	:					List[Any]   =		4.0  # Largest value for most examples
      _lowerCamelCase	:					Dict   =		128

      self.register_modules(
          notes_encoder=SCREAMING_SNAKE_CASE      ,   continuous_encoder=SCREAMING_SNAKE_CASE      ,   decoder=SCREAMING_SNAKE_CASE      ,   scheduler=SCREAMING_SNAKE_CASE      ,   melgan=SCREAMING_SNAKE_CASE      ,   )





   def 		UpperCamelCase_  (							self      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE=(-1.0, 1.0)      ,   SCREAMING_SNAKE_CASE=False)  ->  Any:
      _lowerCamelCase   ,    _lowerCamelCase	:					Union[str, Any]   =		output_range
      if clip:
         _lowerCamelCase	:					Optional[int]   =		torch.clip(SCREAMING_SNAKE_CASE      ,   self.min_value      ,   self.max_value)
      # Scale to [0, 1].
      _lowerCamelCase	:					Optional[int]   =		(features - self.min_value) / (self.max_value - self.min_value)
      # Scale to [min_out, max_out].
      return zero_one * (max_out - min_out) + min_out





   def 		UpperCamelCase_  (							self      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE=(-1.0, 1.0)      ,   SCREAMING_SNAKE_CASE=False)  ->  List[str]:
      _lowerCamelCase   ,    _lowerCamelCase	:					str   =		input_range
      _lowerCamelCase	:					List[Any]   =		torch.clip(SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE) if clip else outputs
      # Scale to [0, 1].
      _lowerCamelCase	:					str   =		(outputs - min_out) / (max_out - min_out)
      # Scale to [self.min_value, self.max_value].
      return zero_one * (self.max_value - self.min_value) + self.min_value





   def 		UpperCamelCase_  (							self      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE)  ->  Union[str, Any]:
      _lowerCamelCase	:					Tuple   =		input_tokens > 0
      _lowerCamelCase   ,    _lowerCamelCase	:					str   =		self.notes_encoder(
          encoder_input_tokens=SCREAMING_SNAKE_CASE      ,   encoder_inputs_mask=SCREAMING_SNAKE_CASE)

      _lowerCamelCase   ,    _lowerCamelCase	:					Tuple   =		self.continuous_encoder(
          encoder_inputs=SCREAMING_SNAKE_CASE      ,   encoder_inputs_mask=SCREAMING_SNAKE_CASE)

      return [(tokens_encoded, tokens_mask), (continuous_encoded, continuous_mask)]





   def 		UpperCamelCase_  (							self      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE)  ->  Union[str, Any]:
      _lowerCamelCase	:					Optional[int]   =		noise_time
      if not torch.is_tensor(SCREAMING_SNAKE_CASE):
         _lowerCamelCase	:					int   =		torch.tensor([timesteps]      ,   dtype=torch.long      ,   device=input_tokens.device)
      elif torch.is_tensor(SCREAMING_SNAKE_CASE) and len(timesteps.shape) == 0:
         _lowerCamelCase	:					Tuple   =		timesteps[None].to(input_tokens.device)

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

      _lowerCamelCase	:					List[str]   =		self.decoder(
          encodings_and_masks=SCREAMING_SNAKE_CASE      ,   decoder_input_tokens=SCREAMING_SNAKE_CASE      ,   decoder_noise_time=SCREAMING_SNAKE_CASE)
      return logits





   @torch.no_grad()
   def __call__(							self      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE = None      ,   SCREAMING_SNAKE_CASE = 100      ,   SCREAMING_SNAKE_CASE = True      ,   SCREAMING_SNAKE_CASE = "numpy"      ,   SCREAMING_SNAKE_CASE = None      ,   SCREAMING_SNAKE_CASE = 1      ,   )  ->  Union[AudioPipelineOutput, Tuple]:
      if (callback_steps is None) or (
          callback_steps is not None and (not isinstance(SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE) or callback_steps <= 0)
      ):
         raise ValueError(
             F'`callback_steps` has to be a positive integer but is {callback_steps} of type'
             F' {type(SCREAMING_SNAKE_CASE)}.')

      _lowerCamelCase	:					Optional[Any]   =		np.zeros([1, TARGET_FEATURE_LENGTH, self.n_dims]      ,   dtype=np.floataa)
      _lowerCamelCase	:					Dict   =		np.zeros([1, 0, self.n_dims]      ,   np.floataa)
      _lowerCamelCase	:					List[Any]   =		torch.ones((1, TARGET_FEATURE_LENGTH)      ,   dtype=SCREAMING_SNAKE_CASE      ,   device=self.device)

      for i, encoder_input_tokens in enumerate(SCREAMING_SNAKE_CASE):
         if i == 0:
            _lowerCamelCase	:					Any   =		torch.from_numpy(pred_mel[:1].copy()).to(
                device=self.device      ,   dtype=self.decoder.dtype)
            # The first chunk has no previous context.
            _lowerCamelCase	:					Optional[int]   =		torch.zeros((1, TARGET_FEATURE_LENGTH)      ,   dtype=SCREAMING_SNAKE_CASE      ,   device=self.device)
         else:
            # The full song pipeline does not feed in a context feature, so the mask
            # will be all 0s after the feature converter. Because we know we're
            # feeding in a full context chunk from the previous prediction, set it
            # to all 1s.
            _lowerCamelCase	:					Dict   =		ones

         _lowerCamelCase	:					List[Any]   =		self.scale_features(
             SCREAMING_SNAKE_CASE      ,   output_range=[-1.0, 1.0]      ,   clip=SCREAMING_SNAKE_CASE)

         _lowerCamelCase	:					Dict   =		self.encode(
             input_tokens=torch.IntTensor([encoder_input_tokens]).to(device=self.device)      ,   continuous_inputs=SCREAMING_SNAKE_CASE      ,   continuous_mask=SCREAMING_SNAKE_CASE      ,   )

         # Sample encoder_continuous_inputs shaped gaussian noise to begin loop
         _lowerCamelCase	:					List[str]   =		randn_tensor(
             shape=encoder_continuous_inputs.shape      ,   generator=SCREAMING_SNAKE_CASE      ,   device=self.device      ,   dtype=self.decoder.dtype      ,   )

         # set step values
         self.scheduler.set_timesteps(SCREAMING_SNAKE_CASE)

         # Denoising diffusion loop
         for j, t in enumerate(self.progress_bar(self.scheduler.timesteps)):
            _lowerCamelCase	:					str   =		self.decode(
                encodings_and_masks=SCREAMING_SNAKE_CASE      ,   input_tokens=SCREAMING_SNAKE_CASE      ,   noise_time=t / self.scheduler.config.num_train_timesteps      ,   )

            # Compute previous output: x_t -> x_t-1
            _lowerCamelCase	:					Tuple   =		self.scheduler.step(SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   generator=SCREAMING_SNAKE_CASE).prev_sample

         _lowerCamelCase	:					Any   =		self.scale_to_features(SCREAMING_SNAKE_CASE      ,   input_range=[-1.0, 1.0])
         _lowerCamelCase	:					int   =		mel[:1]
         _lowerCamelCase	:					Optional[int]   =		mel.cpu().float().numpy()

         _lowerCamelCase	:					str   =		np.concatenate([full_pred_mel, pred_mel[:1]]      ,   axis=1)

         # call the callback, if provided
         if callback is not None and i % callback_steps == 0:
            callback(SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE)

         logger.info("""Generated segment"""      ,   SCREAMING_SNAKE_CASE)

      if output_type == "numpy" and not is_onnx_available():
         raise ValueError(
             """Cannot return output in 'np' format if ONNX is not available. Make sure to have ONNX installed or set 'output_type' to 'mel'.""")
      elif output_type == "numpy" and self.melgan is None:
         raise ValueError(
             """Cannot return output in 'np' format if melgan component is not defined. Make sure to define `self.melgan` or set 'output_type' to 'mel'.""")

      if output_type == "numpy":
         _lowerCamelCase	:					Union[str, Any]   =		self.melgan(input_features=full_pred_mel.astype(np.floataa))
      else:
         _lowerCamelCase	:					Optional[Any]   =		full_pred_mel

      if not return_dict:
         return (output,)

      return AudioPipelineOutput(audios=SCREAMING_SNAKE_CASE)





"""simple docstring"""
from collections import OrderedDict

from ...utils import logging
from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update
from .configuration_auto import CONFIG_MAPPING_NAMES


UpperCAmelCase				=						logging.get_logger(__name__)


UpperCAmelCase				=						OrderedDict(
    [
        # Base model mapping
        ("""albert""", """FlaxAlbertModel"""),
        ("""bart""", """FlaxBartModel"""),
        ("""beit""", """FlaxBeitModel"""),
        ("""bert""", """FlaxBertModel"""),
        ("""big_bird""", """FlaxBigBirdModel"""),
        ("""blenderbot""", """FlaxBlenderbotModel"""),
        ("""blenderbot-small""", """FlaxBlenderbotSmallModel"""),
        ("""clip""", """FlaxCLIPModel"""),
        ("""distilbert""", """FlaxDistilBertModel"""),
        ("""electra""", """FlaxElectraModel"""),
        ("""gpt-sw3""", """FlaxGPT2Model"""),
        ("""gpt2""", """FlaxGPT2Model"""),
        ("""gpt_neo""", """FlaxGPTNeoModel"""),
        ("""gptj""", """FlaxGPTJModel"""),
        ("""longt5""", """FlaxLongT5Model"""),
        ("""marian""", """FlaxMarianModel"""),
        ("""mbart""", """FlaxMBartModel"""),
        ("""mt5""", """FlaxMT5Model"""),
        ("""opt""", """FlaxOPTModel"""),
        ("""pegasus""", """FlaxPegasusModel"""),
        ("""regnet""", """FlaxRegNetModel"""),
        ("""resnet""", """FlaxResNetModel"""),
        ("""roberta""", """FlaxRobertaModel"""),
        ("""roberta-prelayernorm""", """FlaxRobertaPreLayerNormModel"""),
        ("""roformer""", """FlaxRoFormerModel"""),
        ("""t5""", """FlaxT5Model"""),
        ("""vision-text-dual-encoder""", """FlaxVisionTextDualEncoderModel"""),
        ("""vit""", """FlaxViTModel"""),
        ("""wav2vec2""", """FlaxWav2Vec2Model"""),
        ("""whisper""", """FlaxWhisperModel"""),
        ("""xglm""", """FlaxXGLMModel"""),
        ("""xlm-roberta""", """FlaxXLMRobertaModel"""),
    ]
)

UpperCAmelCase				=						OrderedDict(
    [
        # Model for pre-training mapping
        ("""albert""", """FlaxAlbertForPreTraining"""),
        ("""bart""", """FlaxBartForConditionalGeneration"""),
        ("""bert""", """FlaxBertForPreTraining"""),
        ("""big_bird""", """FlaxBigBirdForPreTraining"""),
        ("""electra""", """FlaxElectraForPreTraining"""),
        ("""longt5""", """FlaxLongT5ForConditionalGeneration"""),
        ("""mbart""", """FlaxMBartForConditionalGeneration"""),
        ("""mt5""", """FlaxMT5ForConditionalGeneration"""),
        ("""roberta""", """FlaxRobertaForMaskedLM"""),
        ("""roberta-prelayernorm""", """FlaxRobertaPreLayerNormForMaskedLM"""),
        ("""roformer""", """FlaxRoFormerForMaskedLM"""),
        ("""t5""", """FlaxT5ForConditionalGeneration"""),
        ("""wav2vec2""", """FlaxWav2Vec2ForPreTraining"""),
        ("""whisper""", """FlaxWhisperForConditionalGeneration"""),
        ("""xlm-roberta""", """FlaxXLMRobertaForMaskedLM"""),
    ]
)

UpperCAmelCase				=						OrderedDict(
    [
        # Model for Masked LM mapping
        ("""albert""", """FlaxAlbertForMaskedLM"""),
        ("""bart""", """FlaxBartForConditionalGeneration"""),
        ("""bert""", """FlaxBertForMaskedLM"""),
        ("""big_bird""", """FlaxBigBirdForMaskedLM"""),
        ("""distilbert""", """FlaxDistilBertForMaskedLM"""),
        ("""electra""", """FlaxElectraForMaskedLM"""),
        ("""mbart""", """FlaxMBartForConditionalGeneration"""),
        ("""roberta""", """FlaxRobertaForMaskedLM"""),
        ("""roberta-prelayernorm""", """FlaxRobertaPreLayerNormForMaskedLM"""),
        ("""roformer""", """FlaxRoFormerForMaskedLM"""),
        ("""xlm-roberta""", """FlaxXLMRobertaForMaskedLM"""),
    ]
)

UpperCAmelCase				=						OrderedDict(
    [
        # Model for Seq2Seq Causal LM mapping
        ("""bart""", """FlaxBartForConditionalGeneration"""),
        ("""blenderbot""", """FlaxBlenderbotForConditionalGeneration"""),
        ("""blenderbot-small""", """FlaxBlenderbotSmallForConditionalGeneration"""),
        ("""encoder-decoder""", """FlaxEncoderDecoderModel"""),
        ("""longt5""", """FlaxLongT5ForConditionalGeneration"""),
        ("""marian""", """FlaxMarianMTModel"""),
        ("""mbart""", """FlaxMBartForConditionalGeneration"""),
        ("""mt5""", """FlaxMT5ForConditionalGeneration"""),
        ("""pegasus""", """FlaxPegasusForConditionalGeneration"""),
        ("""t5""", """FlaxT5ForConditionalGeneration"""),
    ]
)

UpperCAmelCase				=						OrderedDict(
    [
        # Model for Image-classsification
        ("""beit""", """FlaxBeitForImageClassification"""),
        ("""regnet""", """FlaxRegNetForImageClassification"""),
        ("""resnet""", """FlaxResNetForImageClassification"""),
        ("""vit""", """FlaxViTForImageClassification"""),
    ]
)

UpperCAmelCase				=						OrderedDict(
    [
        ("""vision-encoder-decoder""", """FlaxVisionEncoderDecoderModel"""),
    ]
)

UpperCAmelCase				=						OrderedDict(
    [
        # Model for Causal LM mapping
        ("""bart""", """FlaxBartForCausalLM"""),
        ("""bert""", """FlaxBertForCausalLM"""),
        ("""big_bird""", """FlaxBigBirdForCausalLM"""),
        ("""electra""", """FlaxElectraForCausalLM"""),
        ("""gpt-sw3""", """FlaxGPT2LMHeadModel"""),
        ("""gpt2""", """FlaxGPT2LMHeadModel"""),
        ("""gpt_neo""", """FlaxGPTNeoForCausalLM"""),
        ("""gptj""", """FlaxGPTJForCausalLM"""),
        ("""opt""", """FlaxOPTForCausalLM"""),
        ("""roberta""", """FlaxRobertaForCausalLM"""),
        ("""roberta-prelayernorm""", """FlaxRobertaPreLayerNormForCausalLM"""),
        ("""xglm""", """FlaxXGLMForCausalLM"""),
        ("""xlm-roberta""", """FlaxXLMRobertaForCausalLM"""),
    ]
)

UpperCAmelCase				=						OrderedDict(
    [
        # Model for Sequence Classification mapping
        ("""albert""", """FlaxAlbertForSequenceClassification"""),
        ("""bart""", """FlaxBartForSequenceClassification"""),
        ("""bert""", """FlaxBertForSequenceClassification"""),
        ("""big_bird""", """FlaxBigBirdForSequenceClassification"""),
        ("""distilbert""", """FlaxDistilBertForSequenceClassification"""),
        ("""electra""", """FlaxElectraForSequenceClassification"""),
        ("""mbart""", """FlaxMBartForSequenceClassification"""),
        ("""roberta""", """FlaxRobertaForSequenceClassification"""),
        ("""roberta-prelayernorm""", """FlaxRobertaPreLayerNormForSequenceClassification"""),
        ("""roformer""", """FlaxRoFormerForSequenceClassification"""),
        ("""xlm-roberta""", """FlaxXLMRobertaForSequenceClassification"""),
    ]
)

UpperCAmelCase				=						OrderedDict(
    [
        # Model for Question Answering mapping
        ("""albert""", """FlaxAlbertForQuestionAnswering"""),
        ("""bart""", """FlaxBartForQuestionAnswering"""),
        ("""bert""", """FlaxBertForQuestionAnswering"""),
        ("""big_bird""", """FlaxBigBirdForQuestionAnswering"""),
        ("""distilbert""", """FlaxDistilBertForQuestionAnswering"""),
        ("""electra""", """FlaxElectraForQuestionAnswering"""),
        ("""mbart""", """FlaxMBartForQuestionAnswering"""),
        ("""roberta""", """FlaxRobertaForQuestionAnswering"""),
        ("""roberta-prelayernorm""", """FlaxRobertaPreLayerNormForQuestionAnswering"""),
        ("""roformer""", """FlaxRoFormerForQuestionAnswering"""),
        ("""xlm-roberta""", """FlaxXLMRobertaForQuestionAnswering"""),
    ]
)

UpperCAmelCase				=						OrderedDict(
    [
        # Model for Token Classification mapping
        ("""albert""", """FlaxAlbertForTokenClassification"""),
        ("""bert""", """FlaxBertForTokenClassification"""),
        ("""big_bird""", """FlaxBigBirdForTokenClassification"""),
        ("""distilbert""", """FlaxDistilBertForTokenClassification"""),
        ("""electra""", """FlaxElectraForTokenClassification"""),
        ("""roberta""", """FlaxRobertaForTokenClassification"""),
        ("""roberta-prelayernorm""", """FlaxRobertaPreLayerNormForTokenClassification"""),
        ("""roformer""", """FlaxRoFormerForTokenClassification"""),
        ("""xlm-roberta""", """FlaxXLMRobertaForTokenClassification"""),
    ]
)

UpperCAmelCase				=						OrderedDict(
    [
        # Model for Multiple Choice mapping
        ("""albert""", """FlaxAlbertForMultipleChoice"""),
        ("""bert""", """FlaxBertForMultipleChoice"""),
        ("""big_bird""", """FlaxBigBirdForMultipleChoice"""),
        ("""distilbert""", """FlaxDistilBertForMultipleChoice"""),
        ("""electra""", """FlaxElectraForMultipleChoice"""),
        ("""roberta""", """FlaxRobertaForMultipleChoice"""),
        ("""roberta-prelayernorm""", """FlaxRobertaPreLayerNormForMultipleChoice"""),
        ("""roformer""", """FlaxRoFormerForMultipleChoice"""),
        ("""xlm-roberta""", """FlaxXLMRobertaForMultipleChoice"""),
    ]
)

UpperCAmelCase				=						OrderedDict(
    [
        ("""bert""", """FlaxBertForNextSentencePrediction"""),
    ]
)

UpperCAmelCase				=						OrderedDict(
    [
        ("""speech-encoder-decoder""", """FlaxSpeechEncoderDecoderModel"""),
        ("""whisper""", """FlaxWhisperForConditionalGeneration"""),
    ]
)

UpperCAmelCase				=						OrderedDict(
    [
        ("""whisper""", """FlaxWhisperForAudioClassification"""),
    ]
)

UpperCAmelCase				=						_LazyAutoMapping(CONFIG_MAPPING_NAMES, FLAX_MODEL_MAPPING_NAMES)
UpperCAmelCase				=						_LazyAutoMapping(CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_PRETRAINING_MAPPING_NAMES)
UpperCAmelCase				=						_LazyAutoMapping(CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_MASKED_LM_MAPPING_NAMES)
UpperCAmelCase				=						_LazyAutoMapping(
    CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING_NAMES
)
UpperCAmelCase				=						_LazyAutoMapping(
    CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING_NAMES
)
UpperCAmelCase				=						_LazyAutoMapping(CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_VISION_2_SEQ_MAPPING_NAMES)
UpperCAmelCase				=						_LazyAutoMapping(CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_CAUSAL_LM_MAPPING_NAMES)
UpperCAmelCase				=						_LazyAutoMapping(
    CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING_NAMES
)
UpperCAmelCase				=						_LazyAutoMapping(
    CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_QUESTION_ANSWERING_MAPPING_NAMES
)
UpperCAmelCase				=						_LazyAutoMapping(
    CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING_NAMES
)
UpperCAmelCase				=						_LazyAutoMapping(
    CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_MULTIPLE_CHOICE_MAPPING_NAMES
)
UpperCAmelCase				=						_LazyAutoMapping(
    CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING_NAMES
)
UpperCAmelCase				=						_LazyAutoMapping(
    CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING_NAMES
)
UpperCAmelCase				=						_LazyAutoMapping(
    CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING_NAMES
)




class 	lowercase__				(					_BaseAutoModelClass				):
   __UpperCAmelCase							       =					FLAX_MODEL_MAPPING







UpperCAmelCase				=						auto_class_update(FlaxAutoModel)




class 	lowercase__				(					_BaseAutoModelClass				):
   __UpperCAmelCase							       =					FLAX_MODEL_FOR_PRETRAINING_MAPPING







UpperCAmelCase				=						auto_class_update(FlaxAutoModelForPreTraining, head_doc="""pretraining""")




class 	lowercase__				(					_BaseAutoModelClass				):
   __UpperCAmelCase							       =					FLAX_MODEL_FOR_CAUSAL_LM_MAPPING







UpperCAmelCase				=						auto_class_update(FlaxAutoModelForCausalLM, head_doc="""causal language modeling""")




class 	lowercase__				(					_BaseAutoModelClass				):
   __UpperCAmelCase							       =					FLAX_MODEL_FOR_MASKED_LM_MAPPING







UpperCAmelCase				=						auto_class_update(FlaxAutoModelForMaskedLM, head_doc="""masked language modeling""")




class 	lowercase__				(					_BaseAutoModelClass				):
   __UpperCAmelCase							       =					FLAX_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING







UpperCAmelCase				=						auto_class_update(
    FlaxAutoModelForSeqaSeqLM, head_doc="""sequence-to-sequence language modeling""", checkpoint_for_example="""t5-base"""
)




class 	lowercase__				(					_BaseAutoModelClass				):
   __UpperCAmelCase							       =					FLAX_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING







UpperCAmelCase				=						auto_class_update(
    FlaxAutoModelForSequenceClassification, head_doc="""sequence classification"""
)




class 	lowercase__				(					_BaseAutoModelClass				):
   __UpperCAmelCase							       =					FLAX_MODEL_FOR_QUESTION_ANSWERING_MAPPING







UpperCAmelCase				=						auto_class_update(FlaxAutoModelForQuestionAnswering, head_doc="""question answering""")




class 	lowercase__				(					_BaseAutoModelClass				):
   __UpperCAmelCase							       =					FLAX_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING







UpperCAmelCase				=						auto_class_update(
    FlaxAutoModelForTokenClassification, head_doc="""token classification"""
)




class 	lowercase__				(					_BaseAutoModelClass				):
   __UpperCAmelCase							       =					FLAX_MODEL_FOR_MULTIPLE_CHOICE_MAPPING







UpperCAmelCase				=						auto_class_update(FlaxAutoModelForMultipleChoice, head_doc="""multiple choice""")




class 	lowercase__				(					_BaseAutoModelClass				):
   __UpperCAmelCase							       =					FLAX_MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING







UpperCAmelCase				=						auto_class_update(
    FlaxAutoModelForNextSentencePrediction, head_doc="""next sentence prediction"""
)




class 	lowercase__				(					_BaseAutoModelClass				):
   __UpperCAmelCase							       =					FLAX_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING







UpperCAmelCase				=						auto_class_update(
    FlaxAutoModelForImageClassification, head_doc="""image classification"""
)




class 	lowercase__				(					_BaseAutoModelClass				):
   __UpperCAmelCase							       =					FLAX_MODEL_FOR_VISION_2_SEQ_MAPPING







UpperCAmelCase				=						auto_class_update(FlaxAutoModelForVisionaSeq, head_doc="""vision-to-text modeling""")




class 	lowercase__				(					_BaseAutoModelClass				):
   __UpperCAmelCase							       =					FLAX_MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING







UpperCAmelCase				=						auto_class_update(
    FlaxAutoModelForSpeechSeqaSeq, head_doc="""sequence-to-sequence speech-to-text modeling"""
)

