o
    Zh                     @   s"  d Z ddlZddlZddlZddlZddlmZ ddlmZm	Z	 ddl
mZ ddlmZmZ ddlmZmZ eeZeg d	Zeg d
Zg dZeg dZdd Zdd ZG dd deZeeZG dd deZde	eee f fddZd ddZ d ddZ!G dd dZ"g dZ#dS )!zAuto Config class.    N)OrderedDict)ListUnion   )PretrainedConfig)get_class_from_dynamic_moduleresolve_trust_remote_code)CONFIG_NAMElogging(X  )albertZAlbertConfig)alignZAlignConfig)altclipZAltCLIPConfig)ariaZ
AriaConfig)	aria_textZAriaTextConfig)audio-spectrogram-transformerZ	ASTConfig)
autoformerZAutoformerConfig)
aya_visionZAyaVisionConfig)bambaZBambaConfig)barkZ
BarkConfig)bartZ
BartConfig)beitZ
BeitConfig)bertZ
BertConfig)bert-generationZBertGenerationConfig)big_birdZBigBirdConfig)bigbird_pegasusZBigBirdPegasusConfig)biogptZBioGptConfig)bitZ	BitConfig)bitnetZBitNetConfig)
blenderbotZBlenderbotConfig)blenderbot-smallZBlenderbotSmallConfig)blipZ
BlipConfig)blip-2ZBlip2Config)blip_2_qformerZBlip2QFormerConfig)bloomZBloomConfig)bridgetowerZBridgeTowerConfig)brosZ
BrosConfig)	camembertZCamembertConfig)canineZCanineConfig)	chameleonZChameleonConfig)chinese_clipZChineseCLIPConfig)chinese_clip_vision_modelZChineseCLIPVisionConfig)clapZ
ClapConfig)clipZ
CLIPConfig)clip_text_modelZCLIPTextConfig)clip_vision_modelZCLIPVisionConfig)clipsegZCLIPSegConfig)clvpZ
ClvpConfig)
code_llamaLlamaConfig)codegenZCodeGenConfig)cohereZCohereConfig)cohere2ZCohere2Config)colpaliZColPaliConfig)conditional_detrZConditionalDetrConfig)convbertZConvBertConfig)convnextZConvNextConfig)
convnextv2ZConvNextV2Config)cpmantZCpmAntConfig)csmZ	CsmConfig)ctrlZ
CTRLConfig)cvtZ	CvtConfig)d_fineZDFineConfig)dab-detrZDabDetrConfig)dacZ	DacConfig)data2vec-audioZData2VecAudioConfig)data2vec-textZData2VecTextConfig)data2vec-visionZData2VecVisionConfig)dbrxZ
DbrxConfig)debertaZDebertaConfig)
deberta-v2ZDebertaV2Config)decision_transformerZDecisionTransformerConfig)deepseek_v3ZDeepseekV3Config)deformable_detrZDeformableDetrConfig)deitZ
DeiTConfig)depth_anythingZDepthAnythingConfig)	depth_proZDepthProConfig)detaZ
DetaConfig)detrZ
DetrConfig)	diffllamaZDiffLlamaConfig)dinatZDinatConfig)dinov2ZDinov2Config)dinov2_with_registersZDinov2WithRegistersConfig)
distilbertZDistilBertConfig)
donut-swinZDonutSwinConfig)dprZ	DPRConfig)dptZ	DPTConfig)efficientformerZEfficientFormerConfig)efficientnetZEfficientNetConfig)electraZElectraConfig)emu3Z
Emu3Config)encodecZEncodecConfig)encoder-decoderZEncoderDecoderConfig)ernieZErnieConfig)ernie_mZErnieMConfig)esmZ	EsmConfig)falconZFalconConfig)falcon_mambaZFalconMambaConfig)fastspeech2_conformerZFastSpeech2ConformerConfig)flaubertZFlaubertConfig)flavaZFlavaConfig)fnetZ
FNetConfig)focalnetZFocalNetConfig)fsmtZ
FSMTConfig)funnelZFunnelConfig)fuyuZ
FuyuConfig)gemmaZGemmaConfig)gemma2ZGemma2Config)gemma3ZGemma3Config)gemma3_textZGemma3TextConfig)gitZ	GitConfig)glmZ	GlmConfig)glm4Z
Glm4Config)glpnZ
GLPNConfig)got_ocr2ZGotOcr2Config)gpt-sw3
GPT2Config)gpt2ru   )gpt_bigcodeZGPTBigCodeConfig)gpt_neoZGPTNeoConfig)gpt_neoxZGPTNeoXConfig)gpt_neox_japaneseZGPTNeoXJapaneseConfig)gptjZ
GPTJConfig)gptsan-japaneseZGPTSanJapaneseConfig)graniteZGraniteConfig)granite_speechZGraniteSpeechConfig)
granitemoeZGraniteMoeConfig)granitemoehybridZGraniteMoeHybridConfig)granitemoesharedZGraniteMoeSharedConfig)granitevisionLlavaNextConfig)
graphormerZGraphormerConfig)grounding-dinoZGroundingDinoConfig)groupvitZGroupViTConfig)heliumZHeliumConfig)hgnet_v2ZHGNetV2Config)hieraZHieraConfig)hubertZHubertConfig)ibertZIBertConfig)ideficsZIdeficsConfig)idefics2ZIdefics2Config)idefics3ZIdefics3Config)idefics3_visionZIdefics3VisionConfig)ijepaZIJepaConfig)imagegptZImageGPTConfig)informerZInformerConfig)instructblipZInstructBlipConfig)instructblipvideoZInstructBlipVideoConfig)internvlZInternVLConfig)internvl_visionZInternVLVisionConfig)jambaZJambaConfig)janusZJanusConfig)jetmoeZJetMoeConfig)jukeboxZJukeboxConfig)kosmos-2ZKosmos2Config)layoutlmZLayoutLMConfig)
layoutlmv2ZLayoutLMv2Config)
layoutlmv3ZLayoutLMv3Config)ledZ	LEDConfig)levitZLevitConfig)liltZ
LiltConfig)llamar2   )llama4ZLlama4Config)llama4_textZLlama4TextConfig)llavaZLlavaConfig)
llava_nextr   )llava_next_videoZLlavaNextVideoConfig)llava_onevisionZLlavaOnevisionConfig)
longformerZLongformerConfig)longt5ZLongT5Config)lukeZ
LukeConfig)lxmertZLxmertConfig)m2m_100ZM2M100Config)mambaZMambaConfig)mamba2ZMamba2Config)marianZMarianConfig)markuplmZMarkupLMConfig)mask2formerZMask2FormerConfig)
maskformerZMaskFormerConfig)maskformer-swinZMaskFormerSwinConfig)mbartZMBartConfig)mctctZMCTCTConfig)megaZ
MegaConfig)megatron-bertZMegatronBertConfig)mgp-strZMgpstrConfig)mimiZ
MimiConfig)mistralZMistralConfig)mistral3ZMistral3Config)mixtralZMixtralConfig)mlcdZMLCDVisionConfig)mllamaZMllamaConfig)
mobilebertZMobileBertConfig)mobilenet_v1ZMobileNetV1Config)mobilenet_v2ZMobileNetV2Config)	mobilevitZMobileViTConfig)mobilevitv2ZMobileViTV2Config)
modernbertZModernBertConfig)	moonshineZMoonshineConfig)moshiZMoshiConfig)mpnetZMPNetConfig)mptZ	MptConfig)mraZ	MraConfig)mt5Z	MT5Config)musicgenZMusicgenConfig)musicgen_melodyZMusicgenMelodyConfig)mvpZ	MvpConfig)natZ	NatConfig)nemotronZNemotronConfig)nezhaZNezhaConfig)nllb-moeZNllbMoeConfig)nougatVisionEncoderDecoderConfig)nystromformerZNystromformerConfig)olmoZ
OlmoConfig)olmo2ZOlmo2Config)olmoeZOlmoeConfig)omdet-turboZOmDetTurboConfig)	oneformerZOneFormerConfig)
open-llamaZOpenLlamaConfig)
openai-gptZOpenAIGPTConfig)optZ	OPTConfig)owlv2ZOwlv2Config)owlvitZOwlViTConfig)	paligemmaZPaliGemmaConfig)patchtsmixerZPatchTSMixerConfig)patchtstZPatchTSTConfig)pegasusZPegasusConfig)	pegasus_xZPegasusXConfig)	perceiverZPerceiverConfig)	persimmonZPersimmonConfig)phiZ	PhiConfig)phi3Z
Phi3Config)phi4_multimodalZPhi4MultimodalConfig)phimoeZPhimoeConfig)
pix2structZPix2StructConfig)pixtralZPixtralVisionConfig)plbartZPLBartConfig)
poolformerZPoolFormerConfig)	pop2pianoZPop2PianoConfig)prompt_depth_anythingZPromptDepthAnythingConfig)
prophetnetZProphetNetConfig)pvtZ	PvtConfig)pvt_v2ZPvtV2Config)qdqbertZQDQBertConfig)qwen2ZQwen2Config)qwen2_5_omniZQwen2_5OmniConfig)
qwen2_5_vlZQwen2_5_VLConfig)qwen2_5_vl_textZQwen2_5_VLTextConfig)qwen2_audioZQwen2AudioConfig)qwen2_audio_encoderZQwen2AudioEncoderConfig)	qwen2_moeZQwen2MoeConfig)qwen2_vlZQwen2VLConfig)qwen2_vl_textZQwen2VLTextConfig)qwen3ZQwen3Config)	qwen3_moeZQwen3MoeConfig)ragZ	RagConfig)realmZRealmConfig)recurrent_gemmaZRecurrentGemmaConfig)reformerZReformerConfig)regnetZRegNetConfig)rembertZRemBertConfig)resnetZResNetConfig)	retribertZRetriBertConfig)robertaZRobertaConfig)roberta-prelayernormZRobertaPreLayerNormConfig)roc_bertZRoCBertConfig)roformerZRoFormerConfig)rt_detrZRTDetrConfig)rt_detr_resnetZRTDetrResNetConfig)
rt_detr_v2ZRTDetrV2Config)rwkvZ
RwkvConfig)samZ	SamConfig)sam_hqZSamHQConfig)sam_hq_vision_modelZSamHQVisionConfig)sam_vision_modelZSamVisionConfig)seamless_m4tZSeamlessM4TConfig)seamless_m4t_v2ZSeamlessM4Tv2Config)	segformerZSegformerConfig)seggptZSegGptConfig)sewZ	SEWConfig)sew-dZ
SEWDConfig)shieldgemma2ZShieldGemma2Config)siglipZSiglipConfig)siglip2ZSiglip2Config)siglip_vision_modelZSiglipVisionConfig)smolvlmZSmolVLMConfig)smolvlm_visionZSmolVLMVisionConfig)speech-encoder-decoderZSpeechEncoderDecoderConfig)speech_to_textZSpeech2TextConfig)speech_to_text_2ZSpeech2Text2Config)speecht5ZSpeechT5Config)splinterZSplinterConfig)squeezebertZSqueezeBertConfig)stablelmZStableLmConfig)
starcoder2ZStarcoder2Config)	superglueZSuperGlueConfig)
superpointZSuperPointConfig)swiftformerZSwiftFormerConfig)swinZ
SwinConfig)swin2srZSwin2SRConfig)swinv2ZSwinv2Config)switch_transformersZSwitchTransformersConfig)t5ZT5Config)table-transformerZTableTransformerConfig)tapasZTapasConfig)textnetZTextNetConfig)time_series_transformerZTimeSeriesTransformerConfig)timesfmZTimesFmConfig)timesformerZTimesformerConfig)timm_backboneZTimmBackboneConfig)timm_wrapperZTimmWrapperConfig)trajectory_transformerZTrajectoryTransformerConfig)
transfo-xlZTransfoXLConfig)trocrZTrOCRConfig)tvltZ
TvltConfig)tvpZ	TvpConfig)udopZ
UdopConfig)umt5Z
UMT5Config)	unispeechZUniSpeechConfig)unispeech-satZUniSpeechSatConfig)univnetZUnivNetConfig)upernetZUperNetConfig)vanZ	VanConfig)video_llavaZVideoLlavaConfig)videomaeZVideoMAEConfig)viltZ
ViltConfig)vipllavaZVipLlavaConfig)vision-encoder-decoderr   )vision-text-dual-encoderZVisionTextDualEncoderConfig)visual_bertZVisualBertConfig)vitZ	ViTConfig)
vit_hybridZViTHybridConfig)vit_maeZViTMAEConfig)vit_msnZViTMSNConfig)vitdetZVitDetConfig)vitmatteZVitMatteConfig)vitposeZVitPoseConfig)vitpose_backboneZVitPoseBackboneConfig)vitsZ
VitsConfig)vivitZVivitConfig)wav2vec2ZWav2Vec2Config)wav2vec2-bertZWav2Vec2BertConfig)wav2vec2-conformerZWav2Vec2ConformerConfig)wavlmZWavLMConfig)whisperZWhisperConfig)xclipZXCLIPConfig)xglmZ
XGLMConfig)xlmZ	XLMConfig)xlm-prophetnetZXLMProphetNetConfig)xlm-robertaZXLMRobertaConfig)xlm-roberta-xlZXLMRobertaXLConfig)xlnetZXLNetConfig)xmodZ
XmodConfig)yolosZYolosConfig)yosoZ
YosoConfig)zambaZZambaConfig)zamba2ZZamba2Config)zoedepthZZoeDepthConfig({  )r   ZALBERT)r   ZALIGN)r   ZAltCLIP)r   ZAria)r   ZAriaText)r   zAudio Spectrogram Transformer)r   Z
Autoformer)r   Z	AyaVision)r   ZBamba)r   ZBark)r   ZBART)ZbarthezZBARThez)ZbartphoZBARTpho)r   ZBEiT)r   ZBERT)r   zBert Generation)zbert-japaneseZBertJapanese)ZbertweetZBERTweet)r   ZBigBird)r   zBigBird-Pegasus)r   ZBioGpt)r   ZBiT)r   ZBitNet)r   Z
Blenderbot)r   ZBlenderbotSmall)r    ZBLIP)r!   zBLIP-2)r"   zBLIP-2 QFormer)r#   ZBLOOM)bortZBORT)r$   ZBridgeTower)r%   ZBROS)Zbyt5ZByT5)r&   Z	CamemBERT)r'   ZCANINE)r(   Z	Chameleon)r)   zChinese-CLIP)r*   ZChineseCLIPVisionModel)r+   ZCLAP)r,   ZCLIP)r-   ZCLIPTextModel)r.   ZCLIPVisionModel)r/   ZCLIPSeg)r0   ZCLVP)r1   Z	CodeLlama)r3   ZCodeGen)r4   ZCohere)r5   ZCohere2)r6   ZColPali)r7   zConditional DETR)r8   ZConvBERT)r9   ZConvNeXT)r:   Z
ConvNeXTV2)ZcpmZCPM)r;   zCPM-Ant)r<   ZCSM)r=   ZCTRL)r>   ZCvT)r?   zD-FINE)r@   zDAB-DETR)rA   ZDAC)rB   ZData2VecAudio)rC   ZData2VecText)rD   ZData2VecVision)rE   ZDBRX)rF   ZDeBERTa)rG   z
DeBERTa-v2)rH   zDecision Transformer)rI   zDeepSeek-V3)rJ   zDeformable DETR)rK   ZDeiT)ZdeplotZDePlot)rL   zDepth Anything)Zdepth_anything_v2zDepth Anything V2)rM   ZDepthPro)rN   ZDETA)rO   ZDETR)ZdialogptZDialoGPT)rP   Z	DiffLlama)rQ   ZDiNAT)rR   ZDINOv2)rS   zDINOv2 with Registers)rT   Z
DistilBERT)ZditZDiT)rU   Z	DonutSwin)rV   ZDPR)rW   ZDPT)rX   ZEfficientFormer)rY   ZEfficientNet)rZ   ZELECTRA)r[   ZEmu3)r\   ZEnCodec)r]   zEncoder decoder)r^   ZERNIE)r_   ZErnieM)r`   ZESM)ra   ZFalcon)Zfalcon3ZFalcon3)rb   ZFalconMamba)rc   ZFastSpeech2Conformer)zflan-t5zFLAN-T5)zflan-ul2zFLAN-UL2)rd   ZFlauBERT)re   ZFLAVA)rf   ZFNet)rg   ZFocalNet)rh   zFairSeq Machine-Translation)ri   zFunnel Transformer)rj   ZFuyu)rk   ZGemma)rl   ZGemma2)rm   ZGemma3ForConditionalGeneration)rn   ZGemma3ForCausalLM)ro   ZGIT)rp   ZGLM)rq   rq   )rr   ZGLPN)rs   zGOT-OCR2)rt   zGPT-Sw3)rv   zOpenAI GPT-2)rw   Z
GPTBigCode)rx   zGPT Neo)ry   zGPT NeoX)rz   zGPT NeoX Japanese)r{   zGPT-J)r|   zGPTSAN-japanese)r}   ZGranite)r~   ZGraniteSpeech)r   ZGraniteMoeMoe)r   ZGraniteMoeHybrid)r   ZGraniteMoeSharedMoe)r   
LLaVA-NeXT)r   Z
Graphormer)r   zGrounding DINO)r   ZGroupViT)r   ZHelium)ZherbertZHerBERT)r   zHGNet-V2)r   ZHiera)r   ZHubert)r   zI-BERT)r   ZIDEFICS)r   ZIdefics2)r   ZIdefics3)r   ZIdefics3VisionTransformer)r   zI-JEPA)r   ZImageGPT)r   ZInformer)r   ZInstructBLIP)r   ZInstructBlipVideo)r   ZInternVL)r   ZInternVLVision)r   ZJamba)r   ZJanus)r   ZJetMoe)r   ZJukebox)r   zKOSMOS-2)r   ZLayoutLM)r   Z
LayoutLMv2)r   Z
LayoutLMv3)Z	layoutxlmZ	LayoutXLM)r   ZLED)r   ZLeViT)r   ZLiLT)r   ZLLaMA)Zllama2ZLlama2)Zllama3ZLlama3)r   ZLlama4)r   ZLlama4ForCausalLM)r   ZLLaVa)r   rh  )r   zLLaVa-NeXT-Video)r   zLLaVA-Onevision)r   Z
Longformer)r   ZLongT5)r   ZLUKE)r   ZLXMERT)r   ZM2M100)z
madlad-400z
MADLAD-400)r   ZMamba)r   r   )r   ZMarian)r   ZMarkupLM)r   ZMask2Former)r   Z
MaskFormer)r   ZMaskFormerSwin)ZmatchaZMatCha)r   ZmBART)Zmbart50zmBART-50)r   zM-CTC-T)r   ZMEGA)r   zMegatron-BERT)Zmegatron_gpt2zMegatron-GPT2)r   zMGP-STR)r   ZMimi)r   ZMistral)r   ZMistral3)r   ZMixtral)r   ZMLCD)r   ZMllama)ZmlukeZmLUKE)mmsZMMS)r   Z
MobileBERT)r   ZMobileNetV1)r   ZMobileNetV2)r   Z	MobileViT)r   ZMobileViTV2)r   Z
ModernBERT)r   Z	Moonshine)r   ZMoshi)r   ZMPNet)r   ZMPT)r   ZMRA)r   ZMT5)r   ZMusicGen)r   zMusicGen Melody)r   ZMVP)myt5rj  )r   ZNAT)r   ZNemotron)r   ZNezha)ZnllbZNLLB)r   zNLLB-MOE)r   ZNougat)r   u   Nyströmformer)r   ZOLMo)r   ZOLMo2)r   ZOLMoE)r   zOmDet-Turbo)r   Z	OneFormer)r   Z	OpenLlama)r   z
OpenAI GPT)r   OPT)r   ZOWLv2)r   zOWL-ViT)r   Z	PaliGemma)r   ZPatchTSMixer)r   ZPatchTST)r   ZPegasus)r   z	PEGASUS-X)r   Z	Perceiver)r   Z	Persimmon)r   Phi)r   ZPhi3)r   ZPhi4Multimodal)r   ZPhimoe)ZphobertZPhoBERT)r   Z
Pix2Struct)r   ZPixtral)r   ZPLBart)r   Z
PoolFormer)r   Z	Pop2Piano)r   ZPromptDepthAnything)r   Z
ProphetNet)r   ZPVT)r   ZPVTv2)r   ZQDQBert)r   ZQwen2)r   ZQwen2_5Omni)r   
Qwen2_5_VL)r   rm  )r   Z
Qwen2Audio)r   ZQwen2AudioEncoder)r   ZQwen2MoE)r   Qwen2VL)r   rn  )r   ZQwen3)r   ZQwen3MoE)r   ZRAG)r  ZREALM)r  ZRecurrentGemma)r  ZReformer)r  ZRegNet)r  ZRemBERT)r  ZResNet)r  Z	RetriBERT)r  ZRoBERTa)r	  zRoBERTa-PreLayerNorm)r
  ZRoCBert)r  ZRoFormer)r  zRT-DETR)r  zRT-DETR-ResNet)r  z	RT-DETRv2)r  ZRWKV)r  ZSAM)r  zSAM-HQ)r  ZSamHQVisionModel)r  ZSamVisionModel)r  ZSeamlessM4T)r  ZSeamlessM4Tv2)r  Z	SegFormer)r  ZSegGPT)r  ZSEW)r  zSEW-D)r  ZShieldgemma2)r  ZSigLIP)r  ZSigLIP2)Zsiglip2_vision_modelZSiglip2VisionModel)r  ZSiglipVisionModel)r  ZSmolVLM)r  ZSmolVLMVisionTransformer)r   zSpeech Encoder decoder)r!  ZSpeech2Text)r"  ZSpeech2Text2)r#  ZSpeechT5)r$  ZSplinter)r%  ZSqueezeBERT)r&  ZStableLm)r'  Z
Starcoder2)r(  Z	SuperGlue)r)  Z
SuperPoint)r*  ZSwiftFormer)r+  zSwin Transformer)r,  ZSwin2SR)r-  zSwin Transformer V2)r.  ZSwitchTransformers)r/  ZT5)zt5v1.1zT5v1.1)r0  zTable Transformer)r1  ZTAPAS)tapexZTAPEX)r2  ZTextNet)r3  zTime Series Transformer)r4  ZTimesFm)r5  ZTimeSformer)r6  ZTimmBackbone)r7  ZTimmWrapperModel)r8  zTrajectory Transformer)r9  zTransformer-XL)r:  ZTrOCR)r;  ZTVLT)r<  ZTVP)r=  ZUDOP)Zul2ZUL2)r>  ZUMT5)r?  Z	UniSpeech)r@  ZUniSpeechSat)rA  ZUnivNet)rB  ZUPerNet)rC  ZVAN)rD  Z
VideoLlava)rE  ZVideoMAE)rF  ZViLT)rG  ZVipLlava)rH  zVision Encoder decoder)rI  ZVisionTextDualEncoder)rJ  Z
VisualBERT)rK  ZViT)rL  z
ViT Hybrid)rM  ZViTMAE)rN  ZViTMSN)rO  ZVitDet)rP  ZViTMatte)rQ  ZViTPose)rR  ZViTPoseBackbone)rS  ZVITS)rT  ZViViT)rU  ZWav2Vec2)rV  zWav2Vec2-BERT)rW  zWav2Vec2-Conformer)Zwav2vec2_phonemeZWav2Vec2Phoneme)rX  ZWavLM)rY  ZWhisper)rZ  zX-CLIP)r[  ZXGLM)r\  ZXLM)r]  zXLM-ProphetNet)r^  zXLM-RoBERTa)r_  zXLM-RoBERTa-XL)zxlm-vzXLM-V)r`  ZXLNet)Zxls_rzXLS-R)Zxlsr_wav2vec2zXLSR-Wav2Vec2)ra  zX-MOD)rb  ZYOLOS)rc  ZYOSO)rd  ZZamba)re  ZZamba2)rf  ZZoeDepth)rg  rN   rX   r_   Zgptsan_japaneser   r   r   r   Zmmbtr   r   Z
open_llamar   r  r  r"  ro  r8  Z
transfo_xlr;  rC  rL  Zxlm_prophetnet))r   Zopenai)rB   data2vec)rC   rp  )rD   rp  )rU   Zdonut)r   Zkosmos2)r   r   )rZ  Zx_clip)r.   r,   )r   r   )r-   r,   )r   r   )rn   rm   )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"   Zblip_2c                 C   sH   | t v rt |  } | tv rd|  } | S | dd} | tv r"d|  } | S )z2Converts a config key to the corresponding module.zdeprecated.-_)!SPECIAL_MODEL_TYPE_TO_MODULE_NAMEDEPRECATED_MODELSreplace)key rw  Z/var/www/auris/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.pymodel_type_to_module_name=  s   

ry  c                 C   sL   t  D ]\}}|| kr|  S qtj D ]\}}|j| kr#|  S qdS )z<Converts a config class name to the corresponding model typeN)CONFIG_MAPPING_NAMESitemsCONFIG_MAPPING_extra_content__name__)configrv  clsrw  rw  rx  config_class_to_model_typeN  s   
r  c                   @   sR   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d Zdd Z	dd Z
dddZdS )_LazyConfigMappingzK
    A dictionary that lazily load its values when they are requested.
    c                 C   s   || _ i | _i | _d S N)_mappingr}  _modulesselfmappingrw  rw  rx  __init___     
z_LazyConfigMapping.__init__c                 C   s   || j v r
| j | S || jvrt|| j| }t|}|| jvr-td| d| j|< t| j| |r=t| j| |S td}t||S )N.transformers.modelsZtransformers)	r}  r  KeyErrorry  r  	importlibimport_modulehasattrgetattr)r  rv  valuemodule_nameZtransformers_modulerw  rw  rx  __getitem__d  s   






z_LazyConfigMapping.__getitem__c                 C   s   t | j t | j  S r  )listr  keysr}  r  rw  rw  rx  r  u  s   z_LazyConfigMapping.keysc                    &    fdd j  D t j  S )Nc                    s   g | ]} | qS rw  rw  .0kr  rw  rx  
<listcomp>y  s    z-_LazyConfigMapping.values.<locals>.<listcomp>)r  r  r  r}  valuesr  rw  r  rx  r  x     &z_LazyConfigMapping.valuesc                    r  )Nc                    s   g | ]}| | fqS rw  rw  r  r  rw  rx  r  |  s    z,_LazyConfigMapping.items.<locals>.<listcomp>)r  r  r  r}  r{  r  rw  r  rx  r{  {  r  z_LazyConfigMapping.itemsc                 C   s    t t| j t| j  S r  )iterr  r  r  r}  r  rw  rw  rx  __iter__~  s    z_LazyConfigMapping.__iter__c                 C   s   || j v p	|| jv S r  )r  r}  r  itemrw  rw  rx  __contains__  s   z_LazyConfigMapping.__contains__Fc                 C   s0   || j  v r|std| d|| j|< dS )z?
        Register a new configuration in this mapping.
        'z>' is already used by a Transformers config, pick another name.N)r  r  
ValueErrorr}  )r  rv  r  exist_okrw  rw  rx  register  s   z_LazyConfigMapping.registerNF)r~  
__module____qualname____doc__r  r  r  r  r{  r  r  r  rw  rw  rw  rx  r  Z  s    r  c                   @   sP   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d Zdd Z	dd Z
dd ZdS )_LazyLoadAllMappingsz
    A mapping that will load all pairs of key values at the first access (either by indexing, requestions keys, values,
    etc.)

    Args:
        mapping: The mapping to load.
    c                 C   s   || _ d| _i | _d S )NF)r  _initialized_datar  rw  rw  rx  r    r  z_LazyLoadAllMappings.__init__c                 C   sX   | j rd S | j D ]\}}t|}td| d}t||}| j| q
d| _ d S )Nr  r  T)	r  r  r{  ry  r  r  r  r  update)r  
model_typeZmap_namer  moduler  rw  rw  rx  _initialize  s   

z _LazyLoadAllMappings._initializec                 C   s   |    | j| S r  r  r  )r  rv  rw  rw  rx  r       
z _LazyLoadAllMappings.__getitem__c                 C      |    | j S r  r  r  r  r  rw  rw  rx  r    r  z_LazyLoadAllMappings.keysc                 C   r  r  )r  r  r  r  rw  rw  rx  r    r  z_LazyLoadAllMappings.valuesc                 C   r  r  r  r  rw  rw  rx  r{    r  z_LazyLoadAllMappings.itemsc                 C   s   |    t| jS r  )r  r  r  r  rw  rw  rx  r    r  z_LazyLoadAllMappings.__iter__c                 C   s   |    || jv S r  r  r  rw  rw  rx  r    r  z!_LazyLoadAllMappings.__contains__N)r~  r  r  r  r  r  r  r  r  r{  r  r  rw  rw  rw  rx  r    s    r  model_classc                 C   s.   t | ttfrddd | D S d|  dS )Nz or c                 S   s    g | ]}|d urd| dqS )N[``]rw  )r  crw  rw  rx  r    s     z#_get_class_name.<locals>.<listcomp>r  r  )
isinstancer  tuplejoin)r  rw  rw  rx  _get_class_name  s   r  Tc                    s   |d u r
|s
t d|r2|d u rdd t D n	dd | D fddt D }n!dd | D dd t D   fd	dt D }d
|S )NzFUsing `use_model_types=False` requires a `config_to_class` dictionary.c                 S   s   i | ]\}}|d | dqS )r  r  rw  r  r  r  rw  rw  rx  
<dictcomp>  s    z'_list_model_options.<locals>.<dictcomp>c                 S   s"   i | ]\}}|t v r|t|qS rw  )MODEL_NAMES_MAPPINGr  )r  r  r  rw  rw  rx  r    s
    c              
      s0   g | ]}  d | d|  dt |  dqS )z- **z** --  ( model)r  )r  r  )indentmodel_type_to_namerw  rx  r    s    "z'_list_model_options.<locals>.<listcomp>c                 S   s&   i | ]\}}|t v rt | t|qS rw  )rz  r  )r  r  Zclasrw  rw  rx  r    s
    c                 S   s   i | ]	\}}|t | qS rw  r  r  rw  rw  rx  r    s    c              
      s0   g | ]} d | d|  d |  dqS )z- [`z`] configuration class: r  r  rw  )r  Zconfig_name)config_to_model_nameconfig_to_namer  rw  rx  r    s    
)r  rz  r{  sortedr  r  )r  config_to_classuse_model_typeslinesrw  )r  r  r  r  rx  _list_model_options  s*   


r  c                    s    fdd}|S )Nc                    s   | j }|d u r	| S |d}d}|t|k r4td|| d u r4|d7 }|t|k r4td|| d u s |t|k r\td||  d }rM| d}t| d||< d|}n
td|  d| || _ | S )	Nr  r   z^(\s*)List options\s*$   z    r  r  zThe function z\ should have an empty 'List options' in its docstring as placeholder, current docstring is:
)	r  splitlenresearchgroupsr  r  r  )fnZ
docstringsr  ir  r  rw  rx  docstring_decorator  s*   
  
z>replace_list_option_in_docstrings.<locals>.docstring_decoratorrw  )r  r  r  rw  r  rx  !replace_list_option_in_docstrings  s   r  c                   @   sJ   e Zd ZdZdd ZedefddZee dd Z	e
dd
dZdS )
AutoConfiga  
    This is a generic configuration class that will be instantiated as one of the configuration classes of the library
    when created with the [`~AutoConfig.from_pretrained`] class method.

    This class cannot be instantiated directly using `__init__()` (throws an error).
    c                 C   s   t d)NzwAutoConfig is designed to be instantiated using the `AutoConfig.from_pretrained(pretrained_model_name_or_path)` method.)EnvironmentErrorr  rw  rw  rx  r    s   zAutoConfig.__init__r  c                 O   s<   |t v rt | }||i |S td| ddt   )NzUnrecognized model identifier: z. Should contain one of , )r|  r  r  r  )r  r  argskwargsconfig_classrw  rw  rx  	for_model  s   zAutoConfig.for_modelc              
   K   s  | dd}|dur tdt |dddurtd||d< d|d< ||d< | d	d}| d
d}tj|fi |\}}d|v oHd|d v }d|v oR|d tv }	t	|||	|}|r|r|d d }
t
|
|fd
|i|}tj|ry|  |j|fi |S d|v rzt|d  }W n ty   td|d  dw |j|fi |S tt tddD ]}|t|v rt| j|fi |  S qtd| dt ddt  )a  
        Instantiate one of the configuration classes of the library from a pretrained model configuration.

        The configuration class to instantiate is selected based on the `model_type` property of the config object that
        is loaded, or when it's missing, by falling back to using pattern matching on `pretrained_model_name_or_path`:

        List options

        Args:
            pretrained_model_name_or_path (`str` or `os.PathLike`):
                Can be either:

                    - A string, the *model id* of a pretrained model configuration hosted inside a model repo on
                      huggingface.co.
                    - A path to a *directory* containing a configuration file saved using the
                      [`~PretrainedConfig.save_pretrained`] method, or the [`~PreTrainedModel.save_pretrained`] method,
                      e.g., `./my_model_directory/`.
                    - A path or url to a saved configuration JSON *file*, e.g.,
                      `./my_model_directory/configuration.json`.
            cache_dir (`str` or `os.PathLike`, *optional*):
                Path to a directory in which a downloaded pretrained model configuration should be cached if the
                standard cache should not be used.
            force_download (`bool`, *optional*, defaults to `False`):
                Whether or not to force the (re-)download the model weights and configuration files and override the
                cached versions if they exist.
            resume_download:
                Deprecated and ignored. All downloads are now resumed by default when possible.
                Will be removed in v5 of Transformers.
            proxies (`Dict[str, str]`, *optional*):
                A dictionary of proxy servers to use by protocol or endpoint, e.g., `{'http': 'foo.bar:3128',
                'http://hostname': 'foo.bar:4012'}`. The proxies are used on each request.
            revision (`str`, *optional*, defaults to `"main"`):
                The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
                git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any
                identifier allowed by git.
            return_unused_kwargs (`bool`, *optional*, defaults to `False`):
                If `False`, then this function returns just the final configuration object.

                If `True`, then this functions returns a `Tuple(config, unused_kwargs)` where *unused_kwargs* is a
                dictionary consisting of the key/value pairs whose keys are not configuration attributes: i.e., the
                part of `kwargs` which has not been used to update `config` and is otherwise ignored.
            trust_remote_code (`bool`, *optional*, defaults to `False`):
                Whether or not to allow for custom models defined on the Hub in their own modeling files. This option
                should only be set to `True` for repositories you trust and in which you have read the code, as it will
                execute code present on the Hub on your local machine.
            kwargs(additional keyword arguments, *optional*):
                The values in kwargs of any keys which are configuration attributes will be used to override the loaded
                values. Behavior concerning key/value pairs whose keys are *not* configuration attributes is controlled
                by the `return_unused_kwargs` keyword parameter.

        Examples:

        ```python
        >>> from transformers import AutoConfig

        >>> # Download configuration from huggingface.co and cache.
        >>> config = AutoConfig.from_pretrained("google-bert/bert-base-uncased")

        >>> # Download configuration from huggingface.co (user-uploaded) and cache.
        >>> config = AutoConfig.from_pretrained("dbmdz/bert-base-german-cased")

        >>> # If configuration file is in a directory (e.g., was saved using *save_pretrained('./test/saved_model/')*).
        >>> config = AutoConfig.from_pretrained("./test/bert_saved_model/")

        >>> # Load a specific configuration file.
        >>> config = AutoConfig.from_pretrained("./test/bert_saved_model/my_configuration.json")

        >>> # Change some config attributes when loading a pretrained config.
        >>> config = AutoConfig.from_pretrained("google-bert/bert-base-uncased", output_attentions=True, foo=False)
        >>> config.output_attentions
        True

        >>> config, unused_kwargs = AutoConfig.from_pretrained(
        ...     "google-bert/bert-base-uncased", output_attentions=True, foo=False, return_unused_kwargs=True
        ... )
        >>> config.output_attentions
        True

        >>> unused_kwargs
        {'foo': False}
        ```use_auth_tokenNzrThe `use_auth_token` argument is deprecated and will be removed in v5 of Transformers. Please use `token` instead.tokenzV`token` and `use_auth_token` are both specified. Please set only the argument `token`.TZ
_from_autoZname_or_pathtrust_remote_codecode_revisionZauto_mapr  r  z6The checkpoint you are trying to load has model type `a%  ` but Transformers does not recognize this architecture. This could be because of an issue with the checkpoint, or because your version of Transformers is out of date.

You can update Transformers with the command `pip install --upgrade transformers`. If this does not work, and the checkpoint is very new, then there may not be a release version that supports this model yet. In this case, you can get the most up-to-date code by installing Transformers from source with the command `pip install git+https://github.com/huggingface/transformers.git`)rv  reversezUnrecognized model in z(. Should have a `model_type` key in its z7, or contain one of the following strings in its name: r  )popwarningswarnFutureWarninggetr  r   Zget_config_dictr|  r   r   ospathisdirZregister_for_auto_classfrom_pretrainedr  	from_dictr  r  r  strr	   r  )r  Zpretrained_model_name_or_pathr  r  r  r  Zconfig_dictZunused_kwargsZhas_remote_codeZhas_local_codeZ	class_refr  patternrw  rw  rx  r    sj   TzAutoConfig.from_pretrainedFc                 C   s@   t |tr|j| krtd|j d|  dtj| ||d dS )z
        Register a new configuration for this class.

        Args:
            model_type (`str`): The model type like "bert" or "gpt".
            config ([`PretrainedConfig`]): The config to register.
        zzThe config you are passing has a `model_type` attribute that is not consistent with the model type you passed (config has z and you passed z!. Fix one of those so they match!)r  N)
issubclassr   r  r  r|  r  )r  r  r  rw  rw  rx  r    s   	zAutoConfig.registerNr  )r~  r  r  r  r  classmethodr  r  r  r  staticmethodr  rw  rw  rw  rx  r    s     r  )r|  r  r  )NT)$r  r  r  r  r  collectionsr   typingr   r   Zconfiguration_utilsr   Zdynamic_module_utilsr   r   utilsr	   r
   Z
get_loggerr~  loggerrz  r  rt  rs  ry  r  r  r|  r  r  r  r  r  r  __all__rw  rw  rw  rx  <module>   sJ   
  a    33

! :