


"""simple docstring"""

import argparse
import json
from pathlib import Path

import requests
import torch
from huggingface_hub import hf_hub_download
from PIL import Image

from transformers import BeitConfig, BeitForImageClassification, BeitForMaskedImageModeling, BeitImageProcessor
from transformers.image_utils import PILImageResampling
from transformers.utils import logging


logging.set_verbosity_info()
UpperCAmelCase__  							=logging.get_logger(__name__)


def lowerCAmelCase_      (				UpperCamelCase__	: Optional[int]				,   UpperCamelCase__	: Union[str, Any]=False				,   UpperCamelCase__	: List[str]=False ):






 """simple docstring"""







 __lowercase									=	"""backbone.""" if is_semantic else """"""

 __lowercase									=	[]
 for i in range(config.num_hidden_layers ):
  # encoder layers: output projection, 2 feedforward neural networks and 2 layernorms
  rename_keys.append((f'''{prefix}blocks.{i}.norm1.weight''', f'''beit.encoder.layer.{i}.layernorm_before.weight''') )
  rename_keys.append((f'''{prefix}blocks.{i}.norm1.bias''', f'''beit.encoder.layer.{i}.layernorm_before.bias''') )
  rename_keys.append(
      (f'''{prefix}blocks.{i}.attn.proj.weight''', f'''beit.encoder.layer.{i}.attention.output.dense.weight''') )
  rename_keys.append(
      (f'''{prefix}blocks.{i}.attn.proj.bias''', f'''beit.encoder.layer.{i}.attention.output.dense.bias''') )
  rename_keys.append((f'''{prefix}blocks.{i}.norm2.weight''', f'''beit.encoder.layer.{i}.layernorm_after.weight''') )
  rename_keys.append((f'''{prefix}blocks.{i}.norm2.bias''', f'''beit.encoder.layer.{i}.layernorm_after.bias''') )
  rename_keys.append((f'''{prefix}blocks.{i}.mlp.fc1.weight''', f'''beit.encoder.layer.{i}.intermediate.dense.weight''') )
  rename_keys.append((f'''{prefix}blocks.{i}.mlp.fc1.bias''', f'''beit.encoder.layer.{i}.intermediate.dense.bias''') )
  rename_keys.append((f'''{prefix}blocks.{i}.mlp.fc2.weight''', f'''beit.encoder.layer.{i}.output.dense.weight''') )
  rename_keys.append((f'''{prefix}blocks.{i}.mlp.fc2.bias''', f'''beit.encoder.layer.{i}.output.dense.bias''') )

 # projection layer + position embeddings
 rename_keys.extend(
     [
         (f'''{prefix}cls_token''', """beit.embeddings.cls_token"""),
         (f'''{prefix}patch_embed.proj.weight''', """beit.embeddings.patch_embeddings.projection.weight"""),
         (f'''{prefix}patch_embed.proj.bias''', """beit.embeddings.patch_embeddings.projection.bias"""),
         (f'''{prefix}pos_embed''', """beit.embeddings.position_embeddings"""),
     ] )

 if has_lm_head:
  # mask token + layernorm
  rename_keys.extend(
      [
          ("""mask_token""", """beit.embeddings.mask_token"""),
          ("""norm.weight""", """layernorm.weight"""),
          ("""norm.bias""", """layernorm.bias"""),
      ] )
 else:
  # layernorm + classification head
  rename_keys.extend(
      [
          ("""fc_norm.weight""", """beit.pooler.layernorm.weight"""),
          ("""fc_norm.bias""", """beit.pooler.layernorm.bias"""),
          ("""head.weight""", """classifier.weight"""),
          ("""head.bias""", """classifier.bias"""),
      ] )

 return rename_keys


def lowerCAmelCase_      (				UpperCamelCase__	: Any				,   UpperCamelCase__	: Dict				,   UpperCamelCase__	: Tuple=False				,   UpperCamelCase__	: int=False ):






 """simple docstring"""







 for i in range(config.num_hidden_layers ):
  __lowercase									=	"""backbone.""" if is_semantic else """"""
  # queries, keys and values
  __lowercase									=	state_dict.pop(f'''{prefix}blocks.{i}.attn.qkv.weight''' )
  __lowercase									=	state_dict.pop(f'''{prefix}blocks.{i}.attn.q_bias''' )
  __lowercase									=	state_dict.pop(f'''{prefix}blocks.{i}.attn.v_bias''' )

  __lowercase									=	in_proj_weight[
      : config.hidden_size, :
  ]
  __lowercase									=	q_bias
  __lowercase									=	in_proj_weight[
      config.hidden_size : config.hidden_size * 2, :
  ]
  __lowercase									=	in_proj_weight[
      -config.hidden_size :, :
  ]
  __lowercase									=	v_bias

  # gamma_1 and gamma_2
  # we call them lambda because otherwise they are renamed when using .from_pretrained
  __lowercase									=	state_dict.pop(f'''{prefix}blocks.{i}.gamma_1''' )
  __lowercase									=	state_dict.pop(f'''{prefix}blocks.{i}.gamma_2''' )

  __lowercase									=	gamma_a
  __lowercase									=	gamma_a


def lowerCAmelCase_      (				UpperCamelCase__	: Tuple				,   UpperCamelCase__	: Optional[int]				,   UpperCamelCase__	: List[str] ):






 """simple docstring"""







 __lowercase									=	dct.pop(UpperCamelCase__ )
 __lowercase									=	val


def lowerCAmelCase_      (				):






 """simple docstring"""







 __lowercase									=	"""http://images.cocodataset.org/val2017/000000039769.jpg"""
 __lowercase									=	Image.open(requests.get(UpperCamelCase__				,   stream=UpperCamelCase__ ).raw )
 return im


@torch.no_grad()
def lowerCAmelCase_      (				UpperCamelCase__	: Optional[int]				,   UpperCamelCase__	: Optional[int]				,   UpperCamelCase__	: Any=False ):






 """simple docstring"""







 __lowercase									=	False if """rvlcdip""" in checkpoint_url else True
 __lowercase									=	BeitConfig(use_absolute_position_embeddings=UpperCamelCase__				,   use_mask_token=UpperCamelCase__ )

 # size of the architecture
 if "large" in checkpoint_url or "dit-l" in checkpoint_url:
  __lowercase									=	1024
  __lowercase									=	4096
  __lowercase									=	24
  __lowercase									=	16

 # labels
 if "rvlcdip" in checkpoint_url:
  __lowercase									=	16
  __lowercase									=	"""huggingface/label-files"""
  __lowercase									=	"""rvlcdip-id2label.json"""
  __lowercase									=	json.load(open(hf_hub_download(UpperCamelCase__				,   UpperCamelCase__				,   repo_type="""dataset""" )				,   """r""" ) )
  __lowercase									=	{int(UpperCamelCase__ ): v for k, v in idalabel.items()}
  __lowercase									=	idalabel
  __lowercase									=	{v: k for k, v in idalabel.items()}

 # load state_dict of original model, remove and rename some keys
 __lowercase									=	torch.hub.load_state_dict_from_url(UpperCamelCase__				,   map_location="""cpu""" )["""model"""]

 __lowercase									=	create_rename_keys(UpperCamelCase__				,   has_lm_head=UpperCamelCase__ )
 for src, dest in rename_keys:
  rename_key(UpperCamelCase__				,   UpperCamelCase__				,   UpperCamelCase__ )
 read_in_q_k_v(UpperCamelCase__				,   UpperCamelCase__				,   has_lm_head=UpperCamelCase__ )

 # load HuggingFace model
 __lowercase									=	BeitForMaskedImageModeling(UpperCamelCase__ ) if has_lm_head else BeitForImageClassification(UpperCamelCase__ )
 model.eval()
 model.load_state_dict(UpperCamelCase__ )

 # Check outputs on an image
 __lowercase									=	BeitImageProcessor(
     size=config.image_size				,   resample=PILImageResampling.BILINEAR				,   do_center_crop=UpperCamelCase__ )
 __lowercase									=	prepare_img()

 __lowercase									=	image_processor(images=UpperCamelCase__				,   return_tensors="""pt""" )
 __lowercase									=	encoding["""pixel_values"""]

 __lowercase									=	model(UpperCamelCase__ )
 __lowercase									=	outputs.logits

 # verify logits
 __lowercase									=	[1, 16] if """rvlcdip""" in checkpoint_url else [1, 196, 8192]
 assert logits.shape == torch.Size(UpperCamelCase__ ), "Shape of logits not as expected"

 Path(UpperCamelCase__ ).mkdir(exist_ok=UpperCamelCase__ )
 print(f'''Saving model to {pytorch_dump_folder_path}''' )
 model.save_pretrained(UpperCamelCase__ )
 print(f'''Saving image processor to {pytorch_dump_folder_path}''' )
 image_processor.save_pretrained(UpperCamelCase__ )

 if push_to_hub:
  if has_lm_head:
   __lowercase									=	"""dit-base""" if """base""" in checkpoint_url else """dit-large"""
  else:
   __lowercase									=	"""dit-base-finetuned-rvlcdip""" if """dit-b""" in checkpoint_url else """dit-large-finetuned-rvlcdip"""
  image_processor.push_to_hub(
      repo_path_or_name=Path(UpperCamelCase__				,   UpperCamelCase__ )				,   organization="""nielsr"""				,   commit_message="""Add image processor"""				,   use_temp_dir=UpperCamelCase__				,   )
  model.push_to_hub(
      repo_path_or_name=Path(UpperCamelCase__				,   UpperCamelCase__ )				,   organization="""nielsr"""				,   commit_message="""Add model"""				,   use_temp_dir=UpperCamelCase__				,   )


if __name__ == "__main__":
       UpperCAmelCase__  							=argparse.ArgumentParser()

       parser.add_argument(
           "--checkpoint_url",
           default="https://layoutlm.blob.core.windows.net/dit/dit-pts/dit-base-224-p16-500k-62d53a.pth",
           type=str,
           help="URL to the original PyTorch checkpoint (.pth file).",
       )
       parser.add_argument(
           "--pytorch_dump_folder_path", default=None, type=str, help="Path to the folder to output PyTorch model."
       )
       parser.add_argument(
           "--push_to_hub",
           action="store_true",
       )
       UpperCAmelCase__  							=parser.parse_args()
       convert_dit_checkpoint(args.checkpoint_url, args.pytorch_dump_folder_path, args.push_to_hub)




"""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    lowerCamelCase__						(		_BaseAutoModelClass    ):
      a :     List[Any]											=		FLAX_MODEL_MAPPING






UpperCAmelCase__  							=auto_class_update(FlaxAutoModel)





class    lowerCamelCase__						(		_BaseAutoModelClass    ):
      a :     int											=		FLAX_MODEL_FOR_PRETRAINING_MAPPING






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





class    lowerCamelCase__						(		_BaseAutoModelClass    ):
      a :     Tuple											=		FLAX_MODEL_FOR_CAUSAL_LM_MAPPING






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





class    lowerCamelCase__						(		_BaseAutoModelClass    ):
      a :     List[str]											=		FLAX_MODEL_FOR_MASKED_LM_MAPPING






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





class    lowerCamelCase__						(		_BaseAutoModelClass    ):
      a :     str											=		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    lowerCamelCase__						(		_BaseAutoModelClass    ):
      a :     str											=		FLAX_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING






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





class    lowerCamelCase__						(		_BaseAutoModelClass    ):
      a :     Tuple											=		FLAX_MODEL_FOR_QUESTION_ANSWERING_MAPPING






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





class    lowerCamelCase__						(		_BaseAutoModelClass    ):
      a :     Union[str, Any]											=		FLAX_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING






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





class    lowerCamelCase__						(		_BaseAutoModelClass    ):
      a :     Optional[Any]											=		FLAX_MODEL_FOR_MULTIPLE_CHOICE_MAPPING






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





class    lowerCamelCase__						(		_BaseAutoModelClass    ):
      a :     Optional[int]											=		FLAX_MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING






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





class    lowerCamelCase__						(		_BaseAutoModelClass    ):
      a :     Union[str, Any]											=		FLAX_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING






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





class    lowerCamelCase__						(		_BaseAutoModelClass    ):
      a :     Dict											=		FLAX_MODEL_FOR_VISION_2_SEQ_MAPPING






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





class    lowerCamelCase__						(		_BaseAutoModelClass    ):
      a :     List[str]											=		FLAX_MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING






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