o
    iiv                     @   s  d Z ddlZddlmZ ddlmZ ddlmZmZm	Z	 ddl
mZ eeZeg d	Zeg d
Zeg dZeg dZeddgZeg dZeddgZeg dZeddgZeg dZeg dZeddgZeg dZeg dZedgZeddgZedgZeg dZ eg d Z!ed!d"gZ"ed#gZ#eg d$Z$eeeZ%eeeZ&eeeZ'eeeZ(eeeZ)eeeZ*eeeZ+eeeZ,eeeZ-eeeZ.eeeZ/eeeZ0eeeZ1eeeZ2eeeZ3eeeZ4eee Z5eee!Z6eee"Z7eeeZ8eee#Z9eee$Z:G d%d& d&eZ;G d'd( d(eZ<G d)d* d*eZ=e	e=Z=G d+d, d,eZ>e	e>d-d.Z>G d/d0 d0eZ?e	e?d1d.Z?G d2d3 d3eZ@e	e@d4d.Z@G d5d6 d6eZAe	eAd7d.ZAG d8d9 d9eZBe	eBd:d.ZBG d;d< d<eZCe	eCd=d.ZCG d>d? d?eZDe	eDd@d.ZDG dAdB dBeZEe	eEdCd.ZEG dDdE dEeZFe	eFdFd.ZFG dGdH dHeZGe	eGdId.ZGG dJdK dKeZHe	eHdLdMdNZHG dOdP dPeZIe	eIdQd.ZIG dRdS dSeZJe	eJdTd.ZJG dUdV dVeZKe	eKdWdXdNZKG dYdZ dZeZLe	eLd[d\dNZLG d]d^ d^eZMe	eMd_d.ZMG d`da daeZNe	eNdbd.ZNG dcdd ddeZOe	eOded.ZOG dfdg dgeZPe	ePdhd.ZPG didj dje@ZQg dkZRdS )lzAuto Model class.    N)OrderedDict   )logging   )_BaseAutoModelClass_LazyAutoMappingauto_class_update)CONFIG_MAPPING_NAMES)EalbertTFAlbertModel)bartTFBartModelbertTFBertModel)
blenderbotTFBlenderbotModel)blenderbot-smallTFBlenderbotSmallModelblipTFBlipModel)	camembertTFCamembertModelclipTFCLIPModelconvbertTFConvBertModel)convnextTFConvNextModel)
convnextv2TFConvNextV2Model)ctrlTFCTRLModel)cvt
TFCvtModel)data2vec-visionTFData2VecVisionModeldebertaTFDebertaModel
deberta-v2TFDebertaV2Model)deitTFDeiTModel
distilbertTFDistilBertModel)dprTFDPRQuestionEncoder)efficientformerTFEfficientFormerModelelectraTFElectraModel)esm
TFEsmModelflaubertTFFlaubertModel)funnel)TFFunnelModelTFFunnelBaseModel)gpt-sw3TFGPT2Model)gpt2rF   )gptjTFGPTJModel)groupvitTFGroupViTModel)hubertTFHubertModel)ideficsTFIdeficsModel)layoutlmTFLayoutLMModel)
layoutlmv3TFLayoutLMv3Model)led
TFLEDModel
longformerTFLongformerModel)lxmertTFLxmertModel)marianTFMarianModel)mbartTFMBartModel)mistralTFMistralModel
mobilebertTFMobileBertModel)	mobilevitTFMobileViTModel)mpnetTFMPNetModel)mt5
TFMT5Model)
openai-gptTFOpenAIGPTModel)opt
TFOPTModel)pegasusTFPegasusModel)regnetTFRegNetModelrembertTFRemBertModel)resnetTFResNetModelrobertaTFRobertaModelroberta-prelayernormTFRobertaPreLayerNormModelroformerTFRoFormerModelsam
TFSamModel)sam_vision_modelTFSamVisionModel)	segformerTFSegformerModel)speech_to_textTFSpeech2TextModel)swiftformerTFSwiftFormerModel)swinTFSwinModel)t5	TFT5Model)tapasTFTapasModel)
transfo-xlTFTransfoXLModel)zvision-text-dual-encoderTFVisionTextDualEncoderModel)vit
TFViTModel)vit_maeTFViTMAEModel)wav2vec2TFWav2Vec2Model)whisperTFWhisperModel)xglmTFXGLMModelxlm
TFXLMModelxlm-robertaTFXLMRobertaModel)xlnetTFXLNetModel))r   TFAlbertForPreTrainingr   TFBartForConditionalGeneration)r   TFBertForPreTrainingr   TFCamembertForMaskedLMr%   TFCTRLLMHeadModelr4   TFDistilBertForMaskedLM)r;   TFElectraForPreTrainingr@   TFFlaubertWithLMHeadModel)rB   TFFunnelForPreTrainingrE   TFGPT2LMHeadModelrG   r   )rN   TFIdeficsForVisionText2TextrP   TFLayoutLMForMaskedLM)rY   TFLxmertForPreTraining)rb   TFMobileBertForPreTrainingrf   TFMPNetForMaskedLMrj   TFOpenAIGPTLMHeadModelrx   TFRobertaForMaskedLMr{    TFRobertaPreLayerNormForMaskedLMr   TFT5ForConditionalGenerationr   TFTapasForMaskedLMr   TFTransfoXLLMHeadModel)r   TFViTMAEForPreTrainingr   TFXLMWithLMHeadModelr   TFXLMRobertaForMaskedLMr   TFXLNetLMHeadModel)!r   TFAlbertForMaskedLMr   r   TFBertForMaskedLMr   r   TFConvBertForMaskedLMr   r   r;   TFElectraForMaskedLMr=   TFEsmForMaskedLMr   rB   TFFunnelForMaskedLMr   r   rH   TFGPTJForCausalLMr   rT   TFLEDForConditionalGenerationrW   TFLongformerForMaskedLMr[   TFMarianMTModelrb   TFMobileBertForMaskedLMr   r   rs   TFRemBertForMaskedLMr   r   r~   TFRoFormerForMaskedLMr   %TFSpeech2TextForConditionalGenerationr   r   r   r   !TFWhisperForConditionalGenerationr   r   r   ))r   TFBertLMHeadModel)r   TFCamembertForCausalLMr   r   r   r   )r_   TFMistralForCausalLMr   )rl   TFOPTForCausalLM)rs   TFRemBertForCausalLM)rx   TFRobertaForCausalLM)r{    TFRobertaPreLayerNormForCausalLM)r~   TFRoFormerForCausalLMr   )r   TFXGLMForCausalLMr   )r   TFXLMRobertaForCausalLMr   )r1   TFDeiTForMaskedImageModeling)r   TFSwinForMaskedImageModeling))r!    TFConvNextForImageClassification)r#   "TFConvNextV2ForImageClassification)r'   TFCvtForImageClassification)r)   &TFData2VecVisionForImageClassification)r1   )TFDeiTForImageClassification'TFDeiTForImageClassificationWithTeacher)r8   )'TFEfficientFormerForImageClassification2TFEfficientFormerForImageClassificationWithTeacher)rd   !TFMobileViTForImageClassification)rp   TFRegNetForImageClassification)ru   TFResNetForImageClassification)r   !TFSegformerForImageClassification)r   #TFSwiftFormerForImageClassification)r   TFSwinForImageClassification)r   TFViTForImageClassificationr   r   ))r)   'TFData2VecVisionForSemanticSegmentation)rd   "TFMobileViTForSemanticSegmentation)r   "TFSegformerForSemanticSegmentation)r   TFBlipForConditionalGeneration)zvision-encoder-decoderTFVisionEncoderDecoderModel)r   r   r   r   )r,   TFDebertaForMaskedLM)r/   TFDebertaV2ForMaskedLMr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )
r   )r   $TFBlenderbotForConditionalGeneration)r   )TFBlenderbotSmallForConditionalGeneration)zencoder-decoderTFEncoderDecoderModelr   r   )r]   TFMBartForConditionalGeneration)rh   TFMT5ForConditionalGeneration)rn   !TFPegasusForConditionalGenerationr   r   r   ) )r   !TFAlbertForSequenceClassification)r   TFBartForSequenceClassification)r   TFBertForSequenceClassification)r   $TFCamembertForSequenceClassification)r   #TFConvBertForSequenceClassification)r%   TFCTRLForSequenceClassification)r,   "TFDebertaForSequenceClassification)r/   $TFDebertaV2ForSequenceClassification)r4   %TFDistilBertForSequenceClassification)r;   "TFElectraForSequenceClassification)r=   TFEsmForSequenceClassification)r@   #TFFlaubertForSequenceClassification)rB   !TFFunnelForSequenceClassification)rE   TFGPT2ForSequenceClassification)rG   r$  )rH   TFGPTJForSequenceClassification)rP   #TFLayoutLMForSequenceClassification)rR   %TFLayoutLMv3ForSequenceClassification)rW   %TFLongformerForSequenceClassification)r_   "TFMistralForSequenceClassification)rb   %TFMobileBertForSequenceClassification)rf    TFMPNetForSequenceClassification)rj   $TFOpenAIGPTForSequenceClassification)rs   "TFRemBertForSequenceClassification)rx   "TFRobertaForSequenceClassification)r{   .TFRobertaPreLayerNormForSequenceClassification)r~   #TFRoFormerForSequenceClassification)r    TFTapasForSequenceClassification)r   $TFTransfoXLForSequenceClassification)r   TFXLMForSequenceClassification)r   %TFXLMRobertaForSequenceClassification)r    TFXLNetForSequenceClassification))r   TFAlbertForQuestionAnswering)r   TFBertForQuestionAnswering)r   TFCamembertForQuestionAnswering)r   TFConvBertForQuestionAnswering)r,   TFDebertaForQuestionAnswering)r/   TFDebertaV2ForQuestionAnswering)r4    TFDistilBertForQuestionAnswering)r;   TFElectraForQuestionAnswering)r@   $TFFlaubertForQuestionAnsweringSimple)rB   TFFunnelForQuestionAnswering)rH   TFGPTJForQuestionAnsweringrR    TFLayoutLMv3ForQuestionAnswering)rW    TFLongformerForQuestionAnswering)rb    TFMobileBertForQuestionAnswering)rf   TFMPNetForQuestionAnswering)rs   TFRemBertForQuestionAnswering)rx   TFRobertaForQuestionAnswering)r{   )TFRobertaPreLayerNormForQuestionAnswering)r~   TFRoFormerForQuestionAnswering)r   TFXLMForQuestionAnsweringSimple)r    TFXLMRobertaForQuestionAnswering)r   !TFXLNetForQuestionAnsweringSimple)r   #TFWav2Vec2ForSequenceClassification)rP   TFLayoutLMForQuestionAnsweringrA  )r   TFTapasForQuestionAnswering))r   TFAlbertForTokenClassification)r   TFBertForTokenClassification)r   !TFCamembertForTokenClassification)r    TFConvBertForTokenClassification)r,   TFDebertaForTokenClassification)r/   !TFDebertaV2ForTokenClassification)r4   "TFDistilBertForTokenClassification)r;   TFElectraForTokenClassification)r=   TFEsmForTokenClassification)r@    TFFlaubertForTokenClassification)rB   TFFunnelForTokenClassification)rP    TFLayoutLMForTokenClassification)rR   "TFLayoutLMv3ForTokenClassification)rW   "TFLongformerForTokenClassification)rb   "TFMobileBertForTokenClassification)rf   TFMPNetForTokenClassification)rs   TFRemBertForTokenClassification)rx   TFRobertaForTokenClassification)r{   +TFRobertaPreLayerNormForTokenClassification)r~    TFRoFormerForTokenClassification)r   TFXLMForTokenClassification)r   "TFXLMRobertaForTokenClassification)r   TFXLNetForTokenClassification))r   TFAlbertForMultipleChoice)r   TFBertForMultipleChoice)r   TFCamembertForMultipleChoice)r   TFConvBertForMultipleChoice)r/   TFDebertaV2ForMultipleChoice)r4   TFDistilBertForMultipleChoice)r;   TFElectraForMultipleChoice)r@   TFFlaubertForMultipleChoice)rB   TFFunnelForMultipleChoice)rW   TFLongformerForMultipleChoice)rb   TFMobileBertForMultipleChoice)rf   TFMPNetForMultipleChoice)rs   TFRemBertForMultipleChoice)rx   TFRobertaForMultipleChoice)r{   &TFRobertaPreLayerNormForMultipleChoice)r~   TFRoFormerForMultipleChoice)r   TFXLMForMultipleChoice)r   TFXLMRobertaForMultipleChoice)r   TFXLNetForMultipleChoice)r   TFBertForNextSentencePrediction)rb   %TFMobileBertForNextSentencePredictionr   )r
   r   r   r+   r.   r3   r:   r?   rV   ra   )rh   TFMT5EncoderModelrr   rw   rz   r}   )r   TFT5EncoderModelr   r   c                   @      e Zd ZeZdS )TFAutoModelForMaskGenerationN)__name__
__module____qualname__$TF_MODEL_FOR_MASK_GENERATION_MAPPING_model_mapping r  r  ]/home/ubuntu/.local/lib/python3.10/site-packages/transformers/models/auto/modeling_tf_auto.pyr        r  c                   @   r~  )TFAutoModelForTextEncodingN)r  r  r  "TF_MODEL_FOR_TEXT_ENCODING_MAPPINGr  r  r  r  r  r    r  r  c                   @   r~  )TFAutoModelN)r  r  r  TF_MODEL_MAPPINGr  r  r  r  r  r    r  r  c                   @   r~  )!TFAutoModelForAudioClassificationN)r  r  r  )TF_MODEL_FOR_AUDIO_CLASSIFICATION_MAPPINGr  r  r  r  r  r  !  r  r  zaudio classification)head_docc                   @   r~  )TFAutoModelForPreTrainingN)r  r  r   TF_MODEL_FOR_PRETRAINING_MAPPINGr  r  r  r  r  r  *  r  r  pretrainingc                   @   r~  )_TFAutoModelWithLMHeadN)r  r  r  TF_MODEL_WITH_LM_HEAD_MAPPINGr  r  r  r  r  r  2  r  r  zlanguage modelingc                   @   r~  )TFAutoModelForCausalLMN)r  r  r  TF_MODEL_FOR_CAUSAL_LM_MAPPINGr  r  r  r  r  r  9  r  r  zcausal language modelingc                   @   r~  )!TFAutoModelForMaskedImageModelingN)r  r  r  *TF_MODEL_FOR_MASKED_IMAGE_MODELING_MAPPINGr  r  r  r  r  r  @  r  r  zmasked image modelingc                   @   r~  )!TFAutoModelForImageClassificationN)r  r  r  )TF_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPINGr  r  r  r  r  r  I  r  r  zimage classificationc                   @   r~  ))TFAutoModelForZeroShotImageClassificationN)r  r  r  3TF_MODEL_FOR_ZERO_SHOT_IMAGE_CLASSIFICATION_MAPPINGr  r  r  r  r  r  R  r  r  zzero-shot image classificationc                   @   r~  )"TFAutoModelForSemanticSegmentationN)r  r  r  *TF_MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPINGr  r  r  r  r  r  [  r  r  zsemantic segmentationc                   @   r~  )TFAutoModelForVision2SeqN)r  r  r  !TF_MODEL_FOR_VISION_2_SEQ_MAPPINGr  r  r  r  r  r  d  r  r  zvision-to-text modelingc                   @   r~  )TFAutoModelForMaskedLMN)r  r  r  TF_MODEL_FOR_MASKED_LM_MAPPINGr  r  r  r  r  r  k  r  r  zmasked language modelingc                   @   r~  )TFAutoModelForSeq2SeqLMN)r  r  r  )TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPINGr  r  r  r  r  r  r  r  r  z&sequence-to-sequence language modelingzgoogle-t5/t5-base)r  checkpoint_for_examplec                   @   r~  )$TFAutoModelForSequenceClassificationN)r  r  r  ,TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPINGr  r  r  r  r  r  }  r  r  zsequence classificationc                   @   r~  )TFAutoModelForQuestionAnsweringN)r  r  r  'TF_MODEL_FOR_QUESTION_ANSWERING_MAPPINGr  r  r  r  r  r    r  r  zquestion answeringc                   @   r~  )'TFAutoModelForDocumentQuestionAnsweringN)r  r  r  0TF_MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPINGr  r  r  r  r  r    r  r  zdocument question answeringz/impira/layoutlm-document-qa", revision="52e01b3c                   @   r~  )$TFAutoModelForTableQuestionAnsweringN)r  r  r  -TF_MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPINGr  r  r  r  r  r    r  r  ztable question answeringzgoogle/tapas-base-finetuned-wtqc                   @   r~  )!TFAutoModelForTokenClassificationN)r  r  r  )TF_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPINGr  r  r  r  r  r    r  r  ztoken classificationc                   @   r~  )TFAutoModelForMultipleChoiceN)r  r  r  $TF_MODEL_FOR_MULTIPLE_CHOICE_MAPPINGr  r  r  r  r  r    r  r  zmultiple choicec                   @   r~  )$TFAutoModelForNextSentencePredictionN)r  r  r  -TF_MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPINGr  r  r  r  r  r    r  r  znext sentence predictionc                   @   r~  )TFAutoModelForSpeechSeq2SeqN)r  r  r  %TF_MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPINGr  r  r  r  r  r    r  r  z,sequence-to-sequence speech-to-text modelingc                       s0   e Zd Ze fddZe fddZ  ZS )TFAutoModelWithLMHeadc                    s   t dt t |S Na  The class `TFAutoModelWithLMHead` is deprecated and will be removed in a future version. Please use `TFAutoModelForCausalLM` for causal language models, `TFAutoModelForMaskedLM` for masked language models and `TFAutoModelForSeq2SeqLM` for encoder-decoder models.)warningswarnFutureWarningsuperfrom_config)clsconfig	__class__r  r  r    s
   z!TFAutoModelWithLMHead.from_configc                    s&   t dt t j|g|R i |S r  )r  r  r  r  from_pretrained)r  pretrained_model_name_or_path
model_argskwargsr  r  r  r    s
   z%TFAutoModelWithLMHead.from_pretrained)r  r  r  classmethodr  r  __classcell__r  r  r  r  r    s
    	r  ),r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  )S__doc__r  collectionsr   utilsr   auto_factoryr   r   r   configuration_autor	   
get_loggerr  loggerTF_MODEL_MAPPING_NAMES&TF_MODEL_FOR_PRETRAINING_MAPPING_NAMES#TF_MODEL_WITH_LM_HEAD_MAPPING_NAMES$TF_MODEL_FOR_CAUSAL_LM_MAPPING_NAMES0TF_MODEL_FOR_MASKED_IMAGE_MODELING_MAPPING_NAMES/TF_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING_NAMES9TF_MODEL_FOR_ZERO_SHOT_IMAGE_CLASSIFICATION_MAPPING_NAMES0TF_MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING_NAMES'TF_MODEL_FOR_VISION_2_SEQ_MAPPING_NAMES$TF_MODEL_FOR_MASKED_LM_MAPPING_NAMES/TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING_NAMES+TF_MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING_NAMES2TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING_NAMES-TF_MODEL_FOR_QUESTION_ANSWERING_MAPPING_NAMES/TF_MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING_NAMES6TF_MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING_NAMES3TF_MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING_NAMES/TF_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING_NAMES*TF_MODEL_FOR_MULTIPLE_CHOICE_MAPPING_NAMES3TF_MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING_NAMES*TF_MODEL_FOR_MASK_GENERATION_MAPPING_NAMES(TF_MODEL_FOR_TEXT_ENCODING_MAPPING_NAMESr  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  __all__r  r  r  r  <module>   s  
K '		&







