
    %	&h9                     `   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j$                  e      Z eg d	      Z eg d
      Zg dZ eg d      Zd Zd Z G d de      Z ee      Z G d de      Zde	eee   f   fdZddZ ddZ! G d d      Z"y)zAuto Config class.    N)OrderedDict)ListUnion   )PretrainedConfig)get_class_from_dynamic_moduleresolve_trust_remote_code)CONFIG_NAMElogging(G  )albertAlbertConfig)alignAlignConfig)altclipAltCLIPConfig)aria
AriaConfig)	aria_textAriaTextConfig)audio-spectrogram-transformer	ASTConfig)
autoformerAutoformerConfig)
aya_visionAyaVisionConfig)bambaBambaConfig)bark
BarkConfig)bart
BartConfig)beit
BeitConfig)bert
BertConfig)bert-generationBertGenerationConfig)big_birdBigBirdConfig)bigbird_pegasusBigBirdPegasusConfig)biogptBioGptConfig)bit	BitConfig)
blenderbotBlenderbotConfig)blenderbot-smallBlenderbotSmallConfig)blip
BlipConfig)blip-2Blip2Config)bloomBloomConfig)bridgetowerBridgeTowerConfig)bros
BrosConfig)	camembertCamembertConfig)canineCanineConfig)	chameleonChameleonConfig)chinese_clipChineseCLIPConfig)chinese_clip_vision_modelChineseCLIPVisionConfig)clap
ClapConfig)clip
CLIPConfig)clip_text_modelCLIPTextConfig)clip_vision_modelCLIPVisionConfig)clipsegCLIPSegConfig)clvp
ClvpConfig)
code_llamaLlamaConfig)codegenCodeGenConfig)cohereCohereConfig)cohere2Cohere2Config)colpaliColPaliConfig)conditional_detrConditionalDetrConfig)convbertConvBertConfig)convnextConvNextConfig)
convnextv2ConvNextV2Config)cpmantCpmAntConfig)ctrl
CTRLConfig)cvt	CvtConfig)dab-detrDabDetrConfig)dac	DacConfig)data2vec-audioData2VecAudioConfig)data2vec-textData2VecTextConfig)data2vec-visionData2VecVisionConfig)dbrx
DbrxConfig)debertaDebertaConfig)
deberta-v2DebertaV2Config)decision_transformerDecisionTransformerConfig)deepseek_v3DeepseekV3Config)deformable_detrDeformableDetrConfig)deit
DeiTConfig)depth_anythingDepthAnythingConfig)	depth_proDepthProConfig)deta
DetaConfig)detr
DetrConfig)	diffllamaDiffLlamaConfig)dinatDinatConfig)dinov2Dinov2Config)dinov2_with_registersDinov2WithRegistersConfig)
distilbertDistilBertConfig)
donut-swinDonutSwinConfig)dpr	DPRConfig)dpt	DPTConfig)efficientformerEfficientFormerConfig)efficientnetEfficientNetConfig)electraElectraConfig)emu3
Emu3Config)encodecEncodecConfig)encoder-decoderEncoderDecoderConfig)ernieErnieConfig)ernie_mErnieMConfig)esm	EsmConfig)falconFalconConfig)falcon_mambaFalconMambaConfig)fastspeech2_conformerFastSpeech2ConformerConfig)flaubertFlaubertConfig)flavaFlavaConfig)fnet
FNetConfig)focalnetFocalNetConfig)fsmt
FSMTConfig)funnelFunnelConfig)fuyu
FuyuConfig)gemmaGemmaConfig)gemma2Gemma2Config)gemma3Gemma3Config)gemma3_textGemma3TextConfig)git	GitConfig)glm	GlmConfig)glm4
Glm4Config)glpn
GLPNConfig)got_ocr2GotOcr2Config)gpt-sw3
GPT2Config)gpt2r   )gpt_bigcodeGPTBigCodeConfig)gpt_neoGPTNeoConfig)gpt_neoxGPTNeoXConfig)gpt_neox_japaneseGPTNeoXJapaneseConfig)gptj
GPTJConfig)gptsan-japaneseGPTSanJapaneseConfig)graniteGraniteConfig)
granitemoeGraniteMoeConfig)granitemoesharedGraniteMoeSharedConfig)granitevisionLlavaNextConfig)
graphormerGraphormerConfig)grounding-dinoGroundingDinoConfig)groupvitGroupViTConfig)heliumHeliumConfig)hieraHieraConfig)hubertHubertConfig)ibertIBertConfig)ideficsIdeficsConfig)idefics2Idefics2Config)idefics3Idefics3Config)idefics3_visionIdefics3VisionConfig)ijepaIJepaConfig)imagegptImageGPTConfig)informerInformerConfig)instructblipInstructBlipConfig)instructblipvideoInstructBlipVideoConfig)jambaJambaConfig)jetmoeJetMoeConfig)jukeboxJukeboxConfig)kosmos-2Kosmos2Config)layoutlmLayoutLMConfig)
layoutlmv2LayoutLMv2Config)
layoutlmv3LayoutLMv3Config)led	LEDConfig)levitLevitConfig)lilt
LiltConfig)llamarU   )llama4Llama4Config)llama4_textLlama4TextConfig)llavaLlavaConfig)
llava_nextr   )llava_next_videoLlavaNextVideoConfig)llava_onevisionLlavaOnevisionConfig)
longformerLongformerConfig)longt5LongT5Config)luke
LukeConfig)lxmertLxmertConfig)m2m_100M2M100Config)mambaMambaConfig)mamba2Mamba2Config)marianMarianConfig)markuplmMarkupLMConfig)mask2formerMask2FormerConfig)
maskformerMaskFormerConfig)maskformer-swinMaskFormerSwinConfig)mbartMBartConfig)mctctMCTCTConfig)mega
MegaConfig)megatron-bertMegatronBertConfig)mgp-strMgpstrConfig)mimi
MimiConfig)mistralMistralConfig)mistral3Mistral3Config)mixtralMixtralConfig)mllamaMllamaConfig)
mobilebertMobileBertConfig)mobilenet_v1MobileNetV1Config)mobilenet_v2MobileNetV2Config)	mobilevitMobileViTConfig)mobilevitv2MobileViTV2Config)
modernbertModernBertConfig)	moonshineMoonshineConfig)moshiMoshiConfig)mpnetMPNetConfig)mpt	MptConfig)mra	MraConfig)mt5	MT5Config)musicgenMusicgenConfig)musicgen_melodyMusicgenMelodyConfig)mvp	MvpConfig)nat	NatConfig)nemotronNemotronConfig)nezhaNezhaConfig)nllb-moeNllbMoeConfig)nougatVisionEncoderDecoderConfig)nystromformerNystromformerConfig)olmo
OlmoConfig)olmo2Olmo2Config)olmoeOlmoeConfig)omdet-turboOmDetTurboConfig)	oneformerOneFormerConfig)
open-llamaOpenLlamaConfig)
openai-gptOpenAIGPTConfig)opt	OPTConfig)owlv2Owlv2Config)owlvitOwlViTConfig)	paligemmaPaliGemmaConfig)patchtsmixerPatchTSMixerConfig)patchtstPatchTSTConfig)pegasusPegasusConfig)	pegasus_xPegasusXConfig)	perceiverPerceiverConfig)	persimmonPersimmonConfig)phi	PhiConfig)phi3
Phi3Config)phi4_multimodalPhi4MultimodalConfig)phimoePhimoeConfig)
pix2structPix2StructConfig)pixtralPixtralVisionConfig)plbartPLBartConfig)
poolformerPoolFormerConfig)	pop2pianoPop2PianoConfig)prompt_depth_anythingPromptDepthAnythingConfig)
prophetnetProphetNetConfig)pvt	PvtConfig)pvt_v2PvtV2Config)qdqbertQDQBertConfig)qwen2Qwen2Config)
qwen2_5_vlQwen2_5_VLConfig)qwen2_audioQwen2AudioConfig)qwen2_audio_encoderQwen2AudioEncoderConfig)	qwen2_moeQwen2MoeConfig)qwen2_vlQwen2VLConfig)qwen3Qwen3Config)	qwen3_moeQwen3MoeConfig)rag	RagConfig)realmRealmConfig)recurrent_gemmaRecurrentGemmaConfig)reformerReformerConfig)regnetRegNetConfig)rembertRemBertConfig)resnetResNetConfig)	retribertRetriBertConfig)robertaRobertaConfig)roberta-prelayernormRobertaPreLayerNormConfig)roc_bertRoCBertConfig)roformerRoFormerConfig)rt_detrRTDetrConfig)rt_detr_resnetRTDetrResNetConfig)
rt_detr_v2RTDetrV2Config)rwkv
RwkvConfig)sam	SamConfig)sam_vision_modelSamVisionConfig)seamless_m4tSeamlessM4TConfig)seamless_m4t_v2SeamlessM4Tv2Config)	segformerSegformerConfig)seggptSegGptConfig)sew	SEWConfig)sew-d
SEWDConfig)shieldgemma2ShieldGemma2Config)siglipSiglipConfig)siglip2Siglip2Config)siglip_vision_modelSiglipVisionConfig)smolvlmSmolVLMConfig)smolvlm_visionSmolVLMVisionConfig)speech-encoder-decoderSpeechEncoderDecoderConfig)speech_to_textSpeech2TextConfig)speech_to_text_2Speech2Text2Config)speecht5SpeechT5Config)splinterSplinterConfig)squeezebertSqueezeBertConfig)stablelmStableLmConfig)
starcoder2Starcoder2Config)	superglueSuperGlueConfig)
superpointSuperPointConfig)swiftformerSwiftFormerConfig)swin
SwinConfig)swin2srSwin2SRConfig)swinv2Swinv2Config)switch_transformersSwitchTransformersConfig)t5T5Config)table-transformerTableTransformerConfig)tapasTapasConfig)textnetTextNetConfig)time_series_transformerTimeSeriesTransformerConfig)timesformerTimesformerConfig)timm_backboneTimmBackboneConfig)timm_wrapperTimmWrapperConfig)trajectory_transformerTrajectoryTransformerConfig)
transfo-xlTransfoXLConfig)trocrTrOCRConfig)tvlt
TvltConfig)tvp	TvpConfig)udop
UdopConfig)umt5
UMT5Config)	unispeechUniSpeechConfig)unispeech-satUniSpeechSatConfig)univnetUnivNetConfig)upernetUperNetConfig)van	VanConfig)video_llavaVideoLlavaConfig)videomaeVideoMAEConfig)vilt
ViltConfig)vipllavaVipLlavaConfig)vision-encoder-decoderr~  )vision-text-dual-encoderVisionTextDualEncoderConfig)visual_bertVisualBertConfig)vit	ViTConfig)
vit_hybridViTHybridConfig)vit_maeViTMAEConfig)vit_msnViTMSNConfig)vitdetVitDetConfig)vitmatteVitMatteConfig)vitposeVitPoseConfig)vitpose_backboneVitPoseBackboneConfig)vits
VitsConfig)vivitVivitConfig)wav2vec2Wav2Vec2Config)wav2vec2-bertWav2Vec2BertConfig)wav2vec2-conformerWav2Vec2ConformerConfig)wavlmWavLMConfig)whisperWhisperConfig)xclipXCLIPConfig)xglm
XGLMConfig)xlm	XLMConfig)xlm-prophetnetXLMProphetNetConfig)xlm-robertaXLMRobertaConfig)xlm-roberta-xlXLMRobertaXLConfig)xlnetXLNetConfig)xmod
XmodConfig)yolosYolosConfig)yoso
YosoConfig)zambaZambaConfig)zamba2Zamba2Config)zoedepthZoeDepthConfig(j  )r   ALBERT)r   ALIGN)r   AltCLIP)r   Aria)r   AriaText)r   zAudio Spectrogram Transformer)r   
Autoformer)r   	AyaVision)r   Bamba)r   Bark)r    BART)barthezBARThez)bartphoBARTpho)r"   BEiT)r$   BERT)r&   zBert Generation)zbert-japaneseBertJapanese)bertweetBERTweet)r(   BigBird)r*   zBigBird-Pegasus)r,   BioGpt)r.   BiT)r0   
Blenderbot)r2   BlenderbotSmall)r4   BLIP)r6   zBLIP-2)r8   BLOOM)bortBORT)r:   BridgeTower)r<   BROS)byt5ByT5)r>   	CamemBERT)r@   CANINE)rB   	Chameleon)rD   zChinese-CLIP)rF   ChineseCLIPVisionModel)rH   CLAP)rJ   CLIP)rL   CLIPTextModel)rN   CLIPVisionModel)rP   CLIPSeg)rR   CLVP)rT   	CodeLlama)rV   CodeGen)rX   Cohere)rZ   Cohere2)r\   ColPali)r^   zConditional DETR)r`   ConvBERT)rb   ConvNeXT)rd   
ConvNeXTV2)cpmCPM)rf   zCPM-Ant)rh   CTRL)rj   CvT)rl   zDAB-DETR)rn   DAC)rp   Data2VecAudio)rr   Data2VecText)rt   Data2VecVision)rv   DBRX)rx   DeBERTa)rz   z
DeBERTa-v2)r|   zDecision Transformer)r~   zDeepSeek-V3)r   zDeformable DETR)r   DeiT)deplotDePlot)r   zDepth Anything)depth_anything_v2zDepth Anything V2)r   DepthPro)r   DETA)r   DETR)dialogptDialoGPT)r   	DiffLlama)r   DiNAT)r   DINOv2)r   zDINOv2 with Registers)r   
DistilBERT)ditDiT)r   	DonutSwin)r   DPR)r   DPT)r   EfficientFormer)r   EfficientNet)r   ELECTRA)r   Emu3)r   EnCodec)r   zEncoder decoder)r   ERNIE)r   ErnieM)r   ESM)r   Falcon)falcon3Falcon3)r   FalconMamba)r   FastSpeech2Conformer)zflan-t5zFLAN-T5)zflan-ul2zFLAN-UL2)r   FlauBERT)r   FLAVA)r   FNet)r   FocalNet)r   zFairSeq Machine-Translation)r   zFunnel Transformer)r   Fuyu)r   Gemma)r   Gemma2)r   Gemma3ForConditionalGeneration)r   Gemma3ForCausalLM)r   GIT)r   GLM)r   r   )r   GLPN)r   zGOT-OCR2)r   zGPT-Sw3)r   zOpenAI GPT-2)r   
GPTBigCode)r   zGPT Neo)r   zGPT NeoX)r   zGPT NeoX Japanese)r   zGPT-J)r   zGPTSAN-japanese)r   Granite)r   GraniteMoeMoe)r   GraniteMoeSharedMoe)r   
LLaVA-NeXT)r   
Graphormer)r   zGrounding DINO)r   GroupViT)r   Helium)herbertHerBERT)r   Hiera)r   Hubert)r   zI-BERT)r   IDEFICS)r   Idefics2)r   Idefics3)r   Idefics3VisionTransformer)r  zI-JEPA)r  ImageGPT)r  Informer)r  InstructBLIP)r	  InstructBlipVideo)r  Jamba)r  JetMoe)r  Jukebox)r  zKOSMOS-2)r  LayoutLM)r  
LayoutLMv2)r  
LayoutLMv3)	layoutxlm	LayoutXLM)r  LED)r  LeViT)r  LiLT)r  LLaMA)llama2Llama2)llama3Llama3)r   Llama4)r"  Llama4ForCausalLM)r$  LLaVa)r&  r  )r'  zLLaVa-NeXT-Video)r)  zLLaVA-Onevision)r+  
Longformer)r-  LongT5)r/  LUKE)r1  LXMERT)r3  M2M100)z
madlad-400z
MADLAD-400)r5  Mamba)r7  r7  )r9  Marian)r;  MarkupLM)r=  Mask2Former)r?  
MaskFormer)rA  MaskFormerSwin)matchaMatCha)rC  mBART)mbart50zmBART-50)rE  zM-CTC-T)rG  MEGA)rI  zMegatron-BERT)megatron_gpt2zMegatron-GPT2)rK  zMGP-STR)rM  Mimi)rO  Mistral)rQ  Mistral3)rS  Mixtral)rU  Mllama)mlukemLUKE)mmsMMS)rW  
MobileBERT)rY  MobileNetV1)r[  MobileNetV2)r]  	MobileViT)r_  MobileViTV2)ra  
ModernBERT)rc  	Moonshine)re  Moshi)rg  MPNet)ri  MPT)rk  MRA)rm  MT5)ro  MusicGen)rq  zMusicGen Melody)rs  MVP)myt5rL  )ru  NAT)rw  Nemotron)ry  Nezha)nllbNLLB)r{  zNLLB-MOE)r}  Nougat)r  u   Nyströmformer)r  OLMo)r  OLMo2)r  OLMoE)r  zOmDet-Turbo)r  	OneFormer)r  	OpenLlama)r  z
OpenAI GPT)r  OPT)r  OWLv2)r  zOWL-ViT)r  	PaliGemma)r  PatchTSMixer)r  PatchTST)r  Pegasus)r  z	PEGASUS-X)r  	Perceiver)r  	Persimmon)r  Phi)r  Phi3)r  Phi4Multimodal)r  Phimoe)phobertPhoBERT)r  
Pix2Struct)r  Pixtral)r  PLBart)r  
PoolFormer)r  	Pop2Piano)r  PromptDepthAnything)r  
ProphetNet)r  PVT)r  PVTv2)r  QDQBert)r  Qwen2)r  
Qwen2_5_VL)r  
Qwen2Audio)r  Qwen2AudioEncoder)r  Qwen2MoE)r  Qwen2VL)r  Qwen3)r  Qwen3MoE)r  RAG)r  REALM)r  RecurrentGemma)r  Reformer)r  RegNet)r  RemBERT)r  ResNet)r  	RetriBERT)r  RoBERTa)r  zRoBERTa-PreLayerNorm)r  RoCBert)r  RoFormer)r  zRT-DETR)r  zRT-DETR-ResNet)r  z	RT-DETRv2)r  RWKV)r  SAM)r  SamVisionModel)r  SeamlessM4T)r  SeamlessM4Tv2)r  	SegFormer)r  SegGPT)r  SEW)r  zSEW-D)r  Shieldgemma2)r  SigLIP)r  SigLIP2)siglip2_vision_modelSiglip2VisionModel)r  SiglipVisionModel)r  SmolVLM)r	  SmolVLMVisionTransformer)r  zSpeech Encoder decoder)r  Speech2Text)r  Speech2Text2)r  SpeechT5)r  Splinter)r  SqueezeBERT)r  StableLm)r  
Starcoder2)r  	SuperGlue)r  
SuperPoint)r  SwiftFormer)r!  zSwin Transformer)r#  Swin2SR)r%  zSwin Transformer V2)r'  SwitchTransformers)r)  T5)zt5v1.1zT5v1.1)r+  zTable Transformer)r-  TAPAS)tapexTAPEX)r/  TextNet)r1  zTime Series Transformer)r3  TimeSformer)r5  TimmBackbone)r7  TimmWrapperModel)r9  zTrajectory Transformer)r;  zTransformer-XL)r=  TrOCR)r?  TVLT)rA  TVP)rC  UDOP)ul2UL2)rE  UMT5)rG  	UniSpeech)rI  UniSpeechSat)rK  UnivNet)rM  UPerNet)rO  VAN)rQ  
VideoLlava)rS  VideoMAE)rU  ViLT)rW  VipLlava)rY  zVision Encoder decoder)rZ  VisionTextDualEncoder)r\  
VisualBERT)r^  ViT)r`  z
ViT Hybrid)rb  ViTMAE)rd  ViTMSN)rf  VitDet)rh  ViTMatte)rj  ViTPose)rl  ViTPoseBackbone)rn  VITS)rp  ViViT)rr  Wav2Vec2)rt  zWav2Vec2-BERT)rv  zWav2Vec2-Conformer)wav2vec2_phonemeWav2Vec2Phoneme)rx  WavLM)rz  Whisper)r|  zX-CLIP)r~  XGLM)r  XLM)r  zXLM-ProphetNet)r  zXLM-RoBERTa)r  zXLM-RoBERTa-XL)zxlm-vzXLM-V)r  XLNet)xls_rzXLS-R)xlsr_wav2vec2zXLSR-Wav2Vec2)r  zX-MOD)r  YOLOS)r  YOSO)r  Zamba)r  Zamba2)r  ZoeDepth)r  r   r   r   gptsan_japaneser   r  rE  rG  mmbtru  ry  
open_llamar  r  r  r  r  r9  
transfo_xlr?  rO  r`  xlm_prophetnet))r  openai)rp   data2vec)rr   r  )rt   r  )r   donut)r  kosmos2)rA  r?  )r|  x_clip)rN   rJ   )r  r  )rL   rJ   )r   r   )r   r   )r   r   )r  r  )r	  r  )rF   rD   )r  r  )r   r&  )r  r  )r"  r   c                     | t         v rt         |    } | t        v rd|  } | S | j                  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)keys    /var/www/pru.catia.catastroantioquia-mas.com/valormas/lib/python3.12/site-packages/transformers/models/auto/configuration_auto.pymodel_type_to_module_namer    s[     ///4##u%C

++c3
C
C5!J    c                     t         j                         D ]  \  }}|| k(  s|c S  t        j                  j                         D ]  \  }}|j                  | k(  s|c S  y)z<Converts a config class name to the corresponding model typeN)CONFIG_MAPPING_NAMESitemsCONFIG_MAPPING_extra_content__name__)configr  clss      r  config_class_to_model_typer  '  sd    (..0 S&=J #11779 S<<6!J r  c                   B    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
dd	Zy
)_LazyConfigMappingzK
    A dictionary that lazily load its values when they are requested.
    c                 .    || _         i | _        i | _        y N)_mappingr  _modulesselfmappings     r  __init__z_LazyConfigMapping.__init__8  s     r  c                    || j                   v r| j                   |   S || j                  vrt        |      | j                  |   }t        |      }|| j                  vr&t        j                  d| d      | j                  |<   t        | j                  |   |      rt        | j                  |   |      S t        j                  d      }t        ||      S )N.transformers.modelstransformers)	r  r  KeyErrorr  r  	importlibimport_modulehasattrgetattr)r  r  valuemodule_nametransformers_modules        r  __getitem__z_LazyConfigMapping.__getitem__=  s    $%%%&&s++dmm#3-c"/4dmm+)2)@)@1[MARTi)jDMM+&4==-u54==5u== (55nE*E22r  c                     t        | j                  j                               t        | j                  j                               z   S r  )listr  keysr  r  s    r  r  z_LazyConfigMapping.keysN  s3    DMM&&()D1D1D1I1I1K,LLLr  c                     | j                   j                         D cg c]  }| |   	 c}t        | j                  j	                               z   S c c}w r  )r  r  r  r  valuesr  ks     r  r
  z_LazyConfigMapping.valuesQ  s@    !%!3!3!56AQ6d>Q>Q>X>X>Z9[[[6s   Ac                     | j                   j                         D cg c]	  }|| |   f c}t        | j                  j	                               z   S c c}w r  )r  r  r  r  r  r  s     r  r  z_LazyConfigMapping.itemsT  sD    &*mm&8&8&:;DG;d4CVCVC\C\C^>___;s   Ac                     t        t        | j                  j                               t        | j                  j                               z         S r  )iterr  r  r  r  r  s    r  __iter__z_LazyConfigMapping.__iter__W  s8    D++-.d6I6I6N6N6P1QQRRr  c                 >    || j                   v xs || j                  v S r  )r  r  r  items     r  __contains__z_LazyConfigMapping.__contains__Z  s!    t}}$C0C0C(CCr  c                 |    || j                   j                         v r|st        d| d      || j                  |<   y)z?
        Register a new configuration in this mapping.
        'z>' is already used by a Transformers config, pick another name.N)r  r  
ValueErrorr  )r  r  r  exist_oks       r  registerz_LazyConfigMapping.register]  s@     $--$$&&xq%cdee#(C r  NF)r  
__module____qualname____doc__r  r  r  r
  r  r  r  r   r  r  r  r  3  s4    
3"M\`SD)r  r  c                   @    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zy
)_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                 .    || _         d| _        i | _        y )NF)r  _initialized_datar  s     r  r  z_LazyLoadAllMappings.__init__r  s    !
r  c                    | j                   ry | j                  j                         D ]P  \  }}t        |      }t	        j
                  d| d      }t        ||      }| j                  j                  |       R d| _         y )Nr  r  T)	r"  r  r  r  r  r  r   r#  update)r  
model_typemap_namer  moduler  s         r  _initializez _LazyLoadAllMappings._initializew  s{    $(MM$7$7$9 	' J3J?K,,q->@UVFfh/GJJg&		' !r  c                 @    | j                          | j                  |   S r  r)  r#  )r  r  s     r  r  z _LazyLoadAllMappings.__getitem__  s    zz#r  c                 V    | j                          | j                  j                         S r  r)  r#  r  r  s    r  r  z_LazyLoadAllMappings.keys      zz  r  c                 V    | j                          | j                  j                         S r  )r)  r#  r
  r  s    r  r
  z_LazyLoadAllMappings.values  s!    zz  ""r  c                 V    | j                          | j                  j                         S r  r-  r  s    r  r  z_LazyLoadAllMappings.items  r.  r  c                 L    | j                          t        | j                        S r  )r)  r  r#  r  s    r  r  z_LazyLoadAllMappings.__iter__  s    DJJr  c                 >    | j                          || j                  v S r  r+  r  s     r  r  z!_LazyLoadAllMappings.__contains__  s    tzz!!r  N)r  r  r  r  r  r)  r  r  r
  r  r  r  r  r  r  r   r   i  s/    

!!#! "r  r   model_classc                     t        | t        t        f      r&dj                  | D cg c]  }|d| d c}      S d|  dS c c}w )Nz or [``])
isinstancer  tuplejoin)r3  cs     r  _get_class_namer;    sK    +e}-{{M1q}b2JMNN}B Ns
   AAc                 
   ||st        d      |r|,t        j                         D ci c]  \  }}|d| d }}}n4|j                         D ci c]  \  }}|t        v r|t	        |       }}}t        |j                               D cg c]  }|  d| d||    dt        |    d }}n|j                         D ci c]   \  }}|t        v rt        |   t	        |      " }	}}t        j                         D ci c]  \  }}|t        |    }
}}t        |	j                               D cg c]  }|  d| d	|	|    d|
|    d }}d
j                  |      S c c}}w c c}}w c c}w c c}}w c c}}w c c}w )NzFUsing `use_model_types=False` requires a `config_to_class` dictionary.r5  r6  z- **z** -- z (z model)z- [`z`] configuration class: 
)r  r  r  MODEL_NAMES_MAPPINGr;  sortedr  r9  )indentconfig_to_classuse_model_typesr&  r  model_type_to_namer3  linesclasconfig_to_nameconfig_to_model_nameconfig_names               r  _list_model_optionsrI    s   abb"XlXrXrXt!uBT*f*6("o"=!u!u 0?/D/D/F"+J!44 OK88" " %%7%<%<%>?
 hd:,f-?
-K,LBObcmOnNoovw
 
 !0 5 5 7
-- !(/$*??
 
 OcNhNhNj 
8J
FF'
33 
  
  &n&9&9&;<
  hd;- ({+,B/CK/P.QQXZ
 

 99U3 "v"




 

s#   E#E)E/%E4E:5F c                       fd}|S )Nc                    | j                   }|| S |j                  d      }d}|t        |      k  rFt        j                  d||         -|dz  }|t        |      k  rt        j                  d||         -|t        |      k  rTt        j                  d||         j                         d   }r| d}t        |      ||<   dj                  |      }nt        d|  d|       || _         | S )	Nr=  r   z^(\s*)List options\s*$   z    )rA  rB  zThe function z\ should have an empty 'List options' in its docstring as placeholder, current docstring is:
)	r  splitlenresearchgroupsrI  r9  r  )fn
docstringsrD  ir@  rA  rB  s        r  docstring_decoratorz>replace_list_option_in_docstrings.<locals>.docstring_decorator  s   ZZ
I  &#e*n+DeAh!O!WFA #e*n+DeAh!O!Ws5z>YY8%(CJJLQOF"84*6?dstE!H5)Jt $##-,0   
	r  r  )rA  rB  rU  s   `` r  !replace_list_option_in_docstringsrV    s    . r  c                   b    e Zd ZdZd Zedefd       Ze e       d               Z	e
dd       Zy)	
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                     t        d      )NzwAutoConfig is designed to be instantiated using the `AutoConfig.from_pretrained(pretrained_model_name_or_path)` method.)EnvironmentErrorr  s    r  r  zAutoConfig.__init__  s    \
 	
r  r&  c           	          |t         v rt         |   } ||i |S t        d| ddj                  t         j                                      )NzUnrecognized model identifier: z. Should contain one of , )r  r  r9  r  )r  r&  argskwargsconfig_classs        r  	for_modelzAutoConfig.for_model  sY    ')*5L000-j\9QRVR[R[\j\o\o\qRrQst
 	
r  c                    |j                  dd      }|<t        j                  dt               |j	                  dd      t        d      ||d<   d|d<   ||d<   |j                  d	d      }|j                  d
d      }t        j                  |fi |\  }}d|v xr d|d   v }d|v xr |d   t        v }	t        |||	|      }|r[|rY|d   d   }
t        |
|fd
|i|}t        j                  j                  |      r|j                           |j                  |fi |S d|v r 	 t        |d      } |j"                  |fi |S t%        t        j'                         t(        d      D ]*  }|t+        |      v st        |   j"                  |fi |c S  t        d| dt,         ddj/                  t        j'                                      # t         $ r t        d|d    d      w xY w)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`.T
_from_autoname_or_pathtrust_remote_codecode_revisionauto_maprX  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`)r  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   get_config_dictr  r	   r   ospathisdirregister_for_auto_classfrom_pretrainedr  	from_dictr?  r  rN  strr
   r9  )r  pretrained_model_name_or_pathr^  rb  rf  rg  config_dictunused_kwargshas_remote_codehas_local_code	class_refr_  patterns                r  rt  zAutoConfig.from_pretrained  sm   h  $4d;%MM E zz'4(4 l  -F7O#|!>~"JJ':DA

?D9%5%E%EFc%ngm%n"]$3_T^H_8_%4d\9RVd9d5<no
 0#J/=I88HUY_L ww}}:;446/<//0MXQWXX[(-k,.GH *<))+GGG "."5"5"7S$O [c"?@@)'2<<[ZMZZ[ $%B$C D55@M B IIn&9&9&;<=?
 	
'  
 L[YeMfLg hX X	 	
s   &G G+c                     t        |t              r+|j                  | k7  rt        d|j                   d|  d      t        j                  | ||       y)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  s      r  r  zAutoConfig.register  sc     f./F4E4E4S**0*;*;)<<LZL Y 
 	
FXFr  Nr  )r  r  r  r  r  classmethodrv  r`  rV  rt  staticmethodr  r  r  r  rX  rX    s_    
 
3 
 
 &(L
 ) L
\ G Gr  rX  )NT)#r  r  rp  rO  rk  collectionsr   typingr   r   configuration_utilsr   dynamic_module_utilsr   r	   utilsr
   r   
get_loggerr  loggerr  r>  r  r  r  r  r  r  r   rv  r;  rI  rV  rX  r  r  r  <module>r     s      	 	  #  3 \ ) 
		H	% #IK \
 "ln d 6 %0% !6"	0) 0)f $$890"; 0"f sDI~!6  B6vG vGr  