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 baseautobackboneclass baseautomodelclass lazyautomapping autoclassupdate from configurationauto import configmappingnames logger logging getloggername modelmappingnames ordereddict base model mapping albert albertmodel align alignmodel altclip altclipmodel audiospectrogramtransformer astmodel autoformer autoformermodel bark barkmodel bart bartmodel beit beitmodel bert bertmodel bertgeneration bertgenerationencoder bigbird bigbirdmodel bigbirdpegasus bigbirdpegasusmodel biogpt biogptmodel bit bitmodel blenderbot blenderbotmodel blenderbotsmall blenderbotsmallmodel blip blipmodel blip2 blip2model bloom bloommodel bridgetower bridgetowermodel bros brosmodel camembert camembertmodel canine caninemodel chineseclip chineseclipmodel clap clapmodel clip clipmodel clipseg clipsegmodel clvp clvpmodelforconditionalgeneration codellama llamamodel codegen codegenmodel conditionaldetr conditionaldetrmodel convbert convbertmodel convnext convnextmodel convnextv2 convnextv2model cpmant cpmantmodel ctrl ctrlmodel cvt cvtmodel data2vecaudio data2vecaudiomodel data2vectext data2vectextmodel data2vecvision data2vecvisionmodel deberta debertamodel debertav2 debertav2model decisiontransformer decisiontransformermodel deformabledetr deformabledetrmodel deit deitmodel deta detamodel detr detrmodel dinat dinatmodel dinov2 dinov2model distilbert distilbertmodel donutswin donutswinmodel dpr dprquestionencoder dpt dptmodel efficientformer efficientformermodel efficientnet efficientnetmodel electra electramodel encodec encodecmodel ernie erniemodel erniem erniemmodel esm esmmodel falcon falconmodel flaubert flaubertmodel flava flavamodel fnet fnetmodel focalnet focalnetmodel fsmt fsmtmodel funnel funnelmodel funnelbasemodel git gitmodel glpn glpnmodel gptsw3 gpt2model gpt2 gpt2model gptbigcode gptbigcodemodel gptneo gptneomodel gptneox gptneoxmodel gptneoxjapanese gptneoxjapanesemodel gptj gptjmodel gptsanjapanese gptsanjapaneseforconditionalgeneration graphormer graphormermodel groupvit groupvitmodel hubert hubertmodel ibert ibertmodel idefics ideficsmodel imagegpt imagegptmodel informer informermodel jukebox jukeboxmodel kosmos2 kosmos2model layoutlm layoutlmmodel layoutlmv2 layoutlmv2model layoutlmv3 layoutlmv3model led ledmodel levit levitmodel lilt liltmodel llama llamamodel longformer longformermodel longt5 longt5model luke lukemodel lxmert lxmertmodel m2m100 m2m100model marian marianmodel markuplm markuplmmodel mask2former mask2formermodel maskformer maskformermodel maskformerswin maskformerswinmodel mbart mbartmodel mctct mctctmodel mega megamodel megatronbert megatronbertmodel mgpstr mgpstrforscenetextrecognition mistral mistralmodel mobilebert mobilebertmodel mobilenetv1 mobilenetv1model mobilenetv2 mobilenetv2model mobilevit mobilevitmodel mobilevitv2 mobilevitv2model mpnet mpnetmodel mpt mptmodel mra mramodel mt5 mt5model mvp mvpmodel nat natmodel nezha nezhamodel nllbmoe nllbmoemodel nystromformer nystromformermodel oneformer oneformermodel openllama openllamamodel openaigpt openaigptmodel opt optmodel owlv2 owlv2model owlvit owlvitmodel patchtst patchtstmodel pegasus pegasusmodel pegasusx pegasusxmodel perceiver perceivermodel persimmon persimmonmodel phi phimodel plbart plbartmodel poolformer poolformermodel prophetnet prophetnetmodel pvt pvtmodel qdqbert qdqbertmodel reformer reformermodel regnet regnetmodel rembert rembertmodel resnet resnetmodel retribert retribertmodel roberta robertamodel robertaprelayernorm robertaprelayernormmodel rocbert rocbertmodel roformer roformermodel rwkv rwkvmodel sam sammodel seamlessm4t seamlessm4tmodel seamlessm4tv2 seamlessm4tv2model segformer segformermodel sew sewmodel sewd sewdmodel speechtotext speech2textmodel speecht5 speecht5model splinter splintermodel squeezebert squeezebertmodel swiftformer swiftformermodel swin swinmodel swin2sr swin2srmodel swinv2 swinv2model switchtransformers switchtransformersmodel t5 t5model tabletransformer tabletransformermodel tapas tapasmodel timeseriestransformer timeseriestransformermodel timesformer timesformermodel timmbackbone timmbackbone trajectorytransformer trajectorytransformermodel transfoxl transfoxlmodel tvlt tvltmodel tvp tvpmodel umt5 umt5model unispeech unispeechmodel unispeechsat unispeechsatmodel univnet univnetmodel van vanmodel videomae videomaemodel vilt viltmodel visiontextdualencoder visiontextdualencodermodel visualbert visualbertmodel vit vitmodel vithybrid vithybridmodel vitmae vitmaemodel vitmsn vitmsnmodel vitdet vitdetmodel vits vitsmodel vivit vivitmodel wav2vec2 wav2vec2model wav2vec2conformer wav2vec2conformermodel wavlm wavlmmodel whisper whispermodel xclip xclipmodel xglm xglmmodel xlm xlmmodel xlmprophetnet xlmprophetnetmodel xlmroberta xlmrobertamodel xlmrobertaxl xlmrobertaxlmodel xlnet xlnetmodel xmod xmodmodel yolos yolosmodel yoso yosomodel modelforpretrainingmappingnames ordereddict model for pretraining mapping albert albertforpretraining bart bartforconditionalgeneration bert bertforpretraining bigbird bigbirdforpretraining bloom bloomforcausallm camembert camembertformaskedlm ctrl ctrllmheadmodel data2vectext data2vectextformaskedlm deberta debertaformaskedlm debertav2 debertav2formaskedlm distilbert distilbertformaskedlm electra electraforpretraining ernie ernieforpretraining flaubert flaubertwithlmheadmodel flava flavaforpretraining fnet fnetforpretraining fsmt fsmtforconditionalgeneration funnel funnelforpretraining gptsw3 gpt2lmheadmodel gpt2 gpt2lmheadmodel gptbigcode gptbigcodeforcausallm gptsanjapanese gptsanjapaneseforconditionalgeneration ibert ibertformaskedlm idefics ideficsforvisiontext2text layoutlm layoutlmformaskedlm longformer longformerformaskedlm luke lukeformaskedlm lxmert lxmertforpretraining mega megaformaskedlm megatronbert megatronbertforpretraining mobilebert mobilebertforpretraining mpnet mpnetformaskedlm mpt mptforcausallm mra mraformaskedlm mvp mvpforconditionalgeneration nezha nezhaforpretraining nllbmoe nllbmoeforconditionalgeneration openaigpt openaigptlmheadmodel retribert retribertmodel roberta robertaformaskedlm robertaprelayernorm robertaprelayernormformaskedlm rocbert rocbertforpretraining rwkv rwkvforcausallm splinter splinterforpretraining squeezebert squeezebertformaskedlm switchtransformers switchtransformersforconditionalgeneration t5 t5forconditionalgeneration tapas tapasformaskedlm transfoxl transfoxllmheadmodel tvlt tvltforpretraining unispeech unispeechforpretraining unispeechsat unispeechsatforpretraining videomae videomaeforpretraining visualbert visualbertforpretraining vitmae vitmaeforpretraining wav2vec2 wav2vec2forpretraining wav2vec2conformer wav2vec2conformerforpretraining xlm xlmwithlmheadmodel xlmroberta xlmrobertaformaskedlm xlmrobertaxl xlmrobertaxlformaskedlm xlnet xlnetlmheadmodel xmod xmodformaskedlm modelwithlmheadmappingnames ordereddict model with lm heads mapping albert albertformaskedlm bart bartforconditionalgeneration bert bertformaskedlm bigbird bigbirdformaskedlm bigbirdpegasus bigbirdpegasusforconditionalgeneration blenderbotsmall blenderbotsmallforconditionalgeneration bloom bloomforcausallm camembert camembertformaskedlm codegen codegenforcausallm convbert convbertformaskedlm cpmant cpmantforcausallm ctrl ctrllmheadmodel data2vectext data2vectextformaskedlm deberta debertaformaskedlm debertav2 debertav2formaskedlm distilbert distilbertformaskedlm electra electraformaskedlm encoderdecoder encoderdecodermodel ernie ernieformaskedlm esm esmformaskedlm flaubert flaubertwithlmheadmodel fnet fnetformaskedlm fsmt fsmtforconditionalgeneration funnel funnelformaskedlm git gitforcausallm gptsw3 gpt2lmheadmodel gpt2 gpt2lmheadmodel gptbigcode gptbigcodeforcausallm gptneo gptneoforcausallm gptneox gptneoxforcausallm gptneoxjapanese gptneoxjapaneseforcausallm gptj gptjforcausallm gptsanjapanese gptsanjapaneseforconditionalgeneration ibert ibertformaskedlm layoutlm layoutlmformaskedlm led ledforconditionalgeneration longformer longformerformaskedlm longt5 longt5forconditionalgeneration luke lukeformaskedlm m2m100 m2m100forconditionalgeneration marian marianmtmodel mega megaformaskedlm megatronbert megatronbertforcausallm mobilebert mobilebertformaskedlm mpnet mpnetformaskedlm mpt mptforcausallm mra mraformaskedlm mvp mvpforconditionalgeneration nezha nezhaformaskedlm nllbmoe nllbmoeforconditionalgeneration nystromformer nystromformerformaskedlm openaigpt openaigptlmheadmodel pegasusx pegasusxforconditionalgeneration plbart plbartforconditionalgeneration pop2piano pop2pianoforconditionalgeneration qdqbert qdqbertformaskedlm reformer reformermodelwithlmhead rembert rembertformaskedlm roberta robertaformaskedlm robertaprelayernorm robertaprelayernormformaskedlm rocbert rocbertformaskedlm roformer roformerformaskedlm rwkv rwkvforcausallm speechtotext speech2textforconditionalgeneration squeezebert squeezebertformaskedlm switchtransformers switchtransformersforconditionalgeneration t5 t5forconditionalgeneration tapas tapasformaskedlm transfoxl transfoxllmheadmodel wav2vec2 wav2vec2formaskedlm whisper whisperforconditionalgeneration xlm xlmwithlmheadmodel xlmroberta xlmrobertaformaskedlm xlmrobertaxl xlmrobertaxlformaskedlm xlnet xlnetlmheadmodel xmod xmodformaskedlm yoso yosoformaskedlm modelforcausallmmappingnames ordereddict model for causal lm mapping bart bartforcausallm bert bertlmheadmodel bertgeneration bertgenerationdecoder bigbird bigbirdforcausallm bigbirdpegasus bigbirdpegasusforcausallm biogpt biogptforcausallm blenderbot blenderbotforcausallm blenderbotsmall blenderbotsmallforcausallm bloom bloomforcausallm camembert camembertforcausallm codellama llamaforcausallm codegen codegenforcausallm cpmant cpmantforcausallm ctrl ctrllmheadmodel data2vectext data2vectextforcausallm electra electraforcausallm ernie ernieforcausallm falcon falconforcausallm fuyu fuyuforcausallm git gitforcausallm gptsw3 gpt2lmheadmodel gpt2 gpt2lmheadmodel gptbigcode gptbigcodeforcausallm gptneo gptneoforcausallm gptneox gptneoxforcausallm gptneoxjapanese gptneoxjapaneseforcausallm gptj gptjforcausallm llama llamaforcausallm marian marianforcausallm mbart mbartforcausallm mega megaforcausallm megatronbert megatronbertforcausallm mistral mistralforcausallm mpt mptforcausallm musicgen musicgenforcausallm mvp mvpforcausallm openllama openllamaforcausallm openaigpt openaigptlmheadmodel opt optforcausallm pegasus pegasusforcausallm persimmon persimmonforcausallm phi phiforcausallm plbart plbartforcausallm prophetnet prophetnetforcausallm qdqbert qdqbertlmheadmodel reformer reformermodelwithlmhead rembert rembertforcausallm roberta robertaforcausallm robertaprelayernorm robertaprelayernormforcausallm rocbert rocbertforcausallm roformer roformerforcausallm rwkv rwkvforcausallm speechtotext2 speech2text2forcausallm transfoxl transfoxllmheadmodel trocr trocrforcausallm whisper whisperforcausallm xglm xglmforcausallm xlm xlmwithlmheadmodel xlmprophetnet xlmprophetnetforcausallm xlmroberta xlmrobertaforcausallm xlmrobertaxl xlmrobertaxlforcausallm xlnet xlnetlmheadmodel xmod xmodforcausallm modelformaskedimagemodelingmappingnames ordereddict deit deitformaskedimagemodeling focalnet focalnetformaskedimagemodeling swin swinformaskedimagemodeling swinv2 swinv2formaskedimagemodeling vit vitformaskedimagemodeling modelforcausalimagemodelingmappingnames ordereddict model for causal image modeling mapping imagegpt imagegptforcausalimagemodeling modelforimageclassificationmappingnames ordereddict model for image classification mapping beit beitforimageclassification bit bitforimageclassification convnext convnextforimageclassification convnextv2 convnextv2forimageclassification cvt cvtforimageclassification data2vecvision data2vecvisionforimageclassification deit deitforimageclassification deitforimageclassificationwithteacher dinat dinatforimageclassification dinov2 dinov2forimageclassification efficientformer efficientformerforimageclassification efficientformerforimageclassificationwithteacher efficientnet efficientnetforimageclassification focalnet focalnetforimageclassification imagegpt imagegptforimageclassification levit levitforimageclassification levitforimageclassificationwithteacher mobilenetv1 mobilenetv1forimageclassification mobilenetv2 mobilenetv2forimageclassification mobilevit mobilevitforimageclassification mobilevitv2 mobilevitv2forimageclassification nat natforimageclassification perceiver perceiverforimageclassificationlearned perceiverforimageclassificationfourier perceiverforimageclassificationconvprocessing poolformer poolformerforimageclassification pvt pvtforimageclassification regnet regnetforimageclassification resnet resnetforimageclassification segformer segformerforimageclassification swiftformer swiftformerforimageclassification swin swinforimageclassification swinv2 swinv2forimageclassification van vanforimageclassification vit vitforimageclassification vithybrid vithybridforimageclassification vitmsn vitmsnforimageclassification modelforimagesegmentationmappingnames ordereddict do not add new models here this class will be deprecated in the future model for image segmentation mapping detr detrforsegmentation modelforsemanticsegmentationmappingnames ordereddict model for semantic segmentation mapping beit beitforsemanticsegmentation data2vecvision data2vecvisionforsemanticsegmentation dpt dptforsemanticsegmentation mobilenetv2 mobilenetv2forsemanticsegmentation mobilevit mobilevitforsemanticsegmentation mobilevitv2 mobilevitv2forsemanticsegmentation segformer segformerforsemanticsegmentation upernet upernetforsemanticsegmentation modelforinstancesegmentationmappingnames ordereddict model for instance segmentation mapping maskformerforinstancesegmentation can be removed from this mapping in v5 maskformer maskformerforinstancesegmentation modelforuniversalsegmentationmappingnames ordereddict model for universal segmentation mapping detr detrforsegmentation mask2former mask2formerforuniversalsegmentation maskformer maskformerforinstancesegmentation oneformer oneformerforuniversalsegmentation modelforvideoclassificationmappingnames ordereddict timesformer timesformerforvideoclassification videomae videomaeforvideoclassification vivit vivitforvideoclassification modelforvision2seqmappingnames ordereddict blip blipforconditionalgeneration blip2 blip2forconditionalgeneration git gitforcausallm instructblip instructblipforconditionalgeneration kosmos2 kosmos2forconditionalgeneration pix2struct pix2structforconditionalgeneration visionencoderdecoder visionencoderdecodermodel modelformaskedlmmappingnames ordereddict model for masked lm mapping albert albertformaskedlm bart bartforconditionalgeneration bert bertformaskedlm bigbird bigbirdformaskedlm camembert camembertformaskedlm convbert convbertformaskedlm data2vectext data2vectextformaskedlm deberta debertaformaskedlm debertav2 debertav2formaskedlm distilbert distilbertformaskedlm electra electraformaskedlm ernie ernieformaskedlm esm esmformaskedlm flaubert flaubertwithlmheadmodel fnet fnetformaskedlm funnel funnelformaskedlm ibert ibertformaskedlm layoutlm layoutlmformaskedlm longformer longformerformaskedlm luke lukeformaskedlm mbart mbartforconditionalgeneration mega megaformaskedlm megatronbert megatronbertformaskedlm mobilebert mobilebertformaskedlm mpnet mpnetformaskedlm mra mraformaskedlm mvp mvpforconditionalgeneration nezha nezhaformaskedlm nystromformer nystromformerformaskedlm perceiver perceiverformaskedlm qdqbert qdqbertformaskedlm reformer reformerformaskedlm rembert rembertformaskedlm roberta robertaformaskedlm robertaprelayernorm robertaprelayernormformaskedlm rocbert rocbertformaskedlm roformer roformerformaskedlm squeezebert squeezebertformaskedlm tapas tapasformaskedlm wav2vec2 wav2vec2formaskedlm xlm xlmwithlmheadmodel xlmroberta xlmrobertaformaskedlm xlmrobertaxl xlmrobertaxlformaskedlm xmod xmodformaskedlm yoso yosoformaskedlm modelforobjectdetectionmappingnames ordereddict model for object detection mapping conditionaldetr conditionaldetrforobjectdetection deformabledetr deformabledetrforobjectdetection deta detaforobjectdetection detr detrforobjectdetection tabletransformer tabletransformerforobjectdetection yolos yolosforobjectdetection modelforzeroshotobjectdetectionmappingnames ordereddict model for zero shot object detection mapping owlv2 owlv2forobjectdetection owlvit owlvitforobjectdetection modelfordepthestimationmappingnames ordereddict model for depth estimation mapping dpt dptfordepthestimation glpn glpnfordepthestimation modelforseqtoseqcausallmmappingnames ordereddict model for seq2seq causal lm mapping bart bartforconditionalgeneration bigbirdpegasus bigbirdpegasusforconditionalgeneration blenderbot blenderbotforconditionalgeneration blenderbotsmall blenderbotsmallforconditionalgeneration encoderdecoder encoderdecodermodel fsmt fsmtforconditionalgeneration gptsanjapanese gptsanjapaneseforconditionalgeneration led ledforconditionalgeneration longt5 longt5forconditionalgeneration m2m100 m2m100forconditionalgeneration marian marianmtmodel mbart mbartforconditionalgeneration mt5 mt5forconditionalgeneration mvp mvpforconditionalgeneration nllbmoe nllbmoeforconditionalgeneration pegasus pegasusforconditionalgeneration pegasusx pegasusxforconditionalgeneration plbart plbartforconditionalgeneration prophetnet prophetnetforconditionalgeneration seamlessm4t seamlessm4tfortexttotext seamlessm4tv2 seamlessm4tv2fortexttotext switchtransformers switchtransformersforconditionalgeneration t5 t5forconditionalgeneration umt5 umt5forconditionalgeneration xlmprophetnet xlmprophetnetforconditionalgeneration modelforspeechseq2seqmappingnames ordereddict pop2piano pop2pianoforconditionalgeneration seamlessm4t seamlessm4tforspeechtotext seamlessm4tv2 seamlessm4tv2forspeechtotext speechencoderdecoder speechencoderdecodermodel speechtotext speech2textforconditionalgeneration speecht5 speecht5forspeechtotext whisper whisperforconditionalgeneration modelforsequenceclassificationmappingnames ordereddict model for sequence classification mapping albert albertforsequenceclassification bart bartforsequenceclassification bert bertforsequenceclassification bigbird bigbirdforsequenceclassification bigbirdpegasus bigbirdpegasusforsequenceclassification biogpt biogptforsequenceclassification bloom bloomforsequenceclassification camembert camembertforsequenceclassification canine canineforsequenceclassification codellama llamaforsequenceclassification convbert convbertforsequenceclassification ctrl ctrlforsequenceclassification data2vectext data2vectextforsequenceclassification deberta debertaforsequenceclassification debertav2 debertav2forsequenceclassification distilbert distilbertforsequenceclassification electra electraforsequenceclassification ernie ernieforsequenceclassification erniem erniemforsequenceclassification esm esmforsequenceclassification falcon falconforsequenceclassification flaubert flaubertforsequenceclassification fnet fnetforsequenceclassification funnel funnelforsequenceclassification gptsw3 gpt2forsequenceclassification gpt2 gpt2forsequenceclassification gptbigcode gptbigcodeforsequenceclassification gptneo gptneoforsequenceclassification gptneox gptneoxforsequenceclassification gptj gptjforsequenceclassification ibert ibertforsequenceclassification layoutlm layoutlmforsequenceclassification layoutlmv2 layoutlmv2forsequenceclassification layoutlmv3 layoutlmv3forsequenceclassification led ledforsequenceclassification lilt liltforsequenceclassification llama llamaforsequenceclassification longformer longformerforsequenceclassification luke lukeforsequenceclassification markuplm markuplmforsequenceclassification mbart mbartforsequenceclassification mega megaforsequenceclassification megatronbert megatronbertforsequenceclassification mistral mistralforsequenceclassification mobilebert mobilebertforsequenceclassification mpnet mpnetforsequenceclassification mpt mptforsequenceclassification mra mraforsequenceclassification mt5 mt5forsequenceclassification mvp mvpforsequenceclassification nezha nezhaforsequenceclassification nystromformer nystromformerforsequenceclassification openllama openllamaforsequenceclassification openaigpt openaigptforsequenceclassification opt optforsequenceclassification perceiver perceiverforsequenceclassification persimmon persimmonforsequenceclassification phi phiforsequenceclassification plbart plbartforsequenceclassification qdqbert qdqbertforsequenceclassification reformer reformerforsequenceclassification rembert rembertforsequenceclassification roberta robertaforsequenceclassification robertaprelayernorm robertaprelayernormforsequenceclassification rocbert rocbertforsequenceclassification roformer roformerforsequenceclassification squeezebert squeezebertforsequenceclassification t5 t5forsequenceclassification tapas tapasforsequenceclassification transfoxl transfoxlforsequenceclassification umt5 umt5forsequenceclassification xlm xlmforsequenceclassification xlmroberta xlmrobertaforsequenceclassification xlmrobertaxl xlmrobertaxlforsequenceclassification xlnet xlnetforsequenceclassification xmod xmodforsequenceclassification yoso yosoforsequenceclassification modelforquestionansweringmappingnames ordereddict model for question answering mapping albert albertforquestionanswering bart bartforquestionanswering bert bertforquestionanswering bigbird bigbirdforquestionanswering bigbirdpegasus bigbirdpegasusforquestionanswering bloom bloomforquestionanswering camembert camembertforquestionanswering canine canineforquestionanswering convbert convbertforquestionanswering data2vectext data2vectextforquestionanswering deberta debertaforquestionanswering debertav2 debertav2forquestionanswering distilbert distilbertforquestionanswering electra electraforquestionanswering ernie ernieforquestionanswering erniem erniemforquestionanswering falcon falconforquestionanswering flaubert flaubertforquestionansweringsimple fnet fnetforquestionanswering funnel funnelforquestionanswering gpt2 gpt2forquestionanswering gptneo gptneoforquestionanswering gptneox gptneoxforquestionanswering gptj gptjforquestionanswering ibert ibertforquestionanswering layoutlmv2 layoutlmv2forquestionanswering layoutlmv3 layoutlmv3forquestionanswering led ledforquestionanswering lilt liltforquestionanswering longformer longformerforquestionanswering luke lukeforquestionanswering lxmert lxmertforquestionanswering markuplm markuplmforquestionanswering mbart mbartforquestionanswering mega megaforquestionanswering megatronbert megatronbertforquestionanswering mobilebert mobilebertforquestionanswering mpnet mpnetforquestionanswering mpt mptforquestionanswering mra mraforquestionanswering mt5 mt5forquestionanswering mvp mvpforquestionanswering nezha nezhaforquestionanswering nystromformer nystromformerforquestionanswering opt optforquestionanswering qdqbert qdqbertforquestionanswering reformer reformerforquestionanswering rembert rembertforquestionanswering roberta robertaforquestionanswering robertaprelayernorm robertaprelayernormforquestionanswering rocbert rocbertforquestionanswering roformer roformerforquestionanswering splinter splinterforquestionanswering squeezebert squeezebertforquestionanswering t5 t5forquestionanswering umt5 umt5forquestionanswering xlm xlmforquestionansweringsimple xlmroberta xlmrobertaforquestionanswering xlmrobertaxl xlmrobertaxlforquestionanswering xlnet xlnetforquestionansweringsimple xmod xmodforquestionanswering yoso yosoforquestionanswering modelfortablequestionansweringmappingnames ordereddict model for table question answering mapping tapas tapasforquestionanswering modelforvisualquestionansweringmappingnames ordereddict blip2 blip2forconditionalgeneration vilt viltforquestionanswering modelfordocumentquestionansweringmappingnames ordereddict layoutlm layoutlmforquestionanswering layoutlmv2 layoutlmv2forquestionanswering layoutlmv3 layoutlmv3forquestionanswering modelfortokenclassificationmappingnames ordereddict model for token classification mapping albert albertfortokenclassification bert bertfortokenclassification bigbird bigbirdfortokenclassification biogpt biogptfortokenclassification bloom bloomfortokenclassification bros brosfortokenclassification camembert camembertfortokenclassification canine caninefortokenclassification convbert convbertfortokenclassification data2vectext data2vectextfortokenclassification deberta debertafortokenclassification debertav2 debertav2fortokenclassification distilbert distilbertfortokenclassification electra electrafortokenclassification ernie erniefortokenclassification erniem erniemfortokenclassification esm esmfortokenclassification falcon falconfortokenclassification flaubert flaubertfortokenclassification fnet fnetfortokenclassification funnel funnelfortokenclassification gptsw3 gpt2fortokenclassification gpt2 gpt2fortokenclassification gptbigcode gptbigcodefortokenclassification gptneo gptneofortokenclassification gptneox gptneoxfortokenclassification ibert ibertfortokenclassification layoutlm layoutlmfortokenclassification layoutlmv2 layoutlmv2fortokenclassification layoutlmv3 layoutlmv3fortokenclassification lilt liltfortokenclassification longformer longformerfortokenclassification luke lukefortokenclassification markuplm markuplmfortokenclassification mega megafortokenclassification megatronbert megatronbertfortokenclassification mobilebert mobilebertfortokenclassification mpnet mpnetfortokenclassification mpt mptfortokenclassification mra mrafortokenclassification nezha nezhafortokenclassification nystromformer nystromformerfortokenclassification phi phifortokenclassification qdqbert qdqbertfortokenclassification rembert rembertfortokenclassification roberta robertafortokenclassification robertaprelayernorm robertaprelayernormfortokenclassification rocbert rocbertfortokenclassification roformer roformerfortokenclassification squeezebert squeezebertfortokenclassification xlm xlmfortokenclassification xlmroberta xlmrobertafortokenclassification xlmrobertaxl xlmrobertaxlfortokenclassification xlnet xlnetfortokenclassification xmod xmodfortokenclassification yoso yosofortokenclassification modelformultiplechoicemappingnames ordereddict model for multiple choice mapping albert albertformultiplechoice bert bertformultiplechoice bigbird bigbirdformultiplechoice camembert camembertformultiplechoice canine canineformultiplechoice convbert convbertformultiplechoice data2vectext data2vectextformultiplechoice debertav2 debertav2formultiplechoice distilbert distilbertformultiplechoice electra electraformultiplechoice ernie ernieformultiplechoice erniem erniemformultiplechoice flaubert flaubertformultiplechoice fnet fnetformultiplechoice funnel funnelformultiplechoice ibert ibertformultiplechoice longformer longformerformultiplechoice luke lukeformultiplechoice mega megaformultiplechoice megatronbert megatronbertformultiplechoice mobilebert mobilebertformultiplechoice mpnet mpnetformultiplechoice mra mraformultiplechoice nezha nezhaformultiplechoice nystromformer nystromformerformultiplechoice qdqbert qdqbertformultiplechoice rembert rembertformultiplechoice roberta robertaformultiplechoice robertaprelayernorm robertaprelayernormformultiplechoice rocbert rocbertformultiplechoice roformer roformerformultiplechoice squeezebert squeezebertformultiplechoice xlm xlmformultiplechoice xlmroberta xlmrobertaformultiplechoice xlmrobertaxl xlmrobertaxlformultiplechoice xlnet xlnetformultiplechoice xmod xmodformultiplechoice yoso yosoformultiplechoice modelfornextsentencepredictionmappingnames ordereddict bert bertfornextsentenceprediction ernie erniefornextsentenceprediction fnet fnetfornextsentenceprediction megatronbert megatronbertfornextsentenceprediction mobilebert mobilebertfornextsentenceprediction nezha nezhafornextsentenceprediction qdqbert qdqbertfornextsentenceprediction modelforaudioclassificationmappingnames ordereddict model for audio classification mapping audiospectrogramtransformer astforaudioclassification data2vecaudio data2vecaudioforsequenceclassification hubert hubertforsequenceclassification sew sewforsequenceclassification sewd sewdforsequenceclassification unispeech unispeechforsequenceclassification unispeechsat unispeechsatforsequenceclassification wav2vec2 wav2vec2forsequenceclassification wav2vec2conformer wav2vec2conformerforsequenceclassification wavlm wavlmforsequenceclassification whisper whisperforaudioclassification modelforctcmappingnames ordereddict model for connectionist temporal classification ctc mapping data2vecaudio data2vecaudioforctc hubert hubertforctc mctct mctctforctc sew sewforctc sewd sewdforctc unispeech unispeechforctc unispeechsat unispeechsatforctc wav2vec2 wav2vec2forctc wav2vec2conformer wav2vec2conformerforctc wavlm wavlmforctc modelforaudioframeclassificationmappingnames ordereddict model for audio classification mapping data2vecaudio data2vecaudioforaudioframeclassification unispeechsat unispeechsatforaudioframeclassification wav2vec2 wav2vec2foraudioframeclassification wav2vec2conformer wav2vec2conformerforaudioframeclassification wavlm wavlmforaudioframeclassification modelforaudioxvectormappingnames ordereddict model for audio classification mapping data2vecaudio data2vecaudioforxvector unispeechsat unispeechsatforxvector wav2vec2 wav2vec2forxvector wav2vec2conformer wav2vec2conformerforxvector wavlm wavlmforxvector modelfortexttospectrogrammappingnames ordereddict model for texttospectrogram mapping speecht5 speecht5fortexttospeech modelfortexttowaveformmappingnames ordereddict model for texttowaveform mapping bark barkmodel musicgen musicgenforconditionalgeneration seamlessm4t seamlessm4tfortexttospeech seamlessm4tv2 seamlessm4tv2fortexttospeech vits vitsmodel modelforzeroshotimageclassificationmappingnames ordereddict model for zero shot image classification mapping align alignmodel altclip altclipmodel blip blipmodel chineseclip chineseclipmodel clip clipmodel clipseg clipsegmodel modelforbackbonemappingnames ordereddict backbone mapping beit beitbackbone bit bitbackbone convnext convnextbackbone convnextv2 convnextv2backbone dinat dinatbackbone dinov2 dinov2backbone focalnet focalnetbackbone maskformerswin maskformerswinbackbone nat natbackbone resnet resnetbackbone swin swinbackbone timmbackbone timmbackbone vitdet vitdetbackbone modelformaskgenerationmappingnames ordereddict sam sammodel modelfortextencodingmappingnames ordereddict albert albertmodel bert bertmodel bigbird bigbirdmodel data2vectext data2vectextmodel deberta debertamodel debertav2 debertav2model distilbert distilbertmodel electra electramodel flaubert flaubertmodel ibert ibertmodel longformer longformermodel mobilebert mobilebertmodel mt5 mt5encodermodel nystromformer nystromformermodel reformer reformermodel rembert rembertmodel roberta robertamodel robertaprelayernorm robertaprelayernormmodel rocbert rocbertmodel roformer roformermodel squeezebert squeezebertmodel t5 t5encodermodel umt5 umt5encodermodel xlm xlmmodel xlmroberta xlmrobertamodel xlmrobertaxl xlmrobertaxlmodel modelfortimeseriesclassificationmappingnames ordereddict patchtst patchtstforclassification modelfortimeseriesregressionmappingnames ordereddict patchtst patchtstforregression modelforimagetoimagemappingnames ordereddict swin2sr swin2srforimagesuperresolution modelmapping lazyautomappingconfigmappingnames modelmappingnames modelforpretrainingmapping lazyautomappingconfigmappingnames modelforpretrainingmappingnames modelwithlmheadmapping lazyautomappingconfigmappingnames modelwithlmheadmappingnames modelforcausallmmapping lazyautomappingconfigmappingnames modelforcausallmmappingnames modelforcausalimagemodelingmapping lazyautomapping configmappingnames modelforcausalimagemodelingmappingnames modelforimageclassificationmapping lazyautomapping configmappingnames modelforimageclassificationmappingnames modelforzeroshotimageclassificationmapping lazyautomapping configmappingnames modelforzeroshotimageclassificationmappingnames modelforimagesegmentationmapping lazyautomapping configmappingnames modelforimagesegmentationmappingnames modelforsemanticsegmentationmapping lazyautomapping configmappingnames modelforsemanticsegmentationmappingnames modelforinstancesegmentationmapping lazyautomapping configmappingnames modelforinstancesegmentationmappingnames modelforuniversalsegmentationmapping lazyautomapping configmappingnames modelforuniversalsegmentationmappingnames modelforvideoclassificationmapping lazyautomapping configmappingnames modelforvideoclassificationmappingnames modelforvision2seqmapping lazyautomappingconfigmappingnames modelforvision2seqmappingnames modelforvisualquestionansweringmapping lazyautomapping configmappingnames modelforvisualquestionansweringmappingnames modelfordocumentquestionansweringmapping lazyautomapping configmappingnames modelfordocumentquestionansweringmappingnames modelformaskedlmmapping lazyautomappingconfigmappingnames modelformaskedlmmappingnames modelformaskedimagemodelingmapping lazyautomapping configmappingnames modelformaskedimagemodelingmappingnames modelforobjectdetectionmapping lazyautomappingconfigmappingnames modelforobjectdetectionmappingnames modelforzeroshotobjectdetectionmapping lazyautomapping configmappingnames modelforzeroshotobjectdetectionmappingnames modelfordepthestimationmapping lazyautomappingconfigmappingnames modelfordepthestimationmappingnames modelforseqtoseqcausallmmapping lazyautomapping configmappingnames modelforseqtoseqcausallmmappingnames modelforsequenceclassificationmapping lazyautomapping configmappingnames modelforsequenceclassificationmappingnames modelforquestionansweringmapping lazyautomapping configmappingnames modelforquestionansweringmappingnames modelfortablequestionansweringmapping lazyautomapping configmappingnames modelfortablequestionansweringmappingnames modelfortokenclassificationmapping lazyautomapping configmappingnames modelfortokenclassificationmappingnames modelformultiplechoicemapping lazyautomappingconfigmappingnames modelformultiplechoicemappingnames modelfornextsentencepredictionmapping lazyautomapping configmappingnames modelfornextsentencepredictionmappingnames modelforaudioclassificationmapping lazyautomapping configmappingnames modelforaudioclassificationmappingnames modelforctcmapping lazyautomappingconfigmappingnames modelforctcmappingnames modelforspeechseq2seqmapping lazyautomappingconfigmappingnames modelforspeechseq2seqmappingnames modelforaudioframeclassificationmapping lazyautomapping configmappingnames modelforaudioframeclassificationmappingnames modelforaudioxvectormapping lazyautomappingconfigmappingnames modelforaudioxvectormappingnames modelfortexttospectrogrammapping lazyautomapping configmappingnames modelfortexttospectrogrammappingnames modelfortexttowaveformmapping lazyautomappingconfigmappingnames modelfortexttowaveformmappingnames modelforbackbonemapping lazyautomappingconfigmappingnames modelforbackbonemappingnames modelformaskgenerationmapping lazyautomappingconfigmappingnames modelformaskgenerationmappingnames modelfortextencodingmapping lazyautomappingconfigmappingnames modelfortextencodingmappingnames modelfortimeseriesclassificationmapping lazyautomapping configmappingnames modelfortimeseriesclassificationmappingnames modelfortimeseriesregressionmapping lazyautomapping configmappingnames modelfortimeseriesregressionmappingnames modelforimagetoimagemapping lazyautomappingconfigmappingnames modelforimagetoimagemappingnames class automodelformaskgenerationbaseautomodelclass modelmapping modelformaskgenerationmapping class automodelfortextencodingbaseautomodelclass modelmapping modelfortextencodingmapping class automodelforimagetoimagebaseautomodelclass modelmapping modelforimagetoimagemapping class automodelbaseautomodelclass modelmapping modelmapping automodel autoclassupdateautomodel class automodelforpretrainingbaseautomodelclass modelmapping modelforpretrainingmapping automodelforpretraining autoclassupdateautomodelforpretraining headdocpretraining private on purpose the public class will add the deprecation warnings class automodelwithlmheadbaseautomodelclass modelmapping modelwithlmheadmapping automodelwithlmhead autoclassupdateautomodelwithlmhead headdoclanguage modeling class automodelforcausallmbaseautomodelclass modelmapping modelforcausallmmapping automodelforcausallm autoclassupdateautomodelforcausallm headdoccausal language modeling class automodelformaskedlmbaseautomodelclass modelmapping modelformaskedlmmapping automodelformaskedlm autoclassupdateautomodelformaskedlm headdocmasked language modeling class automodelforseq2seqlmbaseautomodelclass modelmapping modelforseqtoseqcausallmmapping automodelforseq2seqlm autoclassupdate automodelforseq2seqlm headdocsequencetosequence language modeling checkpointforexamplet5base class automodelforsequenceclassificationbaseautomodelclass modelmapping modelforsequenceclassificationmapping automodelforsequenceclassification autoclassupdate automodelforsequenceclassification headdocsequence classification class automodelforquestionansweringbaseautomodelclass modelmapping modelforquestionansweringmapping automodelforquestionanswering autoclassupdateautomodelforquestionanswering headdocquestion answering class automodelfortablequestionansweringbaseautomodelclass modelmapping modelfortablequestionansweringmapping automodelfortablequestionanswering autoclassupdate automodelfortablequestionanswering headdoctable question answering checkpointforexamplegoogletapasbasefinetunedwtq class automodelforvisualquestionansweringbaseautomodelclass modelmapping modelforvisualquestionansweringmapping automodelforvisualquestionanswering autoclassupdate automodelforvisualquestionanswering headdocvisual question answering checkpointforexampledandelinviltb32finetunedvqa class automodelfordocumentquestionansweringbaseautomodelclass modelmapping modelfordocumentquestionansweringmapping automodelfordocumentquestionanswering autoclassupdate automodelfordocumentquestionanswering headdocdocument question answering checkpointforexample impiralayoutlmdocumentqa revision52e01b3 class automodelfortokenclassificationbaseautomodelclass modelmapping modelfortokenclassificationmapping automodelfortokenclassification autoclassupdateautomodelfortokenclassification headdoctoken classification class automodelformultiplechoicebaseautomodelclass modelmapping modelformultiplechoicemapping automodelformultiplechoice autoclassupdateautomodelformultiplechoice headdocmultiple choice class automodelfornextsentencepredictionbaseautomodelclass modelmapping modelfornextsentencepredictionmapping automodelfornextsentenceprediction autoclassupdate automodelfornextsentenceprediction headdocnext sentence prediction class automodelforimageclassificationbaseautomodelclass modelmapping modelforimageclassificationmapping automodelforimageclassification autoclassupdateautomodelforimageclassification headdocimage classification class automodelforzeroshotimageclassificationbaseautomodelclass modelmapping modelforzeroshotimageclassificationmapping automodelforzeroshotimageclassification autoclassupdate automodelforzeroshotimageclassification headdoczeroshot image classification class automodelforimagesegmentationbaseautomodelclass modelmapping modelforimagesegmentationmapping automodelforimagesegmentation autoclassupdateautomodelforimagesegmentation headdocimage segmentation class automodelforsemanticsegmentationbaseautomodelclass modelmapping modelforsemanticsegmentationmapping automodelforsemanticsegmentation autoclassupdate automodelforsemanticsegmentation headdocsemantic segmentation class automodelforuniversalsegmentationbaseautomodelclass modelmapping modelforuniversalsegmentationmapping automodelforuniversalsegmentation autoclassupdate automodelforuniversalsegmentation headdocuniversal image segmentation class automodelforinstancesegmentationbaseautomodelclass modelmapping modelforinstancesegmentationmapping automodelforinstancesegmentation autoclassupdate automodelforinstancesegmentation headdocinstance segmentation class automodelforobjectdetectionbaseautomodelclass modelmapping modelforobjectdetectionmapping automodelforobjectdetection autoclassupdateautomodelforobjectdetection headdocobject detection class automodelforzeroshotobjectdetectionbaseautomodelclass modelmapping modelforzeroshotobjectdetectionmapping automodelforzeroshotobjectdetection autoclassupdate automodelforzeroshotobjectdetection headdoczeroshot object detection class automodelfordepthestimationbaseautomodelclass modelmapping modelfordepthestimationmapping automodelfordepthestimation autoclassupdateautomodelfordepthestimation headdocdepth estimation class automodelforvideoclassificationbaseautomodelclass modelmapping modelforvideoclassificationmapping automodelforvideoclassification autoclassupdateautomodelforvideoclassification headdocvideo classification class automodelforvision2seqbaseautomodelclass modelmapping modelforvision2seqmapping automodelforvision2seq autoclassupdateautomodelforvision2seq headdocvisiontotext modeling class automodelforaudioclassificationbaseautomodelclass modelmapping modelforaudioclassificationmapping automodelforaudioclassification autoclassupdateautomodelforaudioclassification headdocaudio classification class automodelforctcbaseautomodelclass modelmapping modelforctcmapping automodelforctc autoclassupdateautomodelforctc headdocconnectionist temporal classification class automodelforspeechseq2seqbaseautomodelclass modelmapping modelforspeechseq2seqmapping automodelforspeechseq2seq autoclassupdate automodelforspeechseq2seq headdocsequencetosequence speechtotext modeling class automodelforaudioframeclassificationbaseautomodelclass modelmapping modelforaudioframeclassificationmapping automodelforaudioframeclassification autoclassupdate automodelforaudioframeclassification headdocaudio frame token classification class automodelforaudioxvectorbaseautomodelclass modelmapping modelforaudioxvectormapping class automodelfortexttospectrogrambaseautomodelclass modelmapping modelfortexttospectrogrammapping class automodelfortexttowaveformbaseautomodelclass modelmapping modelfortexttowaveformmapping class autobackbonebaseautobackboneclass modelmapping modelforbackbonemapping automodelforaudioxvector autoclassupdateautomodelforaudioxvector headdocaudio retrieval via xvector class automodelformaskedimagemodelingbaseautomodelclass modelmapping modelformaskedimagemodelingmapping automodelformaskedimagemodeling autoclassupdateautomodelformaskedimagemodeling headdocmasked image modeling class automodelwithlmheadautomodelwithlmhead classmethod def fromconfigcls config warnings warn the class automodelwithlmhead is deprecated and will be removed in a future version please use automodelforcausallm for causal language models automodelformaskedlm for masked language models and automodelforseq2seqlm for encoderdecoder models futurewarning return super fromconfigconfig classmethod def frompretrainedcls pretrainedmodelnameorpath modelargs kwargs warnings warn the class automodelwithlmhead is deprecated and will be removed in a future version please use automodelforcausallm for causal language models automodelformaskedlm for masked language models and automodelforseq2seqlm 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 causal image modeling mapping model for image classification mapping do not add new models here this class will be deprecated in the future model for image segmentation mapping model for semantic segmentation mapping model for instance segmentation mapping maskformerforinstancesegmentation can be removed from this mapping in v5 model for universal segmentation mapping model for masked lm mapping model for object detection mapping model for zero shot object detection mapping model for depth estimation 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 model for audio classification mapping model for connectionist temporal classification ctc mapping model for audio classification mapping model for audio classification mapping model for text to spectrogram mapping model for text to waveform mapping model for zero shot image classification mapping backbone 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 _BaseAutoBackboneClass, _BaseAutoModelClass, _LazyAutoMapping, auto_class_update
from .configuration_auto import CONFIG_MAPPING_NAMES


logger = logging.get_logger(__name__)


MODEL_MAPPING_NAMES = OrderedDict(
    [
        
        ("albert", "AlbertModel"),
        ("align", "AlignModel"),
        ("altclip", "AltCLIPModel"),
        ("audio-spectrogram-transformer", "ASTModel"),
        ("autoformer", "AutoformerModel"),
        ("bark", "BarkModel"),
        ("bart", "BartModel"),
        ("beit", "BeitModel"),
        ("bert", "BertModel"),
        ("bert-generation", "BertGenerationEncoder"),
        ("big_bird", "BigBirdModel"),
        ("bigbird_pegasus", "BigBirdPegasusModel"),
        ("biogpt", "BioGptModel"),
        ("bit", "BitModel"),
        ("blenderbot", "BlenderbotModel"),
        ("blenderbot-small", "BlenderbotSmallModel"),
        ("blip", "BlipModel"),
        ("blip-2", "Blip2Model"),
        ("bloom", "BloomModel"),
        ("bridgetower", "BridgeTowerModel"),
        ("bros", "BrosModel"),
        ("camembert", "CamembertModel"),
        ("canine", "CanineModel"),
        ("chinese_clip", "ChineseCLIPModel"),
        ("clap", "ClapModel"),
        ("clip", "CLIPModel"),
        ("clipseg", "CLIPSegModel"),
        ("clvp", "ClvpModelForConditionalGeneration"),
        ("code_llama", "LlamaModel"),
        ("codegen", "CodeGenModel"),
        ("conditional_detr", "ConditionalDetrModel"),
        ("convbert", "ConvBertModel"),
        ("convnext", "ConvNextModel"),
        ("convnextv2", "ConvNextV2Model"),
        ("cpmant", "CpmAntModel"),
        ("ctrl", "CTRLModel"),
        ("cvt", "CvtModel"),
        ("data2vec-audio", "Data2VecAudioModel"),
        ("data2vec-text", "Data2VecTextModel"),
        ("data2vec-vision", "Data2VecVisionModel"),
        ("deberta", "DebertaModel"),
        ("deberta-v2", "DebertaV2Model"),
        ("decision_transformer", "DecisionTransformerModel"),
        ("deformable_detr", "DeformableDetrModel"),
        ("deit", "DeiTModel"),
        ("deta", "DetaModel"),
        ("detr", "DetrModel"),
        ("dinat", "DinatModel"),
        ("dinov2", "Dinov2Model"),
        ("distilbert", "DistilBertModel"),
        ("donut-swin", "DonutSwinModel"),
        ("dpr", "DPRQuestionEncoder"),
        ("dpt", "DPTModel"),
        ("efficientformer", "EfficientFormerModel"),
        ("efficientnet", "EfficientNetModel"),
        ("electra", "ElectraModel"),
        ("encodec", "EncodecModel"),
        ("ernie", "ErnieModel"),
        ("ernie_m", "ErnieMModel"),
        ("esm", "EsmModel"),
        ("falcon", "FalconModel"),
        ("flaubert", "FlaubertModel"),
        ("flava", "FlavaModel"),
        ("fnet", "FNetModel"),
        ("focalnet", "FocalNetModel"),
        ("fsmt", "FSMTModel"),
        ("funnel", ("FunnelModel", "FunnelBaseModel")),
        ("git", "GitModel"),
        ("glpn", "GLPNModel"),
        ("gpt-sw3", "GPT2Model"),
        ("gpt2", "GPT2Model"),
        ("gpt_bigcode", "GPTBigCodeModel"),
        ("gpt_neo", "GPTNeoModel"),
        ("gpt_neox", "GPTNeoXModel"),
        ("gpt_neox_japanese", "GPTNeoXJapaneseModel"),
        ("gptj", "GPTJModel"),
        ("gptsan-japanese", "GPTSanJapaneseForConditionalGeneration"),
        ("graphormer", "GraphormerModel"),
        ("groupvit", "GroupViTModel"),
        ("hubert", "HubertModel"),
        ("ibert", "IBertModel"),
        ("idefics", "IdeficsModel"),
        ("imagegpt", "ImageGPTModel"),
        ("informer", "InformerModel"),
        ("jukebox", "JukeboxModel"),
        ("kosmos-2", "Kosmos2Model"),
        ("layoutlm", "LayoutLMModel"),
        ("layoutlmv2", "LayoutLMv2Model"),
        ("layoutlmv3", "LayoutLMv3Model"),
        ("led", "LEDModel"),
        ("levit", "LevitModel"),
        ("lilt", "LiltModel"),
        ("llama", "LlamaModel"),
        ("longformer", "LongformerModel"),
        ("longt5", "LongT5Model"),
        ("luke", "LukeModel"),
        ("lxmert", "LxmertModel"),
        ("m2m_100", "M2M100Model"),
        ("marian", "MarianModel"),
        ("markuplm", "MarkupLMModel"),
        ("mask2former", "Mask2FormerModel"),
        ("maskformer", "MaskFormerModel"),
        ("maskformer-swin", "MaskFormerSwinModel"),
        ("mbart", "MBartModel"),
        ("mctct", "MCTCTModel"),
        ("mega", "MegaModel"),
        ("megatron-bert", "MegatronBertModel"),
        ("mgp-str", "MgpstrForSceneTextRecognition"),
        ("mistral", "MistralModel"),
        ("mobilebert", "MobileBertModel"),
        ("mobilenet_v1", "MobileNetV1Model"),
        ("mobilenet_v2", "MobileNetV2Model"),
        ("mobilevit", "MobileViTModel"),
        ("mobilevitv2", "MobileViTV2Model"),
        ("mpnet", "MPNetModel"),
        ("mpt", "MptModel"),
        ("mra", "MraModel"),
        ("mt5", "MT5Model"),
        ("mvp", "MvpModel"),
        ("nat", "NatModel"),
        ("nezha", "NezhaModel"),
        ("nllb-moe", "NllbMoeModel"),
        ("nystromformer", "NystromformerModel"),
        ("oneformer", "OneFormerModel"),
        ("open-llama", "OpenLlamaModel"),
        ("openai-gpt", "OpenAIGPTModel"),
        ("opt", "OPTModel"),
        ("owlv2", "Owlv2Model"),
        ("owlvit", "OwlViTModel"),
        ("patchtst", "PatchTSTModel"),
        ("pegasus", "PegasusModel"),
        ("pegasus_x", "PegasusXModel"),
        ("perceiver", "PerceiverModel"),
        ("persimmon", "PersimmonModel"),
        ("phi", "PhiModel"),
        ("plbart", "PLBartModel"),
        ("poolformer", "PoolFormerModel"),
        ("prophetnet", "ProphetNetModel"),
        ("pvt", "PvtModel"),
        ("qdqbert", "QDQBertModel"),
        ("reformer", "ReformerModel"),
        ("regnet", "RegNetModel"),
        ("rembert", "RemBertModel"),
        ("resnet", "ResNetModel"),
        ("retribert", "RetriBertModel"),
        ("roberta", "RobertaModel"),
        ("roberta-prelayernorm", "RobertaPreLayerNormModel"),
        ("roc_bert", "RoCBertModel"),
        ("roformer", "RoFormerModel"),
        ("rwkv", "RwkvModel"),
        ("sam", "SamModel"),
        ("seamless_m4t", "SeamlessM4TModel"),
        ("seamless_m4t_v2", "SeamlessM4Tv2Model"),
        ("segformer", "SegformerModel"),
        ("sew", "SEWModel"),
        ("sew-d", "SEWDModel"),
        ("speech_to_text", "Speech2TextModel"),
        ("speecht5", "SpeechT5Model"),
        ("splinter", "SplinterModel"),
        ("squeezebert", "SqueezeBertModel"),
        ("swiftformer", "SwiftFormerModel"),
        ("swin", "SwinModel"),
        ("swin2sr", "Swin2SRModel"),
        ("swinv2", "Swinv2Model"),
        ("switch_transformers", "SwitchTransformersModel"),
        ("t5", "T5Model"),
        ("table-transformer", "TableTransformerModel"),
        ("tapas", "TapasModel"),
        ("time_series_transformer", "TimeSeriesTransformerModel"),
        ("timesformer", "TimesformerModel"),
        ("timm_backbone", "TimmBackbone"),
        ("trajectory_transformer", "TrajectoryTransformerModel"),
        ("transfo-xl", "TransfoXLModel"),
        ("tvlt", "TvltModel"),
        ("tvp", "TvpModel"),
        ("umt5", "UMT5Model"),
        ("unispeech", "UniSpeechModel"),
        ("unispeech-sat", "UniSpeechSatModel"),
        ("univnet", "UnivNetModel"),
        ("van", "VanModel"),
        ("videomae", "VideoMAEModel"),
        ("vilt", "ViltModel"),
        ("vision-text-dual-encoder", "VisionTextDualEncoderModel"),
        ("visual_bert", "VisualBertModel"),
        ("vit", "ViTModel"),
        ("vit_hybrid", "ViTHybridModel"),
        ("vit_mae", "ViTMAEModel"),
        ("vit_msn", "ViTMSNModel"),
        ("vitdet", "VitDetModel"),
        ("vits", "VitsModel"),
        ("vivit", "VivitModel"),
        ("wav2vec2", "Wav2Vec2Model"),
        ("wav2vec2-conformer", "Wav2Vec2ConformerModel"),
        ("wavlm", "WavLMModel"),
        ("whisper", "WhisperModel"),
        ("xclip", "XCLIPModel"),
        ("xglm", "XGLMModel"),
        ("xlm", "XLMModel"),
        ("xlm-prophetnet", "XLMProphetNetModel"),
        ("xlm-roberta", "XLMRobertaModel"),
        ("xlm-roberta-xl", "XLMRobertaXLModel"),
        ("xlnet", "XLNetModel"),
        ("xmod", "XmodModel"),
        ("yolos", "YolosModel"),
        ("yoso", "YosoModel"),
    ]
)

MODEL_FOR_PRETRAINING_MAPPING_NAMES = OrderedDict(
    [
        
        ("albert", "AlbertForPreTraining"),
        ("bart", "BartForConditionalGeneration"),
        ("bert", "BertForPreTraining"),
        ("big_bird", "BigBirdForPreTraining"),
        ("bloom", "BloomForCausalLM"),
        ("camembert", "CamembertForMaskedLM"),
        ("ctrl", "CTRLLMHeadModel"),
        ("data2vec-text", "Data2VecTextForMaskedLM"),
        ("deberta", "DebertaForMaskedLM"),
        ("deberta-v2", "DebertaV2ForMaskedLM"),
        ("distilbert", "DistilBertForMaskedLM"),
        ("electra", "ElectraForPreTraining"),
        ("ernie", "ErnieForPreTraining"),
        ("flaubert", "FlaubertWithLMHeadModel"),
        ("flava", "FlavaForPreTraining"),
        ("fnet", "FNetForPreTraining"),
        ("fsmt", "FSMTForConditionalGeneration"),
        ("funnel", "FunnelForPreTraining"),
        ("gpt-sw3", "GPT2LMHeadModel"),
        ("gpt2", "GPT2LMHeadModel"),
        ("gpt_bigcode", "GPTBigCodeForCausalLM"),
        ("gptsan-japanese", "GPTSanJapaneseForConditionalGeneration"),
        ("ibert", "IBertForMaskedLM"),
        ("idefics", "IdeficsForVisionText2Text"),
        ("layoutlm", "LayoutLMForMaskedLM"),
        ("longformer", "LongformerForMaskedLM"),
        ("luke", "LukeForMaskedLM"),
        ("lxmert", "LxmertForPreTraining"),
        ("mega", "MegaForMaskedLM"),
        ("megatron-bert", "MegatronBertForPreTraining"),
        ("mobilebert", "MobileBertForPreTraining"),
        ("mpnet", "MPNetForMaskedLM"),
        ("mpt", "MptForCausalLM"),
        ("mra", "MraForMaskedLM"),
        ("mvp", "MvpForConditionalGeneration"),
        ("nezha", "NezhaForPreTraining"),
        ("nllb-moe", "NllbMoeForConditionalGeneration"),
        ("openai-gpt", "OpenAIGPTLMHeadModel"),
        ("retribert", "RetriBertModel"),
        ("roberta", "RobertaForMaskedLM"),
        ("roberta-prelayernorm", "RobertaPreLayerNormForMaskedLM"),
        ("roc_bert", "RoCBertForPreTraining"),
        ("rwkv", "RwkvForCausalLM"),
        ("splinter", "SplinterForPreTraining"),
        ("squeezebert", "SqueezeBertForMaskedLM"),
        ("switch_transformers", "SwitchTransformersForConditionalGeneration"),
        ("t5", "T5ForConditionalGeneration"),
        ("tapas", "TapasForMaskedLM"),
        ("transfo-xl", "TransfoXLLMHeadModel"),
        ("tvlt", "TvltForPreTraining"),
        ("unispeech", "UniSpeechForPreTraining"),
        ("unispeech-sat", "UniSpeechSatForPreTraining"),
        ("videomae", "VideoMAEForPreTraining"),
        ("visual_bert", "VisualBertForPreTraining"),
        ("vit_mae", "ViTMAEForPreTraining"),
        ("wav2vec2", "Wav2Vec2ForPreTraining"),
        ("wav2vec2-conformer", "Wav2Vec2ConformerForPreTraining"),
        ("xlm", "XLMWithLMHeadModel"),
        ("xlm-roberta", "XLMRobertaForMaskedLM"),
        ("xlm-roberta-xl", "XLMRobertaXLForMaskedLM"),
        ("xlnet", "XLNetLMHeadModel"),
        ("xmod", "XmodForMaskedLM"),
    ]
)

MODEL_WITH_LM_HEAD_MAPPING_NAMES = OrderedDict(
    [
        
        ("albert", "AlbertForMaskedLM"),
        ("bart", "BartForConditionalGeneration"),
        ("bert", "BertForMaskedLM"),
        ("big_bird", "BigBirdForMaskedLM"),
        ("bigbird_pegasus", "BigBirdPegasusForConditionalGeneration"),
        ("blenderbot-small", "BlenderbotSmallForConditionalGeneration"),
        ("bloom", "BloomForCausalLM"),
        ("camembert", "CamembertForMaskedLM"),
        ("codegen", "CodeGenForCausalLM"),
        ("convbert", "ConvBertForMaskedLM"),
        ("cpmant", "CpmAntForCausalLM"),
        ("ctrl", "CTRLLMHeadModel"),
        ("data2vec-text", "Data2VecTextForMaskedLM"),
        ("deberta", "DebertaForMaskedLM"),
        ("deberta-v2", "DebertaV2ForMaskedLM"),
        ("distilbert", "DistilBertForMaskedLM"),
        ("electra", "ElectraForMaskedLM"),
        ("encoder-decoder", "EncoderDecoderModel"),
        ("ernie", "ErnieForMaskedLM"),
        ("esm", "EsmForMaskedLM"),
        ("flaubert", "FlaubertWithLMHeadModel"),
        ("fnet", "FNetForMaskedLM"),
        ("fsmt", "FSMTForConditionalGeneration"),
        ("funnel", "FunnelForMaskedLM"),
        ("git", "GitForCausalLM"),
        ("gpt-sw3", "GPT2LMHeadModel"),
        ("gpt2", "GPT2LMHeadModel"),
        ("gpt_bigcode", "GPTBigCodeForCausalLM"),
        ("gpt_neo", "GPTNeoForCausalLM"),
        ("gpt_neox", "GPTNeoXForCausalLM"),
        ("gpt_neox_japanese", "GPTNeoXJapaneseForCausalLM"),
        ("gptj", "GPTJForCausalLM"),
        ("gptsan-japanese", "GPTSanJapaneseForConditionalGeneration"),
        ("ibert", "IBertForMaskedLM"),
        ("layoutlm", "LayoutLMForMaskedLM"),
        ("led", "LEDForConditionalGeneration"),
        ("longformer", "LongformerForMaskedLM"),
        ("longt5", "LongT5ForConditionalGeneration"),
        ("luke", "LukeForMaskedLM"),
        ("m2m_100", "M2M100ForConditionalGeneration"),
        ("marian", "MarianMTModel"),
        ("mega", "MegaForMaskedLM"),
        ("megatron-bert", "MegatronBertForCausalLM"),
        ("mobilebert", "MobileBertForMaskedLM"),
        ("mpnet", "MPNetForMaskedLM"),
        ("mpt", "MptForCausalLM"),
        ("mra", "MraForMaskedLM"),
        ("mvp", "MvpForConditionalGeneration"),
        ("nezha", "NezhaForMaskedLM"),
        ("nllb-moe", "NllbMoeForConditionalGeneration"),
        ("nystromformer", "NystromformerForMaskedLM"),
        ("openai-gpt", "OpenAIGPTLMHeadModel"),
        ("pegasus_x", "PegasusXForConditionalGeneration"),
        ("plbart", "PLBartForConditionalGeneration"),
        ("pop2piano", "Pop2PianoForConditionalGeneration"),
        ("qdqbert", "QDQBertForMaskedLM"),
        ("reformer", "ReformerModelWithLMHead"),
        ("rembert", "RemBertForMaskedLM"),
        ("roberta", "RobertaForMaskedLM"),
        ("roberta-prelayernorm", "RobertaPreLayerNormForMaskedLM"),
        ("roc_bert", "RoCBertForMaskedLM"),
        ("roformer", "RoFormerForMaskedLM"),
        ("rwkv", "RwkvForCausalLM"),
        ("speech_to_text", "Speech2TextForConditionalGeneration"),
        ("squeezebert", "SqueezeBertForMaskedLM"),
        ("switch_transformers", "SwitchTransformersForConditionalGeneration"),
        ("t5", "T5ForConditionalGeneration"),
        ("tapas", "TapasForMaskedLM"),
        ("transfo-xl", "TransfoXLLMHeadModel"),
        ("wav2vec2", "Wav2Vec2ForMaskedLM"),
        ("whisper", "WhisperForConditionalGeneration"),
        ("xlm", "XLMWithLMHeadModel"),
        ("xlm-roberta", "XLMRobertaForMaskedLM"),
        ("xlm-roberta-xl", "XLMRobertaXLForMaskedLM"),
        ("xlnet", "XLNetLMHeadModel"),
        ("xmod", "XmodForMaskedLM"),
        ("yoso", "YosoForMaskedLM"),
    ]
)

MODEL_FOR_CAUSAL_LM_MAPPING_NAMES = OrderedDict(
    [
        
        ("bart", "BartForCausalLM"),
        ("bert", "BertLMHeadModel"),
        ("bert-generation", "BertGenerationDecoder"),
        ("big_bird", "BigBirdForCausalLM"),
        ("bigbird_pegasus", "BigBirdPegasusForCausalLM"),
        ("biogpt", "BioGptForCausalLM"),
        ("blenderbot", "BlenderbotForCausalLM"),
        ("blenderbot-small", "BlenderbotSmallForCausalLM"),
        ("bloom", "BloomForCausalLM"),
        ("camembert", "CamembertForCausalLM"),
        ("code_llama", "LlamaForCausalLM"),
        ("codegen", "CodeGenForCausalLM"),
        ("cpmant", "CpmAntForCausalLM"),
        ("ctrl", "CTRLLMHeadModel"),
        ("data2vec-text", "Data2VecTextForCausalLM"),
        ("electra", "ElectraForCausalLM"),
        ("ernie", "ErnieForCausalLM"),
        ("falcon", "FalconForCausalLM"),
        ("fuyu", "FuyuForCausalLM"),
        ("git", "GitForCausalLM"),
        ("gpt-sw3", "GPT2LMHeadModel"),
        ("gpt2", "GPT2LMHeadModel"),
        ("gpt_bigcode", "GPTBigCodeForCausalLM"),
        ("gpt_neo", "GPTNeoForCausalLM"),
        ("gpt_neox", "GPTNeoXForCausalLM"),
        ("gpt_neox_japanese", "GPTNeoXJapaneseForCausalLM"),
        ("gptj", "GPTJForCausalLM"),
        ("llama", "LlamaForCausalLM"),
        ("marian", "MarianForCausalLM"),
        ("mbart", "MBartForCausalLM"),
        ("mega", "MegaForCausalLM"),
        ("megatron-bert", "MegatronBertForCausalLM"),
        ("mistral", "MistralForCausalLM"),
        ("mpt", "MptForCausalLM"),
        ("musicgen", "MusicgenForCausalLM"),
        ("mvp", "MvpForCausalLM"),
        ("open-llama", "OpenLlamaForCausalLM"),
        ("openai-gpt", "OpenAIGPTLMHeadModel"),
        ("opt", "OPTForCausalLM"),
        ("pegasus", "PegasusForCausalLM"),
        ("persimmon", "PersimmonForCausalLM"),
        ("phi", "PhiForCausalLM"),
        ("plbart", "PLBartForCausalLM"),
        ("prophetnet", "ProphetNetForCausalLM"),
        ("qdqbert", "QDQBertLMHeadModel"),
        ("reformer", "ReformerModelWithLMHead"),
        ("rembert", "RemBertForCausalLM"),
        ("roberta", "RobertaForCausalLM"),
        ("roberta-prelayernorm", "RobertaPreLayerNormForCausalLM"),
        ("roc_bert", "RoCBertForCausalLM"),
        ("roformer", "RoFormerForCausalLM"),
        ("rwkv", "RwkvForCausalLM"),
        ("speech_to_text_2", "Speech2Text2ForCausalLM"),
        ("transfo-xl", "TransfoXLLMHeadModel"),
        ("trocr", "TrOCRForCausalLM"),
        ("whisper", "WhisperForCausalLM"),
        ("xglm", "XGLMForCausalLM"),
        ("xlm", "XLMWithLMHeadModel"),
        ("xlm-prophetnet", "XLMProphetNetForCausalLM"),
        ("xlm-roberta", "XLMRobertaForCausalLM"),
        ("xlm-roberta-xl", "XLMRobertaXLForCausalLM"),
        ("xlnet", "XLNetLMHeadModel"),
        ("xmod", "XmodForCausalLM"),
    ]
)

MODEL_FOR_MASKED_IMAGE_MODELING_MAPPING_NAMES = OrderedDict(
    [
        ("deit", "DeiTForMaskedImageModeling"),
        ("focalnet", "FocalNetForMaskedImageModeling"),
        ("swin", "SwinForMaskedImageModeling"),
        ("swinv2", "Swinv2ForMaskedImageModeling"),
        ("vit", "ViTForMaskedImageModeling"),
    ]
)


MODEL_FOR_CAUSAL_IMAGE_MODELING_MAPPING_NAMES = OrderedDict(
    
    [
        ("imagegpt", "ImageGPTForCausalImageModeling"),
    ]
)

MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING_NAMES = OrderedDict(
    [
        
        ("beit", "BeitForImageClassification"),
        ("bit", "BitForImageClassification"),
        ("convnext", "ConvNextForImageClassification"),
        ("convnextv2", "ConvNextV2ForImageClassification"),
        ("cvt", "CvtForImageClassification"),
        ("data2vec-vision", "Data2VecVisionForImageClassification"),
        ("deit", ("DeiTForImageClassification", "DeiTForImageClassificationWithTeacher")),
        ("dinat", "DinatForImageClassification"),
        ("dinov2", "Dinov2ForImageClassification"),
        (
            "efficientformer",
            (
                "EfficientFormerForImageClassification",
                "EfficientFormerForImageClassificationWithTeacher",
            ),
        ),
        ("efficientnet", "EfficientNetForImageClassification"),
        ("focalnet", "FocalNetForImageClassification"),
        ("imagegpt", "ImageGPTForImageClassification"),
        ("levit", ("LevitForImageClassification", "LevitForImageClassificationWithTeacher")),
        ("mobilenet_v1", "MobileNetV1ForImageClassification"),
        ("mobilenet_v2", "MobileNetV2ForImageClassification"),
        ("mobilevit", "MobileViTForImageClassification"),
        ("mobilevitv2", "MobileViTV2ForImageClassification"),
        ("nat", "NatForImageClassification"),
        (
            "perceiver",
            (
                "PerceiverForImageClassificationLearned",
                "PerceiverForImageClassificationFourier",
                "PerceiverForImageClassificationConvProcessing",
            ),
        ),
        ("poolformer", "PoolFormerForImageClassification"),
        ("pvt", "PvtForImageClassification"),
        ("regnet", "RegNetForImageClassification"),
        ("resnet", "ResNetForImageClassification"),
        ("segformer", "SegformerForImageClassification"),
        ("swiftformer", "SwiftFormerForImageClassification"),
        ("swin", "SwinForImageClassification"),
        ("swinv2", "Swinv2ForImageClassification"),
        ("van", "VanForImageClassification"),
        ("vit", "ViTForImageClassification"),
        ("vit_hybrid", "ViTHybridForImageClassification"),
        ("vit_msn", "ViTMSNForImageClassification"),
    ]
)

MODEL_FOR_IMAGE_SEGMENTATION_MAPPING_NAMES = OrderedDict(
    [
        
        
        ("detr", "DetrForSegmentation"),
    ]
)

MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING_NAMES = OrderedDict(
    [
        
        ("beit", "BeitForSemanticSegmentation"),
        ("data2vec-vision", "Data2VecVisionForSemanticSegmentation"),
        ("dpt", "DPTForSemanticSegmentation"),
        ("mobilenet_v2", "MobileNetV2ForSemanticSegmentation"),
        ("mobilevit", "MobileViTForSemanticSegmentation"),
        ("mobilevitv2", "MobileViTV2ForSemanticSegmentation"),
        ("segformer", "SegformerForSemanticSegmentation"),
        ("upernet", "UperNetForSemanticSegmentation"),
    ]
)

MODEL_FOR_INSTANCE_SEGMENTATION_MAPPING_NAMES = OrderedDict(
    [
        
        
        ("maskformer", "MaskFormerForInstanceSegmentation"),
    ]
)

MODEL_FOR_UNIVERSAL_SEGMENTATION_MAPPING_NAMES = OrderedDict(
    [
        
        ("detr", "DetrForSegmentation"),
        ("mask2former", "Mask2FormerForUniversalSegmentation"),
        ("maskformer", "MaskFormerForInstanceSegmentation"),
        ("oneformer", "OneFormerForUniversalSegmentation"),
    ]
)

MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING_NAMES = OrderedDict(
    [
        ("timesformer", "TimesformerForVideoClassification"),
        ("videomae", "VideoMAEForVideoClassification"),
        ("vivit", "VivitForVideoClassification"),
    ]
)

MODEL_FOR_VISION_2_SEQ_MAPPING_NAMES = OrderedDict(
    [
        ("blip", "BlipForConditionalGeneration"),
        ("blip-2", "Blip2ForConditionalGeneration"),
        ("git", "GitForCausalLM"),
        ("instructblip", "InstructBlipForConditionalGeneration"),
        ("kosmos-2", "Kosmos2ForConditionalGeneration"),
        ("pix2struct", "Pix2StructForConditionalGeneration"),
        ("vision-encoder-decoder", "VisionEncoderDecoderModel"),
    ]
)

MODEL_FOR_MASKED_LM_MAPPING_NAMES = OrderedDict(
    [
        
        ("albert", "AlbertForMaskedLM"),
        ("bart", "BartForConditionalGeneration"),
        ("bert", "BertForMaskedLM"),
        ("big_bird", "BigBirdForMaskedLM"),
        ("camembert", "CamembertForMaskedLM"),
        ("convbert", "ConvBertForMaskedLM"),
        ("data2vec-text", "Data2VecTextForMaskedLM"),
        ("deberta", "DebertaForMaskedLM"),
        ("deberta-v2", "DebertaV2ForMaskedLM"),
        ("distilbert", "DistilBertForMaskedLM"),
        ("electra", "ElectraForMaskedLM"),
        ("ernie", "ErnieForMaskedLM"),
        ("esm", "EsmForMaskedLM"),
        ("flaubert", "FlaubertWithLMHeadModel"),
        ("fnet", "FNetForMaskedLM"),
        ("funnel", "FunnelForMaskedLM"),
        ("ibert", "IBertForMaskedLM"),
        ("layoutlm", "LayoutLMForMaskedLM"),
        ("longformer", "LongformerForMaskedLM"),
        ("luke", "LukeForMaskedLM"),
        ("mbart", "MBartForConditionalGeneration"),
        ("mega", "MegaForMaskedLM"),
        ("megatron-bert", "MegatronBertForMaskedLM"),
        ("mobilebert", "MobileBertForMaskedLM"),
        ("mpnet", "MPNetForMaskedLM"),
        ("mra", "MraForMaskedLM"),
        ("mvp", "MvpForConditionalGeneration"),
        ("nezha", "NezhaForMaskedLM"),
        ("nystromformer", "NystromformerForMaskedLM"),
        ("perceiver", "PerceiverForMaskedLM"),
        ("qdqbert", "QDQBertForMaskedLM"),
        ("reformer", "ReformerForMaskedLM"),
        ("rembert", "RemBertForMaskedLM"),
        ("roberta", "RobertaForMaskedLM"),
        ("roberta-prelayernorm", "RobertaPreLayerNormForMaskedLM"),
        ("roc_bert", "RoCBertForMaskedLM"),
        ("roformer", "RoFormerForMaskedLM"),
        ("squeezebert", "SqueezeBertForMaskedLM"),
        ("tapas", "TapasForMaskedLM"),
        ("wav2vec2", "Wav2Vec2ForMaskedLM"),
        ("xlm", "XLMWithLMHeadModel"),
        ("xlm-roberta", "XLMRobertaForMaskedLM"),
        ("xlm-roberta-xl", "XLMRobertaXLForMaskedLM"),
        ("xmod", "XmodForMaskedLM"),
        ("yoso", "YosoForMaskedLM"),
    ]
)

MODEL_FOR_OBJECT_DETECTION_MAPPING_NAMES = OrderedDict(
    [
        
        ("conditional_detr", "ConditionalDetrForObjectDetection"),
        ("deformable_detr", "DeformableDetrForObjectDetection"),
        ("deta", "DetaForObjectDetection"),
        ("detr", "DetrForObjectDetection"),
        ("table-transformer", "TableTransformerForObjectDetection"),
        ("yolos", "YolosForObjectDetection"),
    ]
)

MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING_NAMES = OrderedDict(
    [
        
        ("owlv2", "Owlv2ForObjectDetection"),
        ("owlvit", "OwlViTForObjectDetection"),
    ]
)

MODEL_FOR_DEPTH_ESTIMATION_MAPPING_NAMES = OrderedDict(
    [
        
        ("dpt", "DPTForDepthEstimation"),
        ("glpn", "GLPNForDepthEstimation"),
    ]
)
MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING_NAMES = OrderedDict(
    [
        
        ("bart", "BartForConditionalGeneration"),
        ("bigbird_pegasus", "BigBirdPegasusForConditionalGeneration"),
        ("blenderbot", "BlenderbotForConditionalGeneration"),
        ("blenderbot-small", "BlenderbotSmallForConditionalGeneration"),
        ("encoder-decoder", "EncoderDecoderModel"),
        ("fsmt", "FSMTForConditionalGeneration"),
        ("gptsan-japanese", "GPTSanJapaneseForConditionalGeneration"),
        ("led", "LEDForConditionalGeneration"),
        ("longt5", "LongT5ForConditionalGeneration"),
        ("m2m_100", "M2M100ForConditionalGeneration"),
        ("marian", "MarianMTModel"),
        ("mbart", "MBartForConditionalGeneration"),
        ("mt5", "MT5ForConditionalGeneration"),
        ("mvp", "MvpForConditionalGeneration"),
        ("nllb-moe", "NllbMoeForConditionalGeneration"),
        ("pegasus", "PegasusForConditionalGeneration"),
        ("pegasus_x", "PegasusXForConditionalGeneration"),
        ("plbart", "PLBartForConditionalGeneration"),
        ("prophetnet", "ProphetNetForConditionalGeneration"),
        ("seamless_m4t", "SeamlessM4TForTextToText"),
        ("seamless_m4t_v2", "SeamlessM4Tv2ForTextToText"),
        ("switch_transformers", "SwitchTransformersForConditionalGeneration"),
        ("t5", "T5ForConditionalGeneration"),
        ("umt5", "UMT5ForConditionalGeneration"),
        ("xlm-prophetnet", "XLMProphetNetForConditionalGeneration"),
    ]
)

MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING_NAMES = OrderedDict(
    [
        ("pop2piano", "Pop2PianoForConditionalGeneration"),
        ("seamless_m4t", "SeamlessM4TForSpeechToText"),
        ("seamless_m4t_v2", "SeamlessM4Tv2ForSpeechToText"),
        ("speech-encoder-decoder", "SpeechEncoderDecoderModel"),
        ("speech_to_text", "Speech2TextForConditionalGeneration"),
        ("speecht5", "SpeechT5ForSpeechToText"),
        ("whisper", "WhisperForConditionalGeneration"),
    ]
)

MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING_NAMES = OrderedDict(
    [
        
        ("albert", "AlbertForSequenceClassification"),
        ("bart", "BartForSequenceClassification"),
        ("bert", "BertForSequenceClassification"),
        ("big_bird", "BigBirdForSequenceClassification"),
        ("bigbird_pegasus", "BigBirdPegasusForSequenceClassification"),
        ("biogpt", "BioGptForSequenceClassification"),
        ("bloom", "BloomForSequenceClassification"),
        ("camembert", "CamembertForSequenceClassification"),
        ("canine", "CanineForSequenceClassification"),
        ("code_llama", "LlamaForSequenceClassification"),
        ("convbert", "ConvBertForSequenceClassification"),
        ("ctrl", "CTRLForSequenceClassification"),
        ("data2vec-text", "Data2VecTextForSequenceClassification"),
        ("deberta", "DebertaForSequenceClassification"),
        ("deberta-v2", "DebertaV2ForSequenceClassification"),
        ("distilbert", "DistilBertForSequenceClassification"),
        ("electra", "ElectraForSequenceClassification"),
        ("ernie", "ErnieForSequenceClassification"),
        ("ernie_m", "ErnieMForSequenceClassification"),
        ("esm", "EsmForSequenceClassification"),
        ("falcon", "FalconForSequenceClassification"),
        ("flaubert", "FlaubertForSequenceClassification"),
        ("fnet", "FNetForSequenceClassification"),
        ("funnel", "FunnelForSequenceClassification"),
        ("gpt-sw3", "GPT2ForSequenceClassification"),
        ("gpt2", "GPT2ForSequenceClassification"),
        ("gpt_bigcode", "GPTBigCodeForSequenceClassification"),
        ("gpt_neo", "GPTNeoForSequenceClassification"),
        ("gpt_neox", "GPTNeoXForSequenceClassification"),
        ("gptj", "GPTJForSequenceClassification"),
        ("ibert", "IBertForSequenceClassification"),
        ("layoutlm", "LayoutLMForSequenceClassification"),
        ("layoutlmv2", "LayoutLMv2ForSequenceClassification"),
        ("layoutlmv3", "LayoutLMv3ForSequenceClassification"),
        ("led", "LEDForSequenceClassification"),
        ("lilt", "LiltForSequenceClassification"),
        ("llama", "LlamaForSequenceClassification"),
        ("longformer", "LongformerForSequenceClassification"),
        ("luke", "LukeForSequenceClassification"),
        ("markuplm", "MarkupLMForSequenceClassification"),
        ("mbart", "MBartForSequenceClassification"),
        ("mega", "MegaForSequenceClassification"),
        ("megatron-bert", "MegatronBertForSequenceClassification"),
        ("mistral", "MistralForSequenceClassification"),
        ("mobilebert", "MobileBertForSequenceClassification"),
        ("mpnet", "MPNetForSequenceClassification"),
        ("mpt", "MptForSequenceClassification"),
        ("mra", "MraForSequenceClassification"),
        ("mt5", "MT5ForSequenceClassification"),
        ("mvp", "MvpForSequenceClassification"),
        ("nezha", "NezhaForSequenceClassification"),
        ("nystromformer", "NystromformerForSequenceClassification"),
        ("open-llama", "OpenLlamaForSequenceClassification"),
        ("openai-gpt", "OpenAIGPTForSequenceClassification"),
        ("opt", "OPTForSequenceClassification"),
        ("perceiver", "PerceiverForSequenceClassification"),
        ("persimmon", "PersimmonForSequenceClassification"),
        ("phi", "PhiForSequenceClassification"),
        ("plbart", "PLBartForSequenceClassification"),
        ("qdqbert", "QDQBertForSequenceClassification"),
        ("reformer", "ReformerForSequenceClassification"),
        ("rembert", "RemBertForSequenceClassification"),
        ("roberta", "RobertaForSequenceClassification"),
        ("roberta-prelayernorm", "RobertaPreLayerNormForSequenceClassification"),
        ("roc_bert", "RoCBertForSequenceClassification"),
        ("roformer", "RoFormerForSequenceClassification"),
        ("squeezebert", "SqueezeBertForSequenceClassification"),
        ("t5", "T5ForSequenceClassification"),
        ("tapas", "TapasForSequenceClassification"),
        ("transfo-xl", "TransfoXLForSequenceClassification"),
        ("umt5", "UMT5ForSequenceClassification"),
        ("xlm", "XLMForSequenceClassification"),
        ("xlm-roberta", "XLMRobertaForSequenceClassification"),
        ("xlm-roberta-xl", "XLMRobertaXLForSequenceClassification"),
        ("xlnet", "XLNetForSequenceClassification"),
        ("xmod", "XmodForSequenceClassification"),
        ("yoso", "YosoForSequenceClassification"),
    ]
)

MODEL_FOR_QUESTION_ANSWERING_MAPPING_NAMES = OrderedDict(
    [
        
        ("albert", "AlbertForQuestionAnswering"),
        ("bart", "BartForQuestionAnswering"),
        ("bert", "BertForQuestionAnswering"),
        ("big_bird", "BigBirdForQuestionAnswering"),
        ("bigbird_pegasus", "BigBirdPegasusForQuestionAnswering"),
        ("bloom", "BloomForQuestionAnswering"),
        ("camembert", "CamembertForQuestionAnswering"),
        ("canine", "CanineForQuestionAnswering"),
        ("convbert", "ConvBertForQuestionAnswering"),
        ("data2vec-text", "Data2VecTextForQuestionAnswering"),
        ("deberta", "DebertaForQuestionAnswering"),
        ("deberta-v2", "DebertaV2ForQuestionAnswering"),
        ("distilbert", "DistilBertForQuestionAnswering"),
        ("electra", "ElectraForQuestionAnswering"),
        ("ernie", "ErnieForQuestionAnswering"),
        ("ernie_m", "ErnieMForQuestionAnswering"),
        ("falcon", "FalconForQuestionAnswering"),
        ("flaubert", "FlaubertForQuestionAnsweringSimple"),
        ("fnet", "FNetForQuestionAnswering"),
        ("funnel", "FunnelForQuestionAnswering"),
        ("gpt2", "GPT2ForQuestionAnswering"),
        ("gpt_neo", "GPTNeoForQuestionAnswering"),
        ("gpt_neox", "GPTNeoXForQuestionAnswering"),
        ("gptj", "GPTJForQuestionAnswering"),
        ("ibert", "IBertForQuestionAnswering"),
        ("layoutlmv2", "LayoutLMv2ForQuestionAnswering"),
        ("layoutlmv3", "LayoutLMv3ForQuestionAnswering"),
        ("led", "LEDForQuestionAnswering"),
        ("lilt", "LiltForQuestionAnswering"),
        ("longformer", "LongformerForQuestionAnswering"),
        ("luke", "LukeForQuestionAnswering"),
        ("lxmert", "LxmertForQuestionAnswering"),
        ("markuplm", "MarkupLMForQuestionAnswering"),
        ("mbart", "MBartForQuestionAnswering"),
        ("mega", "MegaForQuestionAnswering"),
        ("megatron-bert", "MegatronBertForQuestionAnswering"),
        ("mobilebert", "MobileBertForQuestionAnswering"),
        ("mpnet", "MPNetForQuestionAnswering"),
        ("mpt", "MptForQuestionAnswering"),
        ("mra", "MraForQuestionAnswering"),
        ("mt5", "MT5ForQuestionAnswering"),
        ("mvp", "MvpForQuestionAnswering"),
        ("nezha", "NezhaForQuestionAnswering"),
        ("nystromformer", "NystromformerForQuestionAnswering"),
        ("opt", "OPTForQuestionAnswering"),
        ("qdqbert", "QDQBertForQuestionAnswering"),
        ("reformer", "ReformerForQuestionAnswering"),
        ("rembert", "RemBertForQuestionAnswering"),
        ("roberta", "RobertaForQuestionAnswering"),
        ("roberta-prelayernorm", "RobertaPreLayerNormForQuestionAnswering"),
        ("roc_bert", "RoCBertForQuestionAnswering"),
        ("roformer", "RoFormerForQuestionAnswering"),
        ("splinter", "SplinterForQuestionAnswering"),
        ("squeezebert", "SqueezeBertForQuestionAnswering"),
        ("t5", "T5ForQuestionAnswering"),
        ("umt5", "UMT5ForQuestionAnswering"),
        ("xlm", "XLMForQuestionAnsweringSimple"),
        ("xlm-roberta", "XLMRobertaForQuestionAnswering"),
        ("xlm-roberta-xl", "XLMRobertaXLForQuestionAnswering"),
        ("xlnet", "XLNetForQuestionAnsweringSimple"),
        ("xmod", "XmodForQuestionAnswering"),
        ("yoso", "YosoForQuestionAnswering"),
    ]
)

MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING_NAMES = OrderedDict(
    [
        
        ("tapas", "TapasForQuestionAnswering"),
    ]
)

MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING_NAMES = OrderedDict(
    [
        ("blip-2", "Blip2ForConditionalGeneration"),
        ("vilt", "ViltForQuestionAnswering"),
    ]
)

MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING_NAMES = OrderedDict(
    [
        ("layoutlm", "LayoutLMForQuestionAnswering"),
        ("layoutlmv2", "LayoutLMv2ForQuestionAnswering"),
        ("layoutlmv3", "LayoutLMv3ForQuestionAnswering"),
    ]
)

MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING_NAMES = OrderedDict(
    [
        
        ("albert", "AlbertForTokenClassification"),
        ("bert", "BertForTokenClassification"),
        ("big_bird", "BigBirdForTokenClassification"),
        ("biogpt", "BioGptForTokenClassification"),
        ("bloom", "BloomForTokenClassification"),
        ("bros", "BrosForTokenClassification"),
        ("camembert", "CamembertForTokenClassification"),
        ("canine", "CanineForTokenClassification"),
        ("convbert", "ConvBertForTokenClassification"),
        ("data2vec-text", "Data2VecTextForTokenClassification"),
        ("deberta", "DebertaForTokenClassification"),
        ("deberta-v2", "DebertaV2ForTokenClassification"),
        ("distilbert", "DistilBertForTokenClassification"),
        ("electra", "ElectraForTokenClassification"),
        ("ernie", "ErnieForTokenClassification"),
        ("ernie_m", "ErnieMForTokenClassification"),
        ("esm", "EsmForTokenClassification"),
        ("falcon", "FalconForTokenClassification"),
        ("flaubert", "FlaubertForTokenClassification"),
        ("fnet", "FNetForTokenClassification"),
        ("funnel", "FunnelForTokenClassification"),
        ("gpt-sw3", "GPT2ForTokenClassification"),
        ("gpt2", "GPT2ForTokenClassification"),
        ("gpt_bigcode", "GPTBigCodeForTokenClassification"),
        ("gpt_neo", "GPTNeoForTokenClassification"),
        ("gpt_neox", "GPTNeoXForTokenClassification"),
        ("ibert", "IBertForTokenClassification"),
        ("layoutlm", "LayoutLMForTokenClassification"),
        ("layoutlmv2", "LayoutLMv2ForTokenClassification"),
        ("layoutlmv3", "LayoutLMv3ForTokenClassification"),
        ("lilt", "LiltForTokenClassification"),
        ("longformer", "LongformerForTokenClassification"),
        ("luke", "LukeForTokenClassification"),
        ("markuplm", "MarkupLMForTokenClassification"),
        ("mega", "MegaForTokenClassification"),
        ("megatron-bert", "MegatronBertForTokenClassification"),
        ("mobilebert", "MobileBertForTokenClassification"),
        ("mpnet", "MPNetForTokenClassification"),
        ("mpt", "MptForTokenClassification"),
        ("mra", "MraForTokenClassification"),
        ("nezha", "NezhaForTokenClassification"),
        ("nystromformer", "NystromformerForTokenClassification"),
        ("phi", "PhiForTokenClassification"),
        ("qdqbert", "QDQBertForTokenClassification"),
        ("rembert", "RemBertForTokenClassification"),
        ("roberta", "RobertaForTokenClassification"),
        ("roberta-prelayernorm", "RobertaPreLayerNormForTokenClassification"),
        ("roc_bert", "RoCBertForTokenClassification"),
        ("roformer", "RoFormerForTokenClassification"),
        ("squeezebert", "SqueezeBertForTokenClassification"),
        ("xlm", "XLMForTokenClassification"),
        ("xlm-roberta", "XLMRobertaForTokenClassification"),
        ("xlm-roberta-xl", "XLMRobertaXLForTokenClassification"),
        ("xlnet", "XLNetForTokenClassification"),
        ("xmod", "XmodForTokenClassification"),
        ("yoso", "YosoForTokenClassification"),
    ]
)

MODEL_FOR_MULTIPLE_CHOICE_MAPPING_NAMES = OrderedDict(
    [
        
        ("albert", "AlbertForMultipleChoice"),
        ("bert", "BertForMultipleChoice"),
        ("big_bird", "BigBirdForMultipleChoice"),
        ("camembert", "CamembertForMultipleChoice"),
        ("canine", "CanineForMultipleChoice"),
        ("convbert", "ConvBertForMultipleChoice"),
        ("data2vec-text", "Data2VecTextForMultipleChoice"),
        ("deberta-v2", "DebertaV2ForMultipleChoice"),
        ("distilbert", "DistilBertForMultipleChoice"),
        ("electra", "ElectraForMultipleChoice"),
        ("ernie", "ErnieForMultipleChoice"),
        ("ernie_m", "ErnieMForMultipleChoice"),
        ("flaubert", "FlaubertForMultipleChoice"),
        ("fnet", "FNetForMultipleChoice"),
        ("funnel", "FunnelForMultipleChoice"),
        ("ibert", "IBertForMultipleChoice"),
        ("longformer", "LongformerForMultipleChoice"),
        ("luke", "LukeForMultipleChoice"),
        ("mega", "MegaForMultipleChoice"),
        ("megatron-bert", "MegatronBertForMultipleChoice"),
        ("mobilebert", "MobileBertForMultipleChoice"),
        ("mpnet", "MPNetForMultipleChoice"),
        ("mra", "MraForMultipleChoice"),
        ("nezha", "NezhaForMultipleChoice"),
        ("nystromformer", "NystromformerForMultipleChoice"),
        ("qdqbert", "QDQBertForMultipleChoice"),
        ("rembert", "RemBertForMultipleChoice"),
        ("roberta", "RobertaForMultipleChoice"),
        ("roberta-prelayernorm", "RobertaPreLayerNormForMultipleChoice"),
        ("roc_bert", "RoCBertForMultipleChoice"),
        ("roformer", "RoFormerForMultipleChoice"),
        ("squeezebert", "SqueezeBertForMultipleChoice"),
        ("xlm", "XLMForMultipleChoice"),
        ("xlm-roberta", "XLMRobertaForMultipleChoice"),
        ("xlm-roberta-xl", "XLMRobertaXLForMultipleChoice"),
        ("xlnet", "XLNetForMultipleChoice"),
        ("xmod", "XmodForMultipleChoice"),
        ("yoso", "YosoForMultipleChoice"),
    ]
)

MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING_NAMES = OrderedDict(
    [
        ("bert", "BertForNextSentencePrediction"),
        ("ernie", "ErnieForNextSentencePrediction"),
        ("fnet", "FNetForNextSentencePrediction"),
        ("megatron-bert", "MegatronBertForNextSentencePrediction"),
        ("mobilebert", "MobileBertForNextSentencePrediction"),
        ("nezha", "NezhaForNextSentencePrediction"),
        ("qdqbert", "QDQBertForNextSentencePrediction"),
    ]
)

MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING_NAMES = OrderedDict(
    [
        
        ("audio-spectrogram-transformer", "ASTForAudioClassification"),
        ("data2vec-audio", "Data2VecAudioForSequenceClassification"),
        ("hubert", "HubertForSequenceClassification"),
        ("sew", "SEWForSequenceClassification"),
        ("sew-d", "SEWDForSequenceClassification"),
        ("unispeech", "UniSpeechForSequenceClassification"),
        ("unispeech-sat", "UniSpeechSatForSequenceClassification"),
        ("wav2vec2", "Wav2Vec2ForSequenceClassification"),
        ("wav2vec2-conformer", "Wav2Vec2ConformerForSequenceClassification"),
        ("wavlm", "WavLMForSequenceClassification"),
        ("whisper", "WhisperForAudioClassification"),
    ]
)

MODEL_FOR_CTC_MAPPING_NAMES = OrderedDict(
    [
        
        ("data2vec-audio", "Data2VecAudioForCTC"),
        ("hubert", "HubertForCTC"),
        ("mctct", "MCTCTForCTC"),
        ("sew", "SEWForCTC"),
        ("sew-d", "SEWDForCTC"),
        ("unispeech", "UniSpeechForCTC"),
        ("unispeech-sat", "UniSpeechSatForCTC"),
        ("wav2vec2", "Wav2Vec2ForCTC"),
        ("wav2vec2-conformer", "Wav2Vec2ConformerForCTC"),
        ("wavlm", "WavLMForCTC"),
    ]
)

MODEL_FOR_AUDIO_FRAME_CLASSIFICATION_MAPPING_NAMES = OrderedDict(
    [
        
        ("data2vec-audio", "Data2VecAudioForAudioFrameClassification"),
        ("unispeech-sat", "UniSpeechSatForAudioFrameClassification"),
        ("wav2vec2", "Wav2Vec2ForAudioFrameClassification"),
        ("wav2vec2-conformer", "Wav2Vec2ConformerForAudioFrameClassification"),
        ("wavlm", "WavLMForAudioFrameClassification"),
    ]
)

MODEL_FOR_AUDIO_XVECTOR_MAPPING_NAMES = OrderedDict(
    [
        
        ("data2vec-audio", "Data2VecAudioForXVector"),
        ("unispeech-sat", "UniSpeechSatForXVector"),
        ("wav2vec2", "Wav2Vec2ForXVector"),
        ("wav2vec2-conformer", "Wav2Vec2ConformerForXVector"),
        ("wavlm", "WavLMForXVector"),
    ]
)

MODEL_FOR_TEXT_TO_SPECTROGRAM_MAPPING_NAMES = OrderedDict(
    [
        
        ("speecht5", "SpeechT5ForTextToSpeech"),
    ]
)

MODEL_FOR_TEXT_TO_WAVEFORM_MAPPING_NAMES = OrderedDict(
    [
        
        ("bark", "BarkModel"),
        ("musicgen", "MusicgenForConditionalGeneration"),
        ("seamless_m4t", "SeamlessM4TForTextToSpeech"),
        ("seamless_m4t_v2", "SeamlessM4Tv2ForTextToSpeech"),
        ("vits", "VitsModel"),
    ]
)

MODEL_FOR_ZERO_SHOT_IMAGE_CLASSIFICATION_MAPPING_NAMES = OrderedDict(
    [
        
        ("align", "AlignModel"),
        ("altclip", "AltCLIPModel"),
        ("blip", "BlipModel"),
        ("chinese_clip", "ChineseCLIPModel"),
        ("clip", "CLIPModel"),
        ("clipseg", "CLIPSegModel"),
    ]
)

MODEL_FOR_BACKBONE_MAPPING_NAMES = OrderedDict(
    [
        
        ("beit", "BeitBackbone"),
        ("bit", "BitBackbone"),
        ("convnext", "ConvNextBackbone"),
        ("convnextv2", "ConvNextV2Backbone"),
        ("dinat", "DinatBackbone"),
        ("dinov2", "Dinov2Backbone"),
        ("focalnet", "FocalNetBackbone"),
        ("maskformer-swin", "MaskFormerSwinBackbone"),
        ("nat", "NatBackbone"),
        ("resnet", "ResNetBackbone"),
        ("swin", "SwinBackbone"),
        ("timm_backbone", "TimmBackbone"),
        ("vitdet", "VitDetBackbone"),
    ]
)

MODEL_FOR_MASK_GENERATION_MAPPING_NAMES = OrderedDict(
    [
        ("sam", "SamModel"),
    ]
)

MODEL_FOR_TEXT_ENCODING_MAPPING_NAMES = OrderedDict(
    [
        ("albert", "AlbertModel"),
        ("bert", "BertModel"),
        ("big_bird", "BigBirdModel"),
        ("data2vec-text", "Data2VecTextModel"),
        ("deberta", "DebertaModel"),
        ("deberta-v2", "DebertaV2Model"),
        ("distilbert", "DistilBertModel"),
        ("electra", "ElectraModel"),
        ("flaubert", "FlaubertModel"),
        ("ibert", "IBertModel"),
        ("longformer", "LongformerModel"),
        ("mobilebert", "MobileBertModel"),
        ("mt5", "MT5EncoderModel"),
        ("nystromformer", "NystromformerModel"),
        ("reformer", "ReformerModel"),
        ("rembert", "RemBertModel"),
        ("roberta", "RobertaModel"),
        ("roberta-prelayernorm", "RobertaPreLayerNormModel"),
        ("roc_bert", "RoCBertModel"),
        ("roformer", "RoFormerModel"),
        ("squeezebert", "SqueezeBertModel"),
        ("t5", "T5EncoderModel"),
        ("umt5", "UMT5EncoderModel"),
        ("xlm", "XLMModel"),
        ("xlm-roberta", "XLMRobertaModel"),
        ("xlm-roberta-xl", "XLMRobertaXLModel"),
    ]
)

MODEL_FOR_TIME_SERIES_CLASSIFICATION_MAPPING_NAMES = OrderedDict(
    [
        ("patchtst", "PatchTSTForClassification"),
    ]
)

MODEL_FOR_TIME_SERIES_REGRESSION_MAPPING_NAMES = OrderedDict(
    [
        ("patchtst", "PatchTSTForRegression"),
    ]
)

MODEL_FOR_IMAGE_TO_IMAGE_MAPPING_NAMES = OrderedDict(
    [
        ("swin2sr", "Swin2SRForImageSuperResolution"),
    ]
)

MODEL_MAPPING = _LazyAutoMapping(CONFIG_MAPPING_NAMES, MODEL_MAPPING_NAMES)
MODEL_FOR_PRETRAINING_MAPPING = _LazyAutoMapping(CONFIG_MAPPING_NAMES, MODEL_FOR_PRETRAINING_MAPPING_NAMES)
MODEL_WITH_LM_HEAD_MAPPING = _LazyAutoMapping(CONFIG_MAPPING_NAMES, MODEL_WITH_LM_HEAD_MAPPING_NAMES)
MODEL_FOR_CAUSAL_LM_MAPPING = _LazyAutoMapping(CONFIG_MAPPING_NAMES, MODEL_FOR_CAUSAL_LM_MAPPING_NAMES)
MODEL_FOR_CAUSAL_IMAGE_MODELING_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, MODEL_FOR_CAUSAL_IMAGE_MODELING_MAPPING_NAMES
)
MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING_NAMES
)
MODEL_FOR_ZERO_SHOT_IMAGE_CLASSIFICATION_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, MODEL_FOR_ZERO_SHOT_IMAGE_CLASSIFICATION_MAPPING_NAMES
)
MODEL_FOR_IMAGE_SEGMENTATION_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, MODEL_FOR_IMAGE_SEGMENTATION_MAPPING_NAMES
)
MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING_NAMES
)
MODEL_FOR_INSTANCE_SEGMENTATION_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, MODEL_FOR_INSTANCE_SEGMENTATION_MAPPING_NAMES
)
MODEL_FOR_UNIVERSAL_SEGMENTATION_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, MODEL_FOR_UNIVERSAL_SEGMENTATION_MAPPING_NAMES
)
MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING_NAMES
)
MODEL_FOR_VISION_2_SEQ_MAPPING = _LazyAutoMapping(CONFIG_MAPPING_NAMES, MODEL_FOR_VISION_2_SEQ_MAPPING_NAMES)
MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING_NAMES
)
MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING_NAMES
)
MODEL_FOR_MASKED_LM_MAPPING = _LazyAutoMapping(CONFIG_MAPPING_NAMES, MODEL_FOR_MASKED_LM_MAPPING_NAMES)
MODEL_FOR_MASKED_IMAGE_MODELING_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, MODEL_FOR_MASKED_IMAGE_MODELING_MAPPING_NAMES
)
MODEL_FOR_OBJECT_DETECTION_MAPPING = _LazyAutoMapping(CONFIG_MAPPING_NAMES, MODEL_FOR_OBJECT_DETECTION_MAPPING_NAMES)
MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING_NAMES
)
MODEL_FOR_DEPTH_ESTIMATION_MAPPING = _LazyAutoMapping(CONFIG_MAPPING_NAMES, MODEL_FOR_DEPTH_ESTIMATION_MAPPING_NAMES)
MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING_NAMES
)
MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING_NAMES
)
MODEL_FOR_QUESTION_ANSWERING_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, MODEL_FOR_QUESTION_ANSWERING_MAPPING_NAMES
)
MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING_NAMES
)
MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING_NAMES
)
MODEL_FOR_MULTIPLE_CHOICE_MAPPING = _LazyAutoMapping(CONFIG_MAPPING_NAMES, MODEL_FOR_MULTIPLE_CHOICE_MAPPING_NAMES)
MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING_NAMES
)
MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING_NAMES
)
MODEL_FOR_CTC_MAPPING = _LazyAutoMapping(CONFIG_MAPPING_NAMES, MODEL_FOR_CTC_MAPPING_NAMES)
MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING = _LazyAutoMapping(CONFIG_MAPPING_NAMES, MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING_NAMES)
MODEL_FOR_AUDIO_FRAME_CLASSIFICATION_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, MODEL_FOR_AUDIO_FRAME_CLASSIFICATION_MAPPING_NAMES
)
MODEL_FOR_AUDIO_XVECTOR_MAPPING = _LazyAutoMapping(CONFIG_MAPPING_NAMES, MODEL_FOR_AUDIO_XVECTOR_MAPPING_NAMES)

MODEL_FOR_TEXT_TO_SPECTROGRAM_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, MODEL_FOR_TEXT_TO_SPECTROGRAM_MAPPING_NAMES
)

MODEL_FOR_TEXT_TO_WAVEFORM_MAPPING = _LazyAutoMapping(CONFIG_MAPPING_NAMES, MODEL_FOR_TEXT_TO_WAVEFORM_MAPPING_NAMES)

MODEL_FOR_BACKBONE_MAPPING = _LazyAutoMapping(CONFIG_MAPPING_NAMES, MODEL_FOR_BACKBONE_MAPPING_NAMES)

MODEL_FOR_MASK_GENERATION_MAPPING = _LazyAutoMapping(CONFIG_MAPPING_NAMES, MODEL_FOR_MASK_GENERATION_MAPPING_NAMES)

MODEL_FOR_TEXT_ENCODING_MAPPING = _LazyAutoMapping(CONFIG_MAPPING_NAMES, MODEL_FOR_TEXT_ENCODING_MAPPING_NAMES)

MODEL_FOR_TIME_SERIES_CLASSIFICATION_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, MODEL_FOR_TIME_SERIES_CLASSIFICATION_MAPPING_NAMES
)

MODEL_FOR_TIME_SERIES_REGRESSION_MAPPING = _LazyAutoMapping(
    CONFIG_MAPPING_NAMES, MODEL_FOR_TIME_SERIES_REGRESSION_MAPPING_NAMES
)

MODEL_FOR_IMAGE_TO_IMAGE_MAPPING = _LazyAutoMapping(CONFIG_MAPPING_NAMES, MODEL_FOR_IMAGE_TO_IMAGE_MAPPING_NAMES)


class AutoModelForMaskGeneration(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_MASK_GENERATION_MAPPING


class AutoModelForTextEncoding(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_TEXT_ENCODING_MAPPING


class AutoModelForImageToImage(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_IMAGE_TO_IMAGE_MAPPING


class AutoModel(_BaseAutoModelClass):
    _model_mapping = MODEL_MAPPING


AutoModel = auto_class_update(AutoModel)


class AutoModelForPreTraining(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_PRETRAINING_MAPPING


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



class _AutoModelWithLMHead(_BaseAutoModelClass):
    _model_mapping = MODEL_WITH_LM_HEAD_MAPPING


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


class AutoModelForCausalLM(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_CAUSAL_LM_MAPPING


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


class AutoModelForMaskedLM(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_MASKED_LM_MAPPING


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


class AutoModelForSeq2SeqLM(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING


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


class AutoModelForSequenceClassification(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING


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


class AutoModelForQuestionAnswering(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_QUESTION_ANSWERING_MAPPING


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


class AutoModelForTableQuestionAnswering(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING


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


class AutoModelForVisualQuestionAnswering(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING


AutoModelForVisualQuestionAnswering = auto_class_update(
    AutoModelForVisualQuestionAnswering,
    head_doc="visual question answering",
    checkpoint_for_example="dandelin/vilt-b32-finetuned-vqa",
)


class AutoModelForDocumentQuestionAnswering(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING


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


class AutoModelForTokenClassification(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING


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


class AutoModelForMultipleChoice(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_MULTIPLE_CHOICE_MAPPING


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


class AutoModelForNextSentencePrediction(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING


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


class AutoModelForImageClassification(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING


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


class AutoModelForZeroShotImageClassification(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_ZERO_SHOT_IMAGE_CLASSIFICATION_MAPPING


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


class AutoModelForImageSegmentation(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_IMAGE_SEGMENTATION_MAPPING


AutoModelForImageSegmentation = auto_class_update(AutoModelForImageSegmentation, head_doc="image segmentation")


class AutoModelForSemanticSegmentation(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING


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


class AutoModelForUniversalSegmentation(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_UNIVERSAL_SEGMENTATION_MAPPING


AutoModelForUniversalSegmentation = auto_class_update(
    AutoModelForUniversalSegmentation, head_doc="universal image segmentation"
)


class AutoModelForInstanceSegmentation(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_INSTANCE_SEGMENTATION_MAPPING


AutoModelForInstanceSegmentation = auto_class_update(
    AutoModelForInstanceSegmentation, head_doc="instance segmentation"
)


class AutoModelForObjectDetection(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_OBJECT_DETECTION_MAPPING


AutoModelForObjectDetection = auto_class_update(AutoModelForObjectDetection, head_doc="object detection")


class AutoModelForZeroShotObjectDetection(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING


AutoModelForZeroShotObjectDetection = auto_class_update(
    AutoModelForZeroShotObjectDetection, head_doc="zero-shot object detection"
)


class AutoModelForDepthEstimation(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_DEPTH_ESTIMATION_MAPPING


AutoModelForDepthEstimation = auto_class_update(AutoModelForDepthEstimation, head_doc="depth estimation")


class AutoModelForVideoClassification(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING


AutoModelForVideoClassification = auto_class_update(AutoModelForVideoClassification, head_doc="video classification")


class AutoModelForVision2Seq(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_VISION_2_SEQ_MAPPING


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


class AutoModelForAudioClassification(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING


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


class AutoModelForCTC(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_CTC_MAPPING


AutoModelForCTC = auto_class_update(AutoModelForCTC, head_doc="connectionist temporal classification")


class AutoModelForSpeechSeq2Seq(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING


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


class AutoModelForAudioFrameClassification(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_AUDIO_FRAME_CLASSIFICATION_MAPPING


AutoModelForAudioFrameClassification = auto_class_update(
    AutoModelForAudioFrameClassification, head_doc="audio frame (token) classification"
)


class AutoModelForAudioXVector(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_AUDIO_XVECTOR_MAPPING


class AutoModelForTextToSpectrogram(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_TEXT_TO_SPECTROGRAM_MAPPING


class AutoModelForTextToWaveform(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_TEXT_TO_WAVEFORM_MAPPING


class AutoBackbone(_BaseAutoBackboneClass):
    _model_mapping = MODEL_FOR_BACKBONE_MAPPING


AutoModelForAudioXVector = auto_class_update(AutoModelForAudioXVector, head_doc="audio retrieval via x-vector")


class AutoModelForMaskedImageModeling(_BaseAutoModelClass):
    _model_mapping = MODEL_FOR_MASKED_IMAGE_MODELING_MAPPING


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


class AutoModelWithLMHead(_AutoModelWithLMHead):
    @classmethod
    def from_config(cls, config):
        warnings.warn(
            "The class `AutoModelWithLMHead` is deprecated and will be removed in a future version. Please use "
            "`AutoModelForCausalLM` for causal language models, `AutoModelForMaskedLM` for masked language models and "
            "`AutoModelForSeq2SeqLM` 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 `AutoModelWithLMHead` is deprecated and will be removed in a future version. Please use "
            "`AutoModelForCausalLM` for causal language models, `AutoModelForMaskedLM` for masked language models and "
            "`AutoModelForSeq2SeqLM` for encoder-decoder models.",
            FutureWarning,
        )
        return super().from_pretrained(pretrained_model_name_or_path, *model_args, **kwargs)