


"""simple docstring"""
import argparse
import json
import os

import torch
from torch import nn

from transformers import NllbMoeConfig, NllbMoeModel
from transformers.modeling_utils import dtype_byte_size
from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME

def 				_snake_case      (   __snake_case							:      Any   ):




   """simple docstring"""







   _lowerCamelCase	:					List[Any]   =		[
       """encoder.version""",
       """decoder.version""",
       """model.encoder.version""",
       """model.decoder.version""",
       """decoder.output_projection.weight""",
       """_float_tensor""",
       """encoder.embed_positions._float_tensor""",
       """decoder.embed_positions._float_tensor""",
   ]
   for k in ignore_keys:
      state_dict.pop(__snake_case						, __snake_case   )

def 				_snake_case      (   __snake_case							:      Dict   ):




   """simple docstring"""







   _lowerCamelCase   ,    _lowerCamelCase	:					Optional[int]   =		emb.weight.shape
   _lowerCamelCase	:					Dict   =		nn.Linear(__snake_case						, __snake_case						, bias=__snake_case   )
   _lowerCamelCase	:					Dict   =		emb.weight.data
   return lin_layer

def 				_snake_case      (   __snake_case							:      Tuple						, __snake_case							:      List[str]=None   ):




   """simple docstring"""







   _lowerCamelCase	:					Any   =		{}
   for old_key in state_dict.keys():
      _lowerCamelCase	:					Optional[int]   =		old_key
      if "moe_layer.experts." in key:
         if expert_idx is not None:
            _lowerCamelCase	:					Optional[Any]   =		key.replace("""moe_layer.experts.0"""						, F'ffn.experts.expert_{expert_idx}'   )
         else:
            _lowerCamelCase	:					str   =		key.replace("""moe_layer.experts."""						, """ffn.experts.expert_"""   )
      if "gate" in key:
         _lowerCamelCase	:					Tuple   =		key.replace(""".moe_layer.gate.wg"""						, """.ffn.router.classifier"""   )
      if "fc2" and "experts" not in key:
         _lowerCamelCase	:					Any   =		key.replace(""".fc2."""						, """.ffn.fc2."""   )
      if "fc1" and "experts" not in key:
         _lowerCamelCase	:					Tuple   =		key.replace(""".fc1."""						, """.ffn.fc1."""   )
      if ".encoder_attn." in key:
         _lowerCamelCase	:					str   =		key.replace(""".encoder_attn."""						, """.cross_attention."""   )
      if "encoder_attn_layer_norm" in key:
         _lowerCamelCase	:					Optional[int]   =		key.replace("""encoder_attn_layer_norm"""						, """cross_attention_layer_norm"""   )
      if "final_layer_norm" in key:
         _lowerCamelCase	:					Any   =		key.replace("""final_layer_norm"""						, """ff_layer_norm"""   )
      _lowerCamelCase	:					Optional[Any]   =		state_dict[old_key]
   return new_dict

def 				_snake_case      (   __snake_case							:      Union[str, Any]						, __snake_case							:      str						, __snake_case							:      List[str]						, __snake_case							:      List[str]						, __snake_case							:      str = WEIGHTS_NAME   ):




   """simple docstring"""







   _lowerCamelCase	:					str   =		[]
   _lowerCamelCase	:					Dict   =		0
   os.makedirs(__snake_case						, exist_ok=__snake_case   )

   for expert in range(__snake_case   ):
      _lowerCamelCase	:					Tuple   =		switch_checkpoint_path + F'-rank-{expert}.pt'
      if os.path.isfile(__snake_case   ):
         _lowerCamelCase	:					int   =		torch.load(__snake_case   )["""model"""]
         remove_ignore_keys_(__snake_case   )
         _lowerCamelCase	:					int   =		rename_fairseq_keys(__snake_case						, __snake_case   )
         _lowerCamelCase	:					Union[str, Any]   =		os.path.join(
             __snake_case						, weights_name.replace(""".bin"""						, F'-{len(__snake_case   )+1:05d}-of-???.bin'   )   )
         torch.save(__snake_case						, __snake_case   )
         sharded_state_dicts.append(expert_state.keys()   )
         total_size += sum([value.numel() for key, value in expert_state.items()]   ) * dtype_byte_size(
             expert_state[list(__snake_case   )[0]].dtype   )

    # Add the last block
   _lowerCamelCase	:					List[Any]   =		os.path.join(__snake_case						, weights_name.replace(""".bin"""						, F'-{len(__snake_case   )+1:05d}-of-???.bin'   )   )
   _lowerCamelCase	:					Dict   =		torch.load(switch_checkpoint_path + """-shared.pt"""   )["""model"""]
   remove_ignore_keys_(__snake_case   )
   _lowerCamelCase	:					Optional[int]   =		rename_fairseq_keys(__snake_case						, __snake_case   )
   _lowerCamelCase	:					List[Any]   =		shared_weights["""decoder.embed_tokens.weight"""]
   sharded_state_dicts.append(shared_weights.keys()   )

   # If we only have the shared weights (dummy model/experts saved on the same file)
   if len(__snake_case   ) == 1:
      _lowerCamelCase	:					Dict   =		os.path.join(__snake_case						, __snake_case   )
      torch.save(__snake_case						, __snake_case   )
      return {weights_name: sharded_state_dicts[0]}, None
   else:
      torch.save(__snake_case						, __snake_case   )
   # Otherwise, let's build the index
   _lowerCamelCase	:					str   =		{}
   for idx, shard in enumerate(__snake_case   ):
      _lowerCamelCase	:					Optional[int]   =		weights_name.replace(""".bin"""						, F'-{idx+1:05d}-of-{len(__snake_case   ):05d}.bin'   )
      _lowerCamelCase	:					List[str]   =		os.path.join(__snake_case						, weights_name.replace(""".bin"""						, F'-{idx+1:05d}-of-???.bin'   )   )
      os.rename(__snake_case						, os.path.join(__snake_case						, __snake_case   )   )
      for key in shard:
         _lowerCamelCase	:					List[str]   =		shard_file

    # Add the metadata
   _lowerCamelCase	:					Optional[int]   =		{"""total_size""": total_size}
   _lowerCamelCase	:					Tuple   =		{"""metadata""": metadata, """weight_map""": weight_map}

   with open(os.path.join(__snake_case						, __snake_case   )						, """w"""						, encoding="""utf-8"""   ) as f:
      _lowerCamelCase	:					Union[str, Any]   =		json.dumps(__snake_case						, indent=2						, sort_keys=__snake_case   ) + """\n"""
      f.write(__snake_case   )

   return metadata, index


if __name__ == "__main__":
 UpperCAmelCase				=						argparse.ArgumentParser()
 # Required parameters
 parser.add_argument(
     """--nllb_moe_checkpoint_path""",
     default="""/home/arthur_huggingface_co/fairseq/weights/checkpoints/model_moe_54b/checkpoint_2_300000""",
     type=str,
     required=False,
     help="""Path to a directory containing a folder per layer. Follows the original Google format.""",
 )
 parser.add_argument("""--dtype""", default="""float32""", type=str, required=False, help="""dtype of the saved model""")
 parser.add_argument(
     """--pytorch_dump_folder_path""",
     default="""/home/arthur_huggingface_co/fairseq/weights/checkpoints/hf-converted-moe-54b""",
     type=str,
     required=False,
     help="""Path to the output pytorch model.""",
 )
 UpperCAmelCase				=						parser.parse_args()
 UpperCAmelCase			,  UpperCAmelCase				=						shard_on_the_fly(
     args.nllb_moe_checkpoint_path,
     args.pytorch_dump_folder_path,
     128,
     args.dtype,
 )

 UpperCAmelCase				=						NllbMoeConfig.from_pretrained(
     """facebook/nllb-200-3.3B""", encoder_sparse_step=4, decoder_sparse_step=4, num_experts=128
 )
 config.save_pretrained(args.pytorch_dump_folder_path)
 UpperCAmelCase				=						NllbMoeModel.from_pretrained(args.pytorch_dump_folder_path)
 print("""Done""")
 model.save_pretrained(args.pytorch_dump_folder_path)





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

