codingutf8 2018 the huggingface inc team licensed under the apache license version 2 0 the license you may not use this file except in compliance with the license you may obtain a copy of the license at http www apache orglicenseslicense2 0 unless required by applicable law or agreed to in writing software distributed under the license is distributed on an as is basis without warranties or conditions of any kind either express or implied see the license for the specific language governing permissions and limitations under the license auto model class import warnings from collections import ordereddict from utils import logging from autofactory import baseautomodelclass lazyautomapping autoclassupdate from configurationauto import configmappingnames logger logging getloggername tfmodelmappingnames ordereddict base model mapping albert tfalbertmodel bart tfbartmodel bert tfbertmodel blenderbot tfblenderbotmodel blenderbotsmall tfblenderbotsmallmodel blip tfblipmodel camembert tfcamembertmodel clip tfclipmodel convbert tfconvbertmodel convnext tfconvnextmodel convnextv2 tfconvnextv2model ctrl tfctrlmodel cvt tfcvtmodel data2vecvision tfdata2vecvisionmodel deberta tfdebertamodel debertav2 tfdebertav2model deit tfdeitmodel distilbert tfdistilbertmodel dpr tfdprquestionencoder efficientformer tfefficientformermodel electra tfelectramodel esm tfesmmodel flaubert tfflaubertmodel funnel tffunnelmodel tffunnelbasemodel gptsw3 tfgpt2model gpt2 tfgpt2model gptj tfgptjmodel groupvit tfgroupvitmodel hubert tfhubertmodel layoutlm tflayoutlmmodel layoutlmv3 tflayoutlmv3model led tfledmodel longformer tflongformermodel lxmert tflxmertmodel marian tfmarianmodel mbart tfmbartmodel mobilebert tfmobilebertmodel mobilevit tfmobilevitmodel mpnet tfmpnetmodel mt5 tfmt5model openaigpt tfopenaigptmodel opt tfoptmodel pegasus tfpegasusmodel regnet tfregnetmodel rembert tfrembertmodel resnet tfresnetmodel roberta tfrobertamodel robertaprelayernorm tfrobertaprelayernormmodel roformer tfroformermodel sam tfsammodel segformer tfsegformermodel speechtotext tfspeech2textmodel swin tfswinmodel t5 tft5model tapas tftapasmodel transfoxl tftransfoxlmodel visiontextdualencoder tfvisiontextdualencodermodel vit tfvitmodel vitmae tfvitmaemodel wav2vec2 tfwav2vec2model whisper tfwhispermodel xglm tfxglmmodel xlm tfxlmmodel xlmroberta tfxlmrobertamodel xlnet tfxlnetmodel tfmodelforpretrainingmappingnames ordereddict model for pretraining mapping albert tfalbertforpretraining bart tfbartforconditionalgeneration bert tfbertforpretraining camembert tfcamembertformaskedlm ctrl tfctrllmheadmodel distilbert tfdistilbertformaskedlm electra tfelectraforpretraining flaubert tfflaubertwithlmheadmodel funnel tffunnelforpretraining gptsw3 tfgpt2lmheadmodel gpt2 tfgpt2lmheadmodel layoutlm tflayoutlmformaskedlm lxmert tflxmertforpretraining mobilebert tfmobilebertforpretraining mpnet tfmpnetformaskedlm openaigpt tfopenaigptlmheadmodel roberta tfrobertaformaskedlm robertaprelayernorm tfrobertaprelayernormformaskedlm t5 tft5forconditionalgeneration tapas tftapasformaskedlm transfoxl tftransfoxllmheadmodel vitmae tfvitmaeforpretraining xlm tfxlmwithlmheadmodel xlmroberta tfxlmrobertaformaskedlm xlnet tfxlnetlmheadmodel tfmodelwithlmheadmappingnames ordereddict model with lm heads mapping albert tfalbertformaskedlm bart tfbartforconditionalgeneration bert tfbertformaskedlm camembert tfcamembertformaskedlm convbert tfconvbertformaskedlm ctrl tfctrllmheadmodel distilbert tfdistilbertformaskedlm electra tfelectraformaskedlm esm tfesmformaskedlm flaubert tfflaubertwithlmheadmodel funnel tffunnelformaskedlm gptsw3 tfgpt2lmheadmodel gpt2 tfgpt2lmheadmodel gptj tfgptjforcausallm layoutlm tflayoutlmformaskedlm led tfledforconditionalgeneration longformer tflongformerformaskedlm marian tfmarianmtmodel mobilebert tfmobilebertformaskedlm mpnet tfmpnetformaskedlm openaigpt tfopenaigptlmheadmodel rembert tfrembertformaskedlm roberta tfrobertaformaskedlm robertaprelayernorm tfrobertaprelayernormformaskedlm roformer tfroformerformaskedlm speechtotext tfspeech2textforconditionalgeneration t5 tft5forconditionalgeneration tapas tftapasformaskedlm transfoxl tftransfoxllmheadmodel whisper tfwhisperforconditionalgeneration xlm tfxlmwithlmheadmodel xlmroberta tfxlmrobertaformaskedlm xlnet tfxlnetlmheadmodel tfmodelforcausallmmappingnames ordereddict model for causal lm mapping bert tfbertlmheadmodel camembert tfcamembertforcausallm ctrl tfctrllmheadmodel gptsw3 tfgpt2lmheadmodel gpt2 tfgpt2lmheadmodel gptj tfgptjforcausallm openaigpt tfopenaigptlmheadmodel opt tfoptforcausallm rembert tfrembertforcausallm roberta tfrobertaforcausallm robertaprelayernorm tfrobertaprelayernormforcausallm roformer tfroformerforcausallm transfoxl tftransfoxllmheadmodel xglm tfxglmforcausallm xlm tfxlmwithlmheadmodel xlmroberta tfxlmrobertaforcausallm xlnet tfxlnetlmheadmodel tfmodelformaskedimagemodelingmappingnames ordereddict deit tfdeitformaskedimagemodeling swin tfswinformaskedimagemodeling tfmodelforimageclassificationmappingnames ordereddict model for imageclasssification convnext tfconvnextforimageclassification convnextv2 tfconvnextv2forimageclassification cvt tfcvtforimageclassification data2vecvision tfdata2vecvisionforimageclassification deit tfdeitforimageclassification tfdeitforimageclassificationwithteacher efficientformer tfefficientformerforimageclassification tfefficientformerforimageclassificationwithteacher mobilevit tfmobilevitforimageclassification regnet tfregnetforimageclassification resnet tfresnetforimageclassification segformer tfsegformerforimageclassification swin tfswinforimageclassification vit tfvitforimageclassification tfmodelforzeroshotimageclassificationmappingnames ordereddict model for zero shot image classification mapping blip tfblipmodel clip tfclipmodel tfmodelforsemanticsegmentationmappingnames ordereddict model for semantic segmentation mapping data2vecvision tfdata2vecvisionforsemanticsegmentation mobilevit tfmobilevitforsemanticsegmentation segformer tfsegformerforsemanticsegmentation tfmodelforvision2seqmappingnames ordereddict blip tfblipforconditionalgeneration visionencoderdecoder tfvisionencoderdecodermodel tfmodelformaskedlmmappingnames ordereddict model for masked lm mapping albert tfalbertformaskedlm bert tfbertformaskedlm camembert tfcamembertformaskedlm convbert tfconvbertformaskedlm deberta tfdebertaformaskedlm debertav2 tfdebertav2formaskedlm distilbert tfdistilbertformaskedlm electra tfelectraformaskedlm esm tfesmformaskedlm flaubert tfflaubertwithlmheadmodel funnel tffunnelformaskedlm layoutlm tflayoutlmformaskedlm longformer tflongformerformaskedlm mobilebert tfmobilebertformaskedlm mpnet tfmpnetformaskedlm rembert tfrembertformaskedlm roberta tfrobertaformaskedlm robertaprelayernorm tfrobertaprelayernormformaskedlm roformer tfroformerformaskedlm tapas tftapasformaskedlm xlm tfxlmwithlmheadmodel xlmroberta tfxlmrobertaformaskedlm tfmodelforseqtoseqcausallmmappingnames ordereddict model for seq2seq causal lm mapping bart tfbartforconditionalgeneration blenderbot tfblenderbotforconditionalgeneration blenderbotsmall tfblenderbotsmallforconditionalgeneration encoderdecoder tfencoderdecodermodel led tfledforconditionalgeneration marian tfmarianmtmodel mbart tfmbartforconditionalgeneration mt5 tfmt5forconditionalgeneration pegasus tfpegasusforconditionalgeneration t5 tft5forconditionalgeneration tfmodelforspeechseq2seqmappingnames ordereddict speechtotext tfspeech2textforconditionalgeneration whisper tfwhisperforconditionalgeneration tfmodelforsequenceclassificationmappingnames ordereddict model for sequence classification mapping albert tfalbertforsequenceclassification bart tfbartforsequenceclassification bert tfbertforsequenceclassification camembert tfcamembertforsequenceclassification convbert tfconvbertforsequenceclassification ctrl tfctrlforsequenceclassification deberta tfdebertaforsequenceclassification debertav2 tfdebertav2forsequenceclassification distilbert tfdistilbertforsequenceclassification electra tfelectraforsequenceclassification esm tfesmforsequenceclassification flaubert tfflaubertforsequenceclassification funnel tffunnelforsequenceclassification gptsw3 tfgpt2forsequenceclassification gpt2 tfgpt2forsequenceclassification gptj tfgptjforsequenceclassification layoutlm tflayoutlmforsequenceclassification layoutlmv3 tflayoutlmv3forsequenceclassification longformer tflongformerforsequenceclassification mobilebert tfmobilebertforsequenceclassification mpnet tfmpnetforsequenceclassification openaigpt tfopenaigptforsequenceclassification rembert tfrembertforsequenceclassification roberta tfrobertaforsequenceclassification robertaprelayernorm tfrobertaprelayernormforsequenceclassification roformer tfroformerforsequenceclassification tapas tftapasforsequenceclassification transfoxl tftransfoxlforsequenceclassification xlm tfxlmforsequenceclassification xlmroberta tfxlmrobertaforsequenceclassification xlnet tfxlnetforsequenceclassification tfmodelforquestionansweringmappingnames ordereddict model for question answering mapping albert tfalbertforquestionanswering bert tfbertforquestionanswering camembert tfcamembertforquestionanswering convbert tfconvbertforquestionanswering deberta tfdebertaforquestionanswering debertav2 tfdebertav2forquestionanswering distilbert tfdistilbertforquestionanswering electra tfelectraforquestionanswering flaubert tfflaubertforquestionansweringsimple funnel tffunnelforquestionanswering gptj tfgptjforquestionanswering layoutlmv3 tflayoutlmv3forquestionanswering longformer tflongformerforquestionanswering mobilebert tfmobilebertforquestionanswering mpnet tfmpnetforquestionanswering rembert tfrembertforquestionanswering roberta tfrobertaforquestionanswering robertaprelayernorm tfrobertaprelayernormforquestionanswering roformer tfroformerforquestionanswering xlm tfxlmforquestionansweringsimple xlmroberta tfxlmrobertaforquestionanswering xlnet tfxlnetforquestionansweringsimple tfmodelforaudioclassificationmappingnames ordereddictwav2vec2 tfwav2vec2forsequenceclassification tfmodelfordocumentquestionansweringmappingnames ordereddict layoutlm tflayoutlmforquestionanswering layoutlmv3 tflayoutlmv3forquestionanswering tfmodelfortablequestionansweringmappingnames ordereddict model for table question answering mapping tapas tftapasforquestionanswering tfmodelfortokenclassificationmappingnames ordereddict model for token classification mapping albert tfalbertfortokenclassification bert tfbertfortokenclassification camembert tfcamembertfortokenclassification convbert tfconvbertfortokenclassification deberta tfdebertafortokenclassification debertav2 tfdebertav2fortokenclassification distilbert tfdistilbertfortokenclassification electra tfelectrafortokenclassification esm tfesmfortokenclassification flaubert tfflaubertfortokenclassification funnel tffunnelfortokenclassification layoutlm tflayoutlmfortokenclassification layoutlmv3 tflayoutlmv3fortokenclassification longformer tflongformerfortokenclassification mobilebert tfmobilebertfortokenclassification mpnet tfmpnetfortokenclassification rembert tfrembertfortokenclassification roberta tfrobertafortokenclassification robertaprelayernorm tfrobertaprelayernormfortokenclassification roformer tfroformerfortokenclassification xlm tfxlmfortokenclassification xlmroberta tfxlmrobertafortokenclassification xlnet tfxlnetfortokenclassification tfmodelformultiplechoicemappingnames ordereddict model for multiple choice mapping albert tfalbertformultiplechoice bert tfbertformultiplechoice camembert tfcamembertformultiplechoice convbert tfconvbertformultiplechoice debertav2 tfdebertav2formultiplechoice distilbert tfdistilbertformultiplechoice electra tfelectraformultiplechoice flaubert tfflaubertformultiplechoice funnel tffunnelformultiplechoice longformer tflongformerformultiplechoice mobilebert tfmobilebertformultiplechoice mpnet tfmpnetformultiplechoice rembert tfrembertformultiplechoice roberta tfrobertaformultiplechoice robertaprelayernorm tfrobertaprelayernormformultiplechoice roformer tfroformerformultiplechoice xlm tfxlmformultiplechoice xlmroberta tfxlmrobertaformultiplechoice xlnet tfxlnetformultiplechoice tfmodelfornextsentencepredictionmappingnames ordereddict bert tfbertfornextsentenceprediction mobilebert tfmobilebertfornextsentenceprediction tfmodelformaskgenerationmappingnames ordereddict sam tfsammodel tfmodelfortextencodingmappingnames ordereddict albert tfalbertmodel bert tfbertmodel convbert tfconvbertmodel deberta tfdebertamodel debertav2 tfdebertav2model distilbert tfdistilbertmodel electra tfelectramodel flaubert tfflaubertmodel longformer tflongformermodel mobilebert tfmobilebertmodel mt5 tfmt5encodermodel rembert tfrembertmodel roberta tfrobertamodel robertaprelayernorm tfrobertaprelayernormmodel roformer tfroformermodel t5 tft5encodermodel xlm tfxlmmodel xlmroberta tfxlmrobertamodel tfmodelmapping lazyautomappingconfigmappingnames tfmodelmappingnames tfmodelforpretrainingmapping lazyautomappingconfigmappingnames tfmodelforpretrainingmappingnames tfmodelwithlmheadmapping lazyautomappingconfigmappingnames tfmodelwithlmheadmappingnames tfmodelforcausallmmapping lazyautomappingconfigmappingnames tfmodelforcausallmmappingnames tfmodelformaskedimagemodelingmapping lazyautomapping configmappingnames tfmodelformaskedimagemodelingmappingnames tfmodelforimageclassificationmapping lazyautomapping configmappingnames tfmodelforimageclassificationmappingnames tfmodelforzeroshotimageclassificationmapping lazyautomapping configmappingnames tfmodelforzeroshotimageclassificationmappingnames tfmodelforsemanticsegmentationmapping lazyautomapping configmappingnames tfmodelforsemanticsegmentationmappingnames tfmodelforvision2seqmapping lazyautomappingconfigmappingnames tfmodelforvision2seqmappingnames tfmodelformaskedlmmapping lazyautomappingconfigmappingnames tfmodelformaskedlmmappingnames tfmodelforseqtoseqcausallmmapping lazyautomapping configmappingnames tfmodelforseqtoseqcausallmmappingnames tfmodelforsequenceclassificationmapping lazyautomapping configmappingnames tfmodelforsequenceclassificationmappingnames tfmodelforspeechseq2seqmapping lazyautomapping configmappingnames tfmodelforspeechseq2seqmappingnames tfmodelforquestionansweringmapping lazyautomapping configmappingnames tfmodelforquestionansweringmappingnames tfmodelfordocumentquestionansweringmapping lazyautomapping configmappingnames tfmodelfordocumentquestionansweringmappingnames tfmodelfortablequestionansweringmapping lazyautomapping configmappingnames tfmodelfortablequestionansweringmappingnames tfmodelfortokenclassificationmapping lazyautomapping configmappingnames tfmodelfortokenclassificationmappingnames tfmodelformultiplechoicemapping lazyautomapping configmappingnames tfmodelformultiplechoicemappingnames tfmodelfornextsentencepredictionmapping lazyautomapping configmappingnames tfmodelfornextsentencepredictionmappingnames tfmodelforaudioclassificationmapping lazyautomapping configmappingnames tfmodelforaudioclassificationmappingnames tfmodelformaskgenerationmapping lazyautomapping configmappingnames tfmodelformaskgenerationmappingnames tfmodelfortextencodingmapping lazyautomappingconfigmappingnames tfmodelfortextencodingmappingnames class tfautomodelformaskgenerationbaseautomodelclass modelmapping tfmodelformaskgenerationmapping class tfautomodelfortextencodingbaseautomodelclass modelmapping tfmodelfortextencodingmapping class tfautomodelbaseautomodelclass modelmapping tfmodelmapping tfautomodel autoclassupdatetfautomodel class tfautomodelforaudioclassificationbaseautomodelclass modelmapping tfmodelforaudioclassificationmapping tfautomodelforaudioclassification autoclassupdate tfautomodelforaudioclassification headdocaudio classification class tfautomodelforpretrainingbaseautomodelclass modelmapping tfmodelforpretrainingmapping tfautomodelforpretraining autoclassupdatetfautomodelforpretraining headdocpretraining private on purpose the public class will add the deprecation warnings class tfautomodelwithlmheadbaseautomodelclass modelmapping tfmodelwithlmheadmapping tfautomodelwithlmhead autoclassupdatetfautomodelwithlmhead headdoclanguage modeling class tfautomodelforcausallmbaseautomodelclass modelmapping tfmodelforcausallmmapping tfautomodelforcausallm autoclassupdatetfautomodelforcausallm headdoccausal language modeling class tfautomodelformaskedimagemodelingbaseautomodelclass modelmapping tfmodelformaskedimagemodelingmapping tfautomodelformaskedimagemodeling autoclassupdate tfautomodelformaskedimagemodeling headdocmasked image modeling class tfautomodelforimageclassificationbaseautomodelclass modelmapping tfmodelforimageclassificationmapping tfautomodelforimageclassification autoclassupdate tfautomodelforimageclassification headdocimage classification class tfautomodelforzeroshotimageclassificationbaseautomodelclass modelmapping tfmodelforzeroshotimageclassificationmapping tfautomodelforzeroshotimageclassification autoclassupdate tfautomodelforzeroshotimageclassification headdoczeroshot image classification class tfautomodelforsemanticsegmentationbaseautomodelclass modelmapping tfmodelforsemanticsegmentationmapping tfautomodelforsemanticsegmentation autoclassupdate tfautomodelforsemanticsegmentation headdocsemantic segmentation class tfautomodelforvision2seqbaseautomodelclass modelmapping tfmodelforvision2seqmapping tfautomodelforvision2seq autoclassupdatetfautomodelforvision2seq headdocvisiontotext modeling class tfautomodelformaskedlmbaseautomodelclass modelmapping tfmodelformaskedlmmapping tfautomodelformaskedlm autoclassupdatetfautomodelformaskedlm headdocmasked language modeling class tfautomodelforseq2seqlmbaseautomodelclass modelmapping tfmodelforseqtoseqcausallmmapping tfautomodelforseq2seqlm autoclassupdate tfautomodelforseq2seqlm headdocsequencetosequence language modeling checkpointforexamplet5base class tfautomodelforsequenceclassificationbaseautomodelclass modelmapping tfmodelforsequenceclassificationmapping tfautomodelforsequenceclassification autoclassupdate tfautomodelforsequenceclassification headdocsequence classification class tfautomodelforquestionansweringbaseautomodelclass modelmapping tfmodelforquestionansweringmapping tfautomodelforquestionanswering autoclassupdatetfautomodelforquestionanswering headdocquestion answering class tfautomodelfordocumentquestionansweringbaseautomodelclass modelmapping tfmodelfordocumentquestionansweringmapping tfautomodelfordocumentquestionanswering autoclassupdate tfautomodelfordocumentquestionanswering headdocdocument question answering checkpointforexample impiralayoutlmdocumentqa revision52e01b3 class tfautomodelfortablequestionansweringbaseautomodelclass modelmapping tfmodelfortablequestionansweringmapping tfautomodelfortablequestionanswering autoclassupdate tfautomodelfortablequestionanswering headdoctable question answering checkpointforexamplegoogletapasbasefinetunedwtq class tfautomodelfortokenclassificationbaseautomodelclass modelmapping tfmodelfortokenclassificationmapping tfautomodelfortokenclassification autoclassupdate tfautomodelfortokenclassification headdoctoken classification class tfautomodelformultiplechoicebaseautomodelclass modelmapping tfmodelformultiplechoicemapping tfautomodelformultiplechoice autoclassupdatetfautomodelformultiplechoice headdocmultiple choice class tfautomodelfornextsentencepredictionbaseautomodelclass modelmapping tfmodelfornextsentencepredictionmapping tfautomodelfornextsentenceprediction autoclassupdate tfautomodelfornextsentenceprediction headdocnext sentence prediction class tfautomodelforspeechseq2seqbaseautomodelclass modelmapping tfmodelforspeechseq2seqmapping tfautomodelforspeechseq2seq autoclassupdate tfautomodelforspeechseq2seq headdocsequencetosequence speechtotext modeling class tfautomodelwithlmheadtfautomodelwithlmhead classmethod def fromconfigcls config warnings warn the class tfautomodelwithlmhead is deprecated and will be removed in a future version please use tfautomodelforcausallm for causal language models tfautomodelformaskedlm for masked language models and tfautomodelforseq2seqlm for encoderdecoder models futurewarning return super fromconfigconfig classmethod def frompretrainedcls pretrainedmodelnameorpath modelargs kwargs warnings warn the class tfautomodelwithlmhead is deprecated and will be removed in a future version please use tfautomodelforcausallm for causal language models tfautomodelformaskedlm for masked language models and tfautomodelforseq2seqlm for encoderdecoder models futurewarning return super frompretrainedpretrainedmodelnameorpath modelargs kwargs coding utf 8 2018 the huggingface inc team licensed under the apache license version 2 0 the license you may not use this file except in compliance with the license you may obtain a copy of the license at http www apache org licenses license 2 0 unless required by applicable law or agreed to in writing software distributed under the license is distributed on an as is basis without warranties or conditions of any kind either express or implied see the license for the specific language governing permissions and limitations under the license auto model class base model mapping model for pre training mapping model with lm heads mapping model for causal lm mapping model for image classsification model for zero shot image classification mapping model for semantic segmentation mapping model for masked lm mapping model for seq2seq causal lm mapping model for sequence classification mapping model for question answering mapping model for table question answering mapping model for token classification mapping model for multiple choice mapping private on purpose the public class will add the deprecation warnings
import warnings
from collections import OrderedDict

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


logger = logging.get_logger(__name__)


TF_MODEL_MAPPING_NAMES = OrderedDict(
    [
        
        ("albert", "TFAlbertModel"),
        ("bart", "TFBartModel"),
        ("bert", "TFBertModel"),
        ("blenderbot", "TFBlenderbotModel"),
        ("blenderbot-small", "TFBlenderbotSmallModel"),
        ("blip", "TFBlipModel"),
        ("camembert", "TFCamembertModel"),
        ("clip", "TFCLIPModel"),
        ("convbert", "TFConvBertModel"),
        ("convnext", "TFConvNextModel"),
        ("convnextv2", "TFConvNextV2Model"),
        ("ctrl", "TFCTRLModel"),
        ("cvt", "TFCvtModel"),
        ("data2vec-vision", "TFData2VecVisionModel"),
        ("deberta", "TFDebertaModel"),
        ("deberta-v2", "TFDebertaV2Model"),
        ("deit", "TFDeiTModel"),
        ("distilbert", "TFDistilBertModel"),
        ("dpr", "TFDPRQuestionEncoder"),
        ("efficientformer", "TFEfficientFormerModel"),
        ("electra", "TFElectraModel"),
        ("esm", "TFEsmModel"),
        ("flaubert", "TFFlaubertModel"),
        ("funnel", ("TFFunnelModel", "TFFunnelBaseModel")),
        ("gpt-sw3", "TFGPT2Model"),
        ("gpt2", "TFGPT2Model"),
        ("gptj", "TFGPTJModel"),
        ("groupvit", "TFGroupViTModel"),
        ("hubert", "TFHubertModel"),
        ("layoutlm", "TFLayoutLMModel"),
        ("layoutlmv3", "TFLayoutLMv3Model"),
        ("led", "TFLEDModel"),
        ("longformer", "TFLongformerModel"),
        ("lxmert", "TFLxmertModel"),
        ("marian", "TFMarianModel"),
        ("mbart", "TFMBartModel"),
        ("mobilebert", "TFMobileBertModel"),
        ("mobilevit", "TFMobileViTModel"),
        ("mpnet", "TFMPNetModel"),
        ("mt5", "TFMT5Model"),
        ("openai-gpt", "TFOpenAIGPTModel"),
        ("opt", "TFOPTModel"),
        ("pegasus", "TFPegasusModel"),
        ("regnet", "TFRegNetModel"),
        ("rembert", "TFRemBertModel"),
        ("resnet", "TFResNetModel"),
        ("roberta", "TFRobertaModel"),
        ("roberta-prelayernorm", "TFRobertaPreLayerNormModel"),
        ("roformer", "TFRoFormerModel"),
        ("sam", "TFSamModel"),
        ("segformer", "TFSegformerModel"),
        ("speech_to_text", "TFSpeech2TextModel"),
        ("swin", "TFSwinModel"),
        ("t5", "TFT5Model"),
        ("tapas", "TFTapasModel"),
        ("transfo-xl", "TFTransfoXLModel"),
        ("vision-text-dual-encoder", "TFVisionTextDualEncoderModel"),
        ("vit", "TFViTModel"),
        ("vit_mae", "TFViTMAEModel"),
        ("wav2vec2", "TFWav2Vec2Model"),
        ("whisper", "TFWhisperModel"),
        ("xglm", "TFXGLMModel"),
        ("xlm", "TFXLMModel"),
        ("xlm-roberta", "TFXLMRobertaModel"),
        ("xlnet", "TFXLNetModel"),
    ]
)

TF_MODEL_FOR_PRETRAINING_MAPPING_NAMES = OrderedDict(
    [
        
        ("albert", "TFAlbertForPreTraining"),
        ("bart", "TFBartForConditionalGeneration"),
        ("bert", "TFBertForPreTraining"),
        ("camembert", "TFCamembertForMaskedLM"),
        ("ctrl", "TFCTRLLMHeadModel"),
        ("distilbert", "TFDistilBertForMaskedLM"),
        ("electra", "TFElectraForPreTraining"),
        ("flaubert", "TFFlaubertWithLMHeadModel"),
        ("funnel", "TFFunnelForPreTraining"),
        ("gpt-sw3", "TFGPT2LMHeadModel"),
        ("gpt2", "TFGPT2LMHeadModel"),
        ("layoutlm", "TFLayoutLMForMaskedLM"),
        ("lxmert", "TFLxmertForPreTraining"),
        ("mobilebert", "TFMobileBertForPreTraining"),
        ("mpnet", "TFMPNetForMaskedLM"),
        ("openai-gpt", "TFOpenAIGPTLMHeadModel"),
        ("roberta", "TFRobertaForMaskedLM"),
        ("roberta-prelayernorm", "TFRobertaPreLayerNormForMaskedLM"),
        ("t5", "TFT5ForConditionalGeneration"),
        ("tapas", "TFTapasForMaskedLM"),
        ("transfo-xl", "TFTransfoXLLMHeadModel"),
        ("vit_mae", "TFViTMAEForPreTraining"),
        ("xlm", "TFXLMWithLMHeadModel"),
        ("xlm-roberta", "TFXLMRobertaForMaskedLM"),
        ("xlnet", "TFXLNetLMHeadModel"),
    ]
)

TF_MODEL_WITH_LM_HEAD_MAPPING_NAMES = OrderedDict(
    [
        
        ("albert", "TFAlbertForMaskedLM"),
        ("bart", "TFBartForConditionalGeneration"),
        ("bert", "TFBertForMaskedLM"),
        ("camembert", "TFCamembertForMaskedLM"),
        ("convbert", "TFConvBertForMaskedLM"),
        ("ctrl", "TFCTRLLMHeadModel"),
        ("distilbert", "TFDistilBertForMaskedLM"),
        ("electra", "TFElectraForMaskedLM"),
        ("esm", "TFEsmForMaskedLM"),
        ("flaubert", "TFFlaubertWithLMHeadModel"),
        ("funnel", "TFFunnelForMaskedLM"),
        ("gpt-sw3", "TFGPT2LMHeadModel"),
        ("gpt2", "TFGPT2LMHeadModel"),
        ("gptj", "TFGPTJForCausalLM"),
        ("layoutlm", "TFLayoutLMForMaskedLM"),
        ("led", "TFLEDForConditionalGeneration"),
        ("longformer", "TFLongformerForMaskedLM"),
        ("marian", "TFMarianMTModel"),
        ("mobilebert", "TFMobileBertForMaskedLM"),
        ("mpnet", "TFMPNetForMaskedLM"),
        ("openai-gpt", "TFOpenAIGPTLMHeadModel"),
        ("rembert", "TFRemBertForMaskedLM"),
        ("roberta", "TFRobertaForMaskedLM"),
        ("roberta-prelayernorm", "TFRobertaPreLayerNormForMaskedLM"),
        ("roformer", "TFRoFormerForMaskedLM"),
        ("speech_to_text", "TFSpeech2TextForConditionalGeneration"),
        ("t5", "TFT5ForConditionalGeneration"),
        ("tapas", "TFTapasForMaskedLM"),
        ("transfo-xl", "TFTransfoXLLMHeadModel"),
        ("whisper", "TFWhisperForConditionalGeneration"),
        ("xlm", "TFXLMWithLMHeadModel"),
        ("xlm-roberta", "TFXLMRobertaForMaskedLM"),
        ("xlnet", "TFXLNetLMHeadModel"),
    ]
)

TF_MODEL_FOR_CAUSAL_LM_MAPPING_NAMES = OrderedDict(
    [
        
        ("bert", "TFBertLMHeadModel"),
        ("camembert", "TFCamembertForCausalLM"),
        ("ctrl", "TFCTRLLMHeadModel"),
        ("gpt-sw3", "TFGPT2LMHeadModel"),
        ("gpt2", "TFGPT2LMHeadModel"),
        ("gptj", "TFGPTJForCausalLM"),
        ("openai-gpt", "TFOpenAIGPTLMHeadModel"),
        ("opt", "TFOPTForCausalLM"),
        ("rembert", "TFRemBertForCausalLM"),
        ("roberta", "TFRobertaForCausalLM"),
        ("roberta-prelayernorm", "TFRobertaPreLayerNormForCausalLM"),
        ("roformer", "TFRoFormerForCausalLM"),
        ("transfo-xl", "TFTransfoXLLMHeadModel"),
        ("xglm", "TFXGLMForCausalLM"),
        ("xlm", "TFXLMWithLMHeadModel"),
        ("xlm-roberta", "TFXLMRobertaForCausalLM"),
        ("xlnet", "TFXLNetLMHeadModel"),
    ]
)

TF_MODEL_FOR_MASKED_IMAGE_MODELING_MAPPING_NAMES = OrderedDict(
    [
        ("deit", "TFDeiTForMaskedImageModeling"),
        ("swin", "TFSwinForMaskedImageModeling"),
    ]
)

TF_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING_NAMES = OrderedDict(
    [
        
        ("convnext", "TFConvNextForImageClassification"),
        ("convnextv2", "TFConvNextV2ForImageClassification"),
        ("cvt", "TFCvtForImageClassification"),
        ("data2vec-vision", "TFData2VecVisionForImageClassification"),
        ("deit", ("TFDeiTForImageClassification", "TFDeiTForImageClassificationWithTeacher")),
        (
            "efficientformer",
            ("TFEfficientFormerForImageClassification", "TFEfficientFormerForImageClassificationWithTeacher"),
        ),
        ("mobilevit", "TFMobileViTForImageClassification"),
        ("regnet", "TFRegNetForImageClassification"),
        ("resnet", "TFResNetForImageClassification"),
        ("segformer", "TFSegformerForImageClassification"),
        ("swin", "TFSwinForImageClassification"),
        ("vit", "TFViTForImageClassification"),
    ]
)


TF_MODEL_FOR_ZERO_SHOT_IMAGE_CLASSIFICATION_MAPPING_NAMES = OrderedDict(
    [
        
        ("blip", "TFBlipModel"),
        ("clip", "TFCLIPModel"),
    ]
)


TF_MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING_NAMES = OrderedDict(
    [
        
        ("data2vec-vision", "TFData2VecVisionForSemanticSegmentation"),
        ("mobilevit", "TFMobileViTForSemanticSegmentation"),
        ("segformer", "TFSegformerForSemanticSegmentation"),
    ]
)

TF_MODEL_FOR_VISION_2_SEQ_MAPPING_NAMES = OrderedDict(
    [
        ("blip", "TFBlipForConditionalGeneration"),
        ("vision-encoder-decoder", "TFVisionEncoderDecoderModel"),
    ]
)

TF_MODEL_FOR_MASKED_LM_MAPPING_NAMES = OrderedDict(
    [
        
        ("albert", "TFAlbertForMaskedLM"),
        ("bert", "TFBertForMaskedLM"),
        ("camembert", "TFCamembertForMaskedLM"),
        ("convbert", "TFConvBertForMaskedLM"),
        ("deberta", "TFDebertaForMaskedLM"),
        ("deberta-v2", "TFDebertaV2ForMaskedLM"),
        ("distilbert", "TFDistilBertForMaskedLM"),
        ("electra", "TFElectraForMaskedLM"),
        ("esm", "TFEsmForMaskedLM"),
        ("flaubert", "TFFlaubertWithLMHeadModel"),
        ("funnel", "TFFunnelForMaskedLM"),
        ("layoutlm", "TFLayoutLMForMaskedLM"),
        ("longformer", "TFLongformerForMaskedLM"),
        ("mobilebert", "TFMobileBertForMaskedLM"),
        ("mpnet", "TFMPNetForMaskedLM"),
        ("rembert", "TFRemBertForMaskedLM"),
        ("roberta", "TFRobertaForMaskedLM"),
        ("roberta-prelayernorm", "TFRobertaPreLayerNormForMaskedLM"),
        ("roformer", "TFRoFormerForMaskedLM"),
        ("tapas", "TFTapasForMaskedLM"),
        ("xlm", "TFXLMWithLMHeadModel"),
        ("xlm-roberta", "TFXLMRobertaForMaskedLM"),
    ]
)

TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING_NAMES = OrderedDict(
    [
        
        ("bart", "TFBartForConditionalGeneration"),
        ("blenderbot", "TFBlenderbotForConditionalGeneration"),
        ("blenderbot-small", "TFBlenderbotSmallForConditionalGeneration"),
        ("encoder-decoder", "TFEncoderDecoderModel"),
        ("led", "TFLEDForConditionalGeneration"),
        ("marian", "TFMarianMTModel"),
        ("mbart", "TFMBartForConditionalGeneration"),
        ("mt5", "TFMT5ForConditionalGeneration"),
        ("pegasus", "TFPegasusForConditionalGeneration"),
        ("t5", "TFT5ForConditionalGeneration"),
    ]
)

TF_MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING_NAMES = OrderedDict(
    [
        ("speech_to_text", "TFSpeech2TextForConditionalGeneration"),
        ("whisper", "TFWhisperForConditionalGeneration"),
    ]
)

TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING_NAMES = OrderedDict(
    [
        
        ("albert", "TFAlbertForSequenceClassification"),
        ("bart", "TFBartForSequenceClassification"),
        ("bert", "TFBertForSequenceClassification"),
        ("camembert", "TFCamembertForSequenceClassification"),
        ("convbert", "TFConvBertForSequenceClassification"),
        ("ctrl", "TFCTRLForSequenceClassification"),
        ("deberta", "TFDebertaForSequenceClassification"),
        ("deberta-v2", "TFDebertaV2ForSequenceClassification"),
        ("distilbert", "TFDistilBertForSequenceClassification"),
        ("electra", "TFElectraForSequenceClassification"),
        ("esm", "TFEsmForSequenceClassification"),
        ("flaubert", "TFFlaubertForSequenceClassification"),
        ("funnel", "TFFunnelForSequenceClassification"),
        ("gpt-sw3", "TFGPT2ForSequenceClassification"),
        ("gpt2", "TFGPT2ForSequenceClassification"),
        ("gptj", "TFGPTJForSequenceClassification"),
        ("layoutlm", "TFLayoutLMForSequenceClassification"),
        ("layoutlmv3", "TFLayoutLMv3ForSequenceClassification"),
        ("longformer", "TFLongformerForSequenceClassification"),
        ("mobilebert", "TFMobileBertForSequenceClassification"),
        ("mpnet", "TFMPNetForSequenceClassification"),
        ("openai-gpt", "TFOpenAIGPTForSequenceClassification"),
        ("rembert", "TFRemBertForSequenceClassification"),
        ("roberta", "TFRobertaForSequenceClassification"),
        ("roberta-prelayernorm", "TFRobertaPreLayerNormForSequenceClassification"),
        ("roformer", "TFRoFormerForSequenceClassification"),
        ("tapas", "TFTapasForSequenceClassification"),
        ("transfo-xl", "TFTransfoXLForSequenceClassification"),
        ("xlm", "TFXLMForSequenceClassification"),
        ("xlm-roberta", "TFXLMRobertaForSequenceClassification"),
        ("xlnet", "TFXLNetForSequenceClassification"),
    ]
)

TF_MODEL_FOR_QUESTION_ANSWERING_MAPPING_NAMES = OrderedDict(
    [
        
        ("albert", "TFAlbertForQuestionAnswering"),
        ("bert", "TFBertForQuestionAnswering"),
        ("camembert", "TFCamembertForQuestionAnswering"),
        ("convbert", "TFConvBertForQuestionAnswering"),
        ("deberta", "TFDebertaForQuestionAnswering"),
        ("deberta-v2", "TFDebertaV2ForQuestionAnswering"),
        ("distilbert", "TFDistilBertForQuestionAnswering"),
        ("electra", "TFElectraForQuestionAnswering"),
        ("flaubert", "TFFlaubertForQuestionAnsweringSimple"),
        ("funnel", "TFFunnelForQuestionAnswering"),
        ("gptj", "TFGPTJForQuestionAnswering"),
        ("layoutlmv3", "TFLayoutLMv3ForQuestionAnswering"),
        ("longformer", "TFLongformerForQuestionAnswering"),
        ("mobilebert", "TFMobileBertForQuestionAnswering"),
        ("mpnet", "TFMPNetForQuestionAnswering"),
        ("rembert", "TFRemBertForQuestionAnswering"),
        ("roberta", "TFRobertaForQuestionAnswering"),
        ("roberta-prelayernorm", "TFRobertaPreLayerNormForQuestionAnswering"),
        ("roformer", "TFRoFormerForQuestionAnswering"),
        ("xlm", "TFXLMForQuestionAnsweringSimple"),
        ("xlm-roberta", "TFXLMRobertaForQuestionAnswering"),
        ("xlnet", "TFXLNetForQuestionAnsweringSimple"),
    ]
)
TF_MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING_NAMES = OrderedDict([("wav2vec2", "TFWav2Vec2ForSequenceClassification")])

TF_MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING_NAMES = OrderedDict(
    [
        ("layoutlm", "TFLayoutLMForQuestionAnswering"),
        ("layoutlmv3", "TFLayoutLMv3ForQuestionAnswering"),
    ]
)


TF_MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING_NAMES = OrderedDict(
    [
        
        ("tapas", "TFTapasForQuestionAnswering"),
    ]
)

TF_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING_NAMES = OrderedDict(
    [
        
        ("albert", "TFAlbertForTokenClassification"),
        ("bert", "TFBertForTokenClassification"),
        ("camembert", "TFCamembertForTokenClassification"),
        ("convbert", "TFConvBertForTokenClassification"),
        ("deberta", "TFDebertaForTokenClassification"),
        ("deberta-v2", "TFDebertaV2ForTokenClassification"),
        ("distilbert", "TFDistilBertForTokenClassification"),
        ("electra", "TFElectraForTokenClassification"),
        ("esm", "TFEsmForTokenClassification"),
        ("flaubert", "TFFlaubertForTokenClassification"),
        ("funnel", "TFFunnelForTokenClassification"),
        ("layoutlm", "TFLayoutLMForTokenClassification"),
        ("layoutlmv3", "TFLayoutLMv3ForTokenClassification"),
        ("longformer", "TFLongformerForTokenClassification"),
        ("mobilebert", "TFMobileBertForTokenClassification"),
        ("mpnet", "TFMPNetForTokenClassification"),
        ("rembert", "TFRemBertForTokenClassification"),
        ("roberta", "TFRobertaForTokenClassification"),
        ("roberta-prelayernorm", "TFRobertaPreLayerNormForTokenClassification"),
        ("roformer", "TFRoFormerForTokenClassification"),
        ("xlm", "TFXLMForTokenClassification"),
        ("xlm-roberta", "TFXLMRobertaForTokenClassification"),
        ("xlnet", "TFXLNetForTokenClassification"),
    ]
)

TF_MODEL_FOR_MULTIPLE_CHOICE_MAPPING_NAMES = OrderedDict(
    [
        
        ("albert", "TFAlbertForMultipleChoice"),
        ("bert", "TFBertForMultipleChoice"),
        ("camembert", "TFCamembertForMultipleChoice"),
        ("convbert", "TFConvBertForMultipleChoice"),
        ("deberta-v2", "TFDebertaV2ForMultipleChoice"),
        ("distilbert", "TFDistilBertForMultipleChoice"),
        ("electra", "TFElectraForMultipleChoice"),
        ("flaubert", "TFFlaubertForMultipleChoice"),
        ("funnel", "TFFunnelForMultipleChoice"),
        ("longformer", "TFLongformerForMultipleChoice"),
        ("mobilebert", "TFMobileBertForMultipleChoice"),
        ("mpnet", "TFMPNetForMultipleChoice"),
        ("rembert", "TFRemBertForMultipleChoice"),
        ("roberta", "TFRobertaForMultipleChoice"),
        ("roberta-prelayernorm", "TFRobertaPreLayerNormForMultipleChoice"),
        ("roformer", "TFRoFormerForMultipleChoice"),
        ("xlm", "TFXLMForMultipleChoice"),
        ("xlm-roberta", "TFXLMRobertaForMultipleChoice"),
        ("xlnet", "TFXLNetForMultipleChoice"),
    ]
)

TF_MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING_NAMES = OrderedDict(
    [
        ("bert", "TFBertForNextSentencePrediction"),
        ("mobilebert", "TFMobileBertForNextSentencePrediction"),
    ]
)
TF_MODEL_FOR_MASK_GENERATION_MAPPING_NAMES = OrderedDict(
    [
        ("sam", "TFSamModel"),
    ]
)
TF_MODEL_FOR_TEXT_ENCODING_MAPPING_NAMES = OrderedDict(
    [
        ("albert", "TFAlbertModel"),
        ("bert", "TFBertModel"),
        ("convbert", "TFConvBertModel"),
        ("deberta", "TFDebertaModel"),
        ("deberta-v2", "TFDebertaV2Model"),
        ("distilbert", "TFDistilBertModel"),
        ("electra", "TFElectraModel"),
        ("flaubert", "TFFlaubertModel"),
        ("longformer", "TFLongformerModel"),
        ("mobilebert", "TFMobileBertModel"),
        ("mt5", "TFMT5EncoderModel"),
        ("rembert", "TFRemBertModel"),
        ("roberta", "TFRobertaModel"),
        ("roberta-prelayernorm", "TFRobertaPreLayerNormModel"),
        ("roformer", "TFRoFormerModel"),
        ("t5", "TFT5EncoderModel"),
        ("xlm", "TFXLMModel"),
        ("xlm-roberta", "TFXLMRobertaModel"),
    ]
)

TF_MODEL_MAPPING = _LazyAutoMapping(CONFIG_MAPPING_NAMES, TF_MODEL_MAPPING_NAMES)
TF_MODEL_FOR_PRETRAINING_MAPPING = _LazyAutoMapping(CONFIG_MAPPING_NAMES, TF_MODEL_FOR_PRETRAINING_MAPPING_NAMES)
TF_MODEL_WITH_LM_HEAD_MAPPING = _LazyAutoMapping(CONFIG_MAPPING_NAMES, TF_MODEL_WITH_LM_HEAD_MAPPING_NAMES)
TF_MODEL_FOR_CAUSAL_LM_MAPPING = _LazyAutoMapping(CONFIG_MAPPING_NAMES, TF_MODEL_FOR_CAUSAL_LM_MAPPING_NAMES)
TF_MODEL_FOR_MASKED_IMAGE_MODELING_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, TF_MODEL_FOR_MASKED_IMAGE_MODELING_MAPPING_NAMES
)
TF_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, TF_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING_NAMES
)
TF_MODEL_FOR_ZERO_SHOT_IMAGE_CLASSIFICATION_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, TF_MODEL_FOR_ZERO_SHOT_IMAGE_CLASSIFICATION_MAPPING_NAMES
)
TF_MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, TF_MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING_NAMES
)
TF_MODEL_FOR_VISION_2_SEQ_MAPPING = _LazyAutoMapping(CONFIG_MAPPING_NAMES, TF_MODEL_FOR_VISION_2_SEQ_MAPPING_NAMES)
TF_MODEL_FOR_MASKED_LM_MAPPING = _LazyAutoMapping(CONFIG_MAPPING_NAMES, TF_MODEL_FOR_MASKED_LM_MAPPING_NAMES)
TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING_NAMES
)
TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING_NAMES
)
TF_MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, TF_MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING_NAMES
)
TF_MODEL_FOR_QUESTION_ANSWERING_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, TF_MODEL_FOR_QUESTION_ANSWERING_MAPPING_NAMES
)
TF_MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, TF_MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING_NAMES
)
TF_MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, TF_MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING_NAMES
)
TF_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, TF_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING_NAMES
)
TF_MODEL_FOR_MULTIPLE_CHOICE_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, TF_MODEL_FOR_MULTIPLE_CHOICE_MAPPING_NAMES
)
TF_MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, TF_MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING_NAMES
)
TF_MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, TF_MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING_NAMES
)

TF_MODEL_FOR_MASK_GENERATION_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, TF_MODEL_FOR_MASK_GENERATION_MAPPING_NAMES
)

TF_MODEL_FOR_TEXT_ENCODING_MAPPING = _LazyAutoMapping(CONFIG_MAPPING_NAMES, TF_MODEL_FOR_TEXT_ENCODING_MAPPING_NAMES)


class TFAutoModelForMaskGeneration(_BaseAutoModelClass):
    _model_mapping = TF_MODEL_FOR_MASK_GENERATION_MAPPING


class TFAutoModelForTextEncoding(_BaseAutoModelClass):
    _model_mapping = TF_MODEL_FOR_TEXT_ENCODING_MAPPING


class TFAutoModel(_BaseAutoModelClass):
    _model_mapping = TF_MODEL_MAPPING


TFAutoModel = auto_class_update(TFAutoModel)


class TFAutoModelForAudioClassification(_BaseAutoModelClass):
    _model_mapping = TF_MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING


TFAutoModelForAudioClassification = auto_class_update(
    TFAutoModelForAudioClassification, head_doc="audio classification"
)


class TFAutoModelForPreTraining(_BaseAutoModelClass):
    _model_mapping = TF_MODEL_FOR_PRETRAINING_MAPPING


TFAutoModelForPreTraining = auto_class_update(TFAutoModelForPreTraining, head_doc="pretraining")



class _TFAutoModelWithLMHead(_BaseAutoModelClass):
    _model_mapping = TF_MODEL_WITH_LM_HEAD_MAPPING


_TFAutoModelWithLMHead = auto_class_update(_TFAutoModelWithLMHead, head_doc="language modeling")


class TFAutoModelForCausalLM(_BaseAutoModelClass):
    _model_mapping = TF_MODEL_FOR_CAUSAL_LM_MAPPING


TFAutoModelForCausalLM = auto_class_update(TFAutoModelForCausalLM, head_doc="causal language modeling")


class TFAutoModelForMaskedImageModeling(_BaseAutoModelClass):
    _model_mapping = TF_MODEL_FOR_MASKED_IMAGE_MODELING_MAPPING


TFAutoModelForMaskedImageModeling = auto_class_update(
    TFAutoModelForMaskedImageModeling, head_doc="masked image modeling"
)


class TFAutoModelForImageClassification(_BaseAutoModelClass):
    _model_mapping = TF_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING


TFAutoModelForImageClassification = auto_class_update(
    TFAutoModelForImageClassification, head_doc="image classification"
)


class TFAutoModelForZeroShotImageClassification(_BaseAutoModelClass):
    _model_mapping = TF_MODEL_FOR_ZERO_SHOT_IMAGE_CLASSIFICATION_MAPPING


TFAutoModelForZeroShotImageClassification = auto_class_update(
    TFAutoModelForZeroShotImageClassification, head_doc="zero-shot image classification"
)


class TFAutoModelForSemanticSegmentation(_BaseAutoModelClass):
    _model_mapping = TF_MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING


TFAutoModelForSemanticSegmentation = auto_class_update(
    TFAutoModelForSemanticSegmentation, head_doc="semantic segmentation"
)


class TFAutoModelForVision2Seq(_BaseAutoModelClass):
    _model_mapping = TF_MODEL_FOR_VISION_2_SEQ_MAPPING


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


class TFAutoModelForMaskedLM(_BaseAutoModelClass):
    _model_mapping = TF_MODEL_FOR_MASKED_LM_MAPPING


TFAutoModelForMaskedLM = auto_class_update(TFAutoModelForMaskedLM, head_doc="masked language modeling")


class TFAutoModelForSeq2SeqLM(_BaseAutoModelClass):
    _model_mapping = TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING


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


class TFAutoModelForSequenceClassification(_BaseAutoModelClass):
    _model_mapping = TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING


TFAutoModelForSequenceClassification = auto_class_update(
    TFAutoModelForSequenceClassification, head_doc="sequence classification"
)


class TFAutoModelForQuestionAnswering(_BaseAutoModelClass):
    _model_mapping = TF_MODEL_FOR_QUESTION_ANSWERING_MAPPING


TFAutoModelForQuestionAnswering = auto_class_update(TFAutoModelForQuestionAnswering, head_doc="question answering")


class TFAutoModelForDocumentQuestionAnswering(_BaseAutoModelClass):
    _model_mapping = TF_MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING


TFAutoModelForDocumentQuestionAnswering = auto_class_update(
    TFAutoModelForDocumentQuestionAnswering,
    head_doc="document question answering",
    checkpoint_for_example='impira/layoutlm-document-qa", revision="52e01b3',
)


class TFAutoModelForTableQuestionAnswering(_BaseAutoModelClass):
    _model_mapping = TF_MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING


TFAutoModelForTableQuestionAnswering = auto_class_update(
    TFAutoModelForTableQuestionAnswering,
    head_doc="table question answering",
    checkpoint_for_example="google/tapas-base-finetuned-wtq",
)


class TFAutoModelForTokenClassification(_BaseAutoModelClass):
    _model_mapping = TF_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING


TFAutoModelForTokenClassification = auto_class_update(
    TFAutoModelForTokenClassification, head_doc="token classification"
)


class TFAutoModelForMultipleChoice(_BaseAutoModelClass):
    _model_mapping = TF_MODEL_FOR_MULTIPLE_CHOICE_MAPPING


TFAutoModelForMultipleChoice = auto_class_update(TFAutoModelForMultipleChoice, head_doc="multiple choice")


class TFAutoModelForNextSentencePrediction(_BaseAutoModelClass):
    _model_mapping = TF_MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING


TFAutoModelForNextSentencePrediction = auto_class_update(
    TFAutoModelForNextSentencePrediction, head_doc="next sentence prediction"
)


class TFAutoModelForSpeechSeq2Seq(_BaseAutoModelClass):
    _model_mapping = TF_MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING


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


class TFAutoModelWithLMHead(_TFAutoModelWithLMHead):
    @classmethod
    def from_config(cls, config):
        warnings.warn(
            "The class `TFAutoModelWithLMHead` is deprecated and will be removed in a future version. Please use"
            " `TFAutoModelForCausalLM` for causal language models, `TFAutoModelForMaskedLM` for masked language models"
            " and `TFAutoModelForSeq2SeqLM` for encoder-decoder models.",
            FutureWarning,
        )
        return super().from_config(config)

    @classmethod
    def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
        warnings.warn(
            "The class `TFAutoModelWithLMHead` is deprecated and will be removed in a future version. Please use"
            " `TFAutoModelForCausalLM` for causal language models, `TFAutoModelForMaskedLM` for masked language models"
            " and `TFAutoModelForSeq2SeqLM` for encoder-decoder models.",
            FutureWarning,
        )
        return super().from_pretrained(pretrained_model_name_or_path, *model_args, **kwargs)