
    g                        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"dS )zAuto Config class.    N)OrderedDict)ListUnion   )PretrainedConfig)get_class_from_dynamic_moduleresolve_trust_remote_code)CONFIG_NAMElogging(  )albertAlbertConfig)alignAlignConfig)altclipAltCLIPConfig)audio-spectrogram-transformer	ASTConfig)
autoformerAutoformerConfig)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)conditional_detrConditionalDetrConfig)convbertConvBertConfig)convnextConvNextConfig)
convnextv2ConvNextV2Config)cpmantCpmAntConfig)ctrl
CTRLConfig)cvt	CvtConfig)dac	DacConfig)data2vec-audioData2VecAudioConfig)data2vec-textData2VecTextConfig)data2vec-visionData2VecVisionConfig)dbrx
DbrxConfig)debertaDebertaConfig)
deberta-v2DebertaV2Config)decision_transformerDecisionTransformerConfig)deformable_detrDeformableDetrConfig)deit
DeiTConfig)depth_anythingDepthAnythingConfig)deta
DetaConfig)detr
DetrConfig)dinatDinatConfig)dinov2Dinov2Config)
distilbertDistilBertConfig)
donut-swinDonutSwinConfig)dpr	DPRConfig)dpt	DPTConfig)efficientformerEfficientFormerConfig)efficientnetEfficientNetConfig)electraElectraConfig)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)git	GitConfig)glm	GlmConfig)glpn
GLPNConfig)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)
graphormerGraphormerConfig)grounding-dinoGroundingDinoConfig)groupvitGroupViTConfig)hieraHieraConfig)hubertHubertConfig)ibertIBertConfig)ideficsIdeficsConfig)idefics2Idefics2Config)idefics3Idefics3Config)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)llamarM   )llavaLlavaConfig)
llava_nextLlavaNextConfig)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)mixtralMixtralConfig)mllamaMllamaConfig)
mobilebertMobileBertConfig)mobilenet_v1MobileNetV1Config)mobilenet_v2MobileNetV2Config)	mobilevitMobileViTConfig)mobilevitv2MobileViTV2Config)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)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)phimoePhimoeConfig)
pix2structPix2StructConfig)pixtralPixtralVisionConfig)plbartPLBartConfig)
poolformerPoolFormerConfig)	pop2pianoPop2PianoConfig)
prophetnetProphetNetConfig)pvt	PvtConfig)pvt_v2PvtV2Config)qdqbertQDQBertConfig)qwen2Qwen2Config)qwen2_audioQwen2AudioConfig)qwen2_audio_encoderQwen2AudioEncoderConfig)	qwen2_moeQwen2MoeConfig)qwen2_vlQwen2VLConfig)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)rwkv
RwkvConfig)sam	SamConfig)seamless_m4tSeamlessM4TConfig)seamless_m4t_v2SeamlessM4Tv2Config)	segformerSegformerConfig)seggptSegGptConfig)sew	SEWConfig)sew-d
SEWDConfig)siglipSiglipConfig)siglip_vision_modelSiglipVisionConfig)speech-encoder-decoderSpeechEncoderDecoderConfig)speech_to_textSpeech2TextConfig)speech_to_text_2Speech2Text2Config)speecht5SpeechT5Config)splinterSplinterConfig)squeezebertSqueezeBertConfig)stablelmStableLmConfig)
starcoder2Starcoder2Config)
superpointSuperPointConfig)swiftformerSwiftFormerConfig)swin
SwinConfig)swin2srSwin2SRConfig)swinv2Swinv2Config)switch_transformersSwitchTransformersConfig)t5T5Config)table-transformerTableTransformerConfig)tapasTapasConfig)time_series_transformerTimeSeriesTransformerConfig)timesformerTimesformerConfig)timm_backboneTimmBackboneConfig)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-decoderrK  )vision-text-dual-encoderVisionTextDualEncoderConfig)visual_bertVisualBertConfig)vit	ViTConfig)
vit_hybridViTHybridConfig)vit_maeViTMAEConfig)vit_msnViTMSNConfig)vitdetVitDetConfig)vitmatteVitMatteConfig)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)zoedepthZoeDepthConfig(<  )r   ALBERT)r   ALIGN)r   AltCLIP)r   zAudio Spectrogram Transformer)r   
Autoformer)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)r(   
Blenderbot)r*   BlenderbotSmall)r,   BLIP)r.   zBLIP-2)r0   BLOOM)bortBORT)r2   BridgeTower)r4   BROS)byt5ByT5)r6   	CamemBERT)r8   CANINE)r:   	Chameleon)r<   zChinese-CLIP)r>   ChineseCLIPVisionModel)r@   CLAP)rB   CLIP)rD   CLIPTextModel)rF   CLIPVisionModel)rH   CLIPSeg)rJ   CLVP)rL   	CodeLlama)rN   CodeGen)rP   Cohere)rR   zConditional DETR)rT   ConvBERT)rV   ConvNeXT)rX   
ConvNeXTV2)cpmCPM)rZ   zCPM-Ant)r\   CTRL)r^   CvT)r`   DAC)rb   Data2VecAudio)rd   Data2VecText)rf   Data2VecVision)rh   DBRX)rj   DeBERTa)rl   z
DeBERTa-v2)rn   zDecision Transformer)rp   zDeformable DETR)rr   DeiT)deplotDePlot)rt   zDepth Anything)depth_anything_v2zDepth Anything V2)rv   DETA)rx   DETR)dialogptDialoGPT)rz   DiNAT)r|   DINOv2)r~   
DistilBERT)ditDiT)r   	DonutSwin)r   DPR)r   DPT)r   EfficientFormer)r   EfficientNet)r   ELECTRA)r   EnCodec)r   zEncoder decoder)r   ERNIE)r   ErnieM)r   ESM)r   Falcon)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   GIT)r   GLM)r   GLPN)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   
Graphormer)r   zGrounding DINO)r   GroupViT)herbertHerBERT)r   Hiera)r   Hubert)r   zI-BERT)r   IDEFICS)r   Idefics2)r   Idefics3)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   LLaVa)r   z
LLaVA-NeXT)r   zLLaVa-NeXT-Video)r   zLLaVA-Onevision)r   
Longformer)r   LongT5)r  LUKE)r  LXMERT)r  M2M100)z
madlad-400z
MADLAD-400)r  Mamba)r
  r
  )r  Marian)r  MarkupLM)r  Mask2Former)r  
MaskFormer)r  MaskFormerSwin)matchaMatCha)r  mBART)mbart50zmBART-50)r  zM-CTC-T)r  MEGA)r  zMegatron-BERT)megatron_gpt2zMegatron-GPT2)r  zMGP-STR)r   Mimi)r"  Mistral)r$  Mixtral)r&  Mllama)mlukemLUKE)mmsMMS)r(  
MobileBERT)r*  MobileNetV1)r,  MobileNetV2)r.  	MobileViT)r0  MobileViTV2)r2  Moshi)r4  MPNet)r6  MPT)r8  MRA)r:  MT5)r<  MusicGen)r>  zMusicGen Melody)r@  MVP)myt5r  )rB  NAT)rD  Nemotron)rF  Nezha)nllbNLLB)rH  zNLLB-MOE)rJ  Nougat)rL  u   Nyströmformer)rN  OLMo)rP  OLMoE)rR  zOmDet-Turbo)rT  	OneFormer)rV  	OpenLlama)rX  z
OpenAI GPT)rZ  OPT)r\  OWLv2)r^  zOWL-ViT)r`  	PaliGemma)rb  PatchTSMixer)rd  PatchTST)rf  Pegasus)rh  z	PEGASUS-X)rj  	Perceiver)rl  	Persimmon)rn  Phi)rp  Phi3)rr  Phimoe)phobertPhoBERT)rt  
Pix2Struct)rv  Pixtral)rx  PLBart)rz  
PoolFormer)r|  	Pop2Piano)r~  
ProphetNet)r  PVT)r  PVTv2)r  QDQBert)r  Qwen2)r  
Qwen2Audio)r  Qwen2AudioEncoder)r  Qwen2MoE)r  Qwen2VL)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  RWKV)r  SAM)r  SeamlessM4T)r  SeamlessM4Tv2)r  	SegFormer)r  SegGPT)r  SEW)r  zSEW-D)r  SigLIP)r  SiglipVisionModel)r  zSpeech Encoder decoder)r  Speech2Text)r  Speech2Text2)r  SpeechT5)r  Splinter)r  SqueezeBERT)r  StableLm)r  
Starcoder2)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  zTime Series Transformer)r  TimeSformer)r  TimmBackbone)r  zTrajectory Transformer)r  zTransformer-XL)r  TrOCR)r  TVLT)r  TVP)r  UDOP)ul2UL2)r  UMT5)r  	UniSpeech)r  UniSpeechSat)r  UnivNet)r  UPerNet)r  VAN)r   
VideoLlava)r  VideoMAE)r  ViLT)r  VipLlava)r  zVision Encoder decoder)r	  VisionTextDualEncoder)r  
VisualBERT)r  ViT)r  z
ViT Hybrid)r  ViTMAE)r  ViTMSN)r  VitDet)r  ViTMatte)r  VITS)r  ViViT)r  Wav2Vec2)r  zWav2Vec2-BERT)r!  zWav2Vec2-Conformer)wav2vec2_phonemeWav2Vec2Phoneme)r#  WavLM)r%  Whisper)r'  zX-CLIP)r)  XGLM)r+  XLM)r-  zXLM-ProphetNet)r/  zXLM-RoBERTa)r1  zXLM-RoBERTa-XL)zxlm-vzXLM-V)r3  XLNet)xls_rzXLS-R)xlsr_wav2vec2zXLSR-Wav2Vec2)r5  zX-MOD)r7  YOLOS)r9  YOSO)r;  Zamba)r=  ZoeDepth)rU  rv   r   r   gptsan_japaneser   r   r  r  mmbtrB  rF  
open_llamar  r  r  r  r&  r  
transfo_xlr  r  r  xlm_prophetnet))rX  openai)rb   data2vec)rd   rW  )rf   rW  )r   donut)r   kosmos2)r  r  )r'  x_clip)rF   rB   )r  r  )rD   rB   )r  r  )r>   r<   )r  r  c                     | 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)keys    g/var/www/html/ai-engine/env/lib/python3.11/site-packages/transformers/models/auto/configuration_auto.pymodel_type_to_module_namerc    si     ////4###%%%C

++c3

C
!C!!J    c                     t                                           D ]\  }}|| k    r|c S t          j                                        D ]\  }}|j        | k    r|c S dS )z<Converts a config class name to the corresponding model typeN)CONFIG_MAPPING_NAMESitemsCONFIG_MAPPING_extra_content__name__)configra  clss      rb  config_class_to_model_typerm    s|    (..00  S&==JJJ  #17799  S<6!!JJJ "4rd  c                   D    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
dd
ZdS )_LazyConfigMappingzK
    A dictionary that lazily load its values when they are requested.
    c                 0    || _         i | _        i | _        d S N)_mappingri  _modulesselfmappings     rb  __init__z_LazyConfigMapping.__init__  s     rd  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)	ri  rr  KeyErrorrc  rs  	importlibimport_modulehasattrgetattr)ru  ra  valuemodule_nametransformers_modules        rb  __getitem__z_LazyConfigMapping.__getitem__  s    $%%%&s++dm##3--c"/44dm++)2)@AR[ARARTi)j)jDM+&4=-u55 	>4=5u=== (5nEE*E222rd  c                     t          | j                                                  t          | j                                                  z   S rq  )listrr  keysri  ru  s    rb  r  z_LazyConfigMapping.keys  s:    DM&&(())D1D1I1I1K1K,L,LLLrd  c                       fd j                                         D             t           j                                                  z   S )Nc                      g | ]
}|         S  r  .0kru  s     rb  
<listcomp>z-_LazyConfigMapping.values.<locals>.<listcomp>  s    666AQ666rd  )rr  r  r  ri  valuesr  s   `rb  r  z_LazyConfigMapping.values  sG    6666!3!3!5!5666d>Q>X>X>Z>Z9[9[[[rd  c                       fd j                                         D             t           j                                                  z   S )Nc                 $    g | ]}||         fS r  r  r  s     rb  r  z,_LazyConfigMapping.items.<locals>.<listcomp>  s!    ;;;DG;;;rd  )rr  r  r  ri  rg  r  s   `rb  rg  z_LazyConfigMapping.items  sG    ;;;;dm&8&8&:&:;;;d4CVC\C\C^C^>_>___rd  c                     t          t          | j                                                  t          | j                                                  z             S rq  )iterr  rr  r  ri  r  s    rb  __iter__z_LazyConfigMapping.__iter__  sB    D++--..d6I6N6N6P6P1Q1QQRRRrd  c                 &    || j         v p|| j        v S rq  )rr  ri  ru  items     rb  __contains__z_LazyConfigMapping.__contains__  s    t}$C0C(CCrd  Fc                 z    || 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)rr  r  
ValueErrorri  )ru  ra  r  exist_oks       rb  registerz_LazyConfigMapping.register  sO     $-$$&&&&x&ddddeee#(C   rd  NF)rj  
__module____qualname____doc__rw  r  r  r  rg  r  r  r  r  rd  rb  ro  ro    s           
3 3 3"M M M\ \ \` ` `S S SD D D) ) ) ) ) )rd  ro  c                   B    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
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                 0    || _         d| _        i | _        d S )NF)rr  _initialized_datart  s     rb  rw  z_LazyLoadAllMappings.__init__  s    !


rd  c                    | j         rd S | j                                        D ]V\  }}t          |          }t	          j        d| d          }t          ||          }| j                            |           Wd| _         d S )Nry  rz  T)	r  rr  rg  rc  r}  r~  r  r  update)ru  
model_typemap_namer  modulerv  s         rb  _initializez _LazyLoadAllMappings._initialize  s     	F$(M$7$7$9$9 	' 	' J3J??K,->->->@UVVFfh//GJg&&&& rd  c                 D    |                                   | j        |         S rq  r  r  )ru  ra  s     rb  r  z _LazyLoadAllMappings.__getitem__"  s     z#rd  c                 \    |                                   | j                                        S rq  r  r  r  r  s    rb  r  z_LazyLoadAllMappings.keys&  &    z   rd  c                 \    |                                   | j                                        S rq  )r  r  r  r  s    rb  r  z_LazyLoadAllMappings.values*  s(    z  """rd  c                 \    |                                   | j                                        S rq  r  r  s    rb  rg  z_LazyLoadAllMappings.items.  r  rd  c                 R    |                                   t          | j                  S rq  )r  r  r  r  s    rb  r  z_LazyLoadAllMappings.__iter__2  s$    DJrd  c                 <    |                                   || j        v S rq  r  r  s     rb  r  z!_LazyLoadAllMappings.__contains__6  s!    tz!!rd  N)rj  r  r  r  rw  r  r  r  r  rg  r  r  r  rd  rb  r  r    s           

! 
! 
!  ! ! !# # #! ! !     " " " " "rd  r  model_classc                     t          | t          t          f          rd                    d | D                       S d|  dS )Nz or c                     g | ]
}|d| dS )N[``]r  )r  cs     rb  r  z#_get_class_name.<locals>.<listcomp>=  s!    MMM1q}JJJJ}}}rd  r  r  )
isinstancer  tuplejoin)r  s    rb  _get_class_namer  ;  sK    +e}-- O{{MMMMMNNNrd  Tc                 $    ||st          d          |rs|$d t                                          D             nd |                                D              fdt                                                    D             }npd |                                D             d t                                          D              fdt                                                    D             }d                    |          S )	NzFUsing `use_model_types=False` requires a `config_to_class` dictionary.c                 "    i | ]\  }}|d | dS )r  r  r  r  r  rk  s      rb  
<dictcomp>z'_list_model_options.<locals>.<dictcomp>F  s'    !u!u!uBT*f*o6ooo!u!u!urd  c                 F    i | ]\  }}|t           v |t          |          S r  )MODEL_NAMES_MAPPINGr  )r  r  r  s      rb  r  z'_list_model_options.<locals>.<dictcomp>H  s<     " " "+J!444 OK88444rd  c           
      N    g | ]!} d | d|          dt           |          d"S )z- **z** --  ( model)r  )r  r  indentmodel_type_to_names     rb  r  z'_list_model_options.<locals>.<listcomp>M  sW     
 
 
 ww:ww-?
-KwwObcmOnwww
 
 
rd  c                 \    i | ])\  }}|t           v t           |         t          |          *S r  )rf  r  )r  rk  class      rb  r  z'_list_model_options.<locals>.<dictcomp>R  sA     
 
 
--- !(/$*?*?---rd  c                 0    i | ]\  }}|t           |         S r  r  r  s      rb  r  z'_list_model_options.<locals>.<dictcomp>W  s1      
  
  
8J
FF'
3 
  
  
rd  c           
      D    g | ]} d | d|          d|          dS )z- [`z`] configuration class: r  r  r  )r  config_nameconfig_to_model_nameconfig_to_namer  s     rb  r  z'_list_model_options.<locals>.<listcomp>Z  ss     
 
 
   Z Z; Z Z{+Z Z/CK/PZ Z Z
 
 
rd  
)r  rf  rg  sortedr  r  )r  config_to_classuse_model_typeslinesr  r  r  s   `   @@@rb  _list_model_optionsr  A  sr   abbb 
"!u!uXlXrXrXtXt!u!u!u" "/>/D/D/F/F" " "

 
 
 
 
$%7%<%<%>%>??
 
 


 
 / 5 5 7 7
 
 

 
  
NbNhNhNjNj 
  
  

 
 
 
 
 
  &n&9&9&;&;<<
 
 

 99Urd  c                       fd}|S )Nc                 6   | j         }|| S |                    d          }d}|t          |          k     rNt          j        d||                   3|dz  }|t          |          k     rt          j        d||                   3|t          |          k     ret          j        d||                                                   d         }r| d}t          |          ||<   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  )fn
docstringsr  ir  r  r  s        rb  docstring_decoratorz>replace_list_option_in_docstrings.<locals>.docstring_decoratorc  s5   Z
I  &&#e**nn+DeAh!O!O!WFA #e**nn+DeAh!O!O!Ws5zz>>Y8%(CCJJLLQOF )"*6?dstttE!H5))JJ0 0 0#-0 0    
	rd  r  )r  r  r  s   `` rb  !replace_list_option_in_docstringsr  b  s*         . rd  c                       e Zd ZdZd Zedefd            Ze e            d                         Z	e
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                      t          d          )NzwAutoConfig is designed to be instantiated using the `AutoConfig.from_pretrained(pretrained_model_name_or_path)` method.)EnvironmentErrorr  s    rb  rw  zAutoConfig.__init__  s    \
 
 	
rd  r  c           	          |t           v rt           |         } ||i |S t          d| dd                    t                                                                )NzUnrecognized model identifier: z. Should contain one of , )rh  r  r  r  )rl  r  argskwargsconfig_classs        rb  	for_modelzAutoConfig.for_model  sm    '')*5L<0000tjttRVR[R[\j\o\o\q\qRrRrtt
 
 	
rd  c                 ^   |                     dd          }|Dt          j        dt                     |                    dd          t          d          ||d<   d|d<   ||d<   |                     d	d          }|                     d
d          }t          j        |fi |\  }}d|v o	d|d         v }d|v o|d         t          v }	t          |||	|          }|ra|r_|d         d         }
t          |
|fd
|i|}t          j                            |          r|                                  |j        |fi |S d|v rJ	 t          |d                  }n'# t           $ r t          d|d          d          w xY w |j        |fi |S t%          t                                          t(          d          D ]-}|t+          |          v rt          |         j        |fi |c S .t          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`.T
_from_autoname_or_pathtrust_remote_codecode_revisionauto_mapr  r  z6The checkpoint you are trying to load has model type `z` 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.)ra  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_dictrh  r	   r   ospathisdirregister_for_auto_classfrom_pretrainedr|  	from_dictr  r  r  strr
   r  )rl  pretrained_model_name_or_pathr  r  r  r  config_dictunused_kwargshas_remote_codehas_local_code	class_refr  patterns                rb  r  zAutoConfig.from_pretrained  s   h  $4d;;%M E   zz'4((4 l   -F7O#|!>~"JJ':DAA

?D99%5%EFc%n%ngm%n%n"]$3_T^H_8_%4d\9RVd9d5<no
 
  	[0 	[#J/=I88 HUY_ L w}}:;; 744666/</0MXXQWXXX[((-k,.GH    i[YeMf i i i   *<)+GGGGG "."5"5"7"7S$OOO [ [c"?@@@@)'2<[ZZMZZZZZ A ?%B ? ?5@? ? IIn&9&9&;&;<<? ?
 
 	
s   E $E;Fc                     t          |t                    r&|j        | k    rt          d|j         d|  d          t                              | ||           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  rh  r  )r  rk  r  s      rb  r  zAutoConfig.register  s     f.// 	F4E4S4S*0*; MW    
 	
FXFFFFFrd  Nr  )rj  r  r  r  rw  classmethodr  r  r  r  staticmethodr  r  rd  rb  r  r  }  s         
 
 
 
3 
 
 
 [
 &&((G
 G
 )( [G
R G G G \G G Grd  r  )NT)#r  r}  r   r  r  collectionsr   typingr   r   configuration_utilsr   dynamic_module_utilsr   r	   utilsr
   r   
get_loggerrj  loggerrf  r  r_  r^  rc  rm  ro  rh  r  r  r  r  r  r  r  rd  rb  <module>r     sY         				 				  # # # # # #         3 3 3 3 3 3 \ \ \ \ \ \ \ \ ) ) ) ) ) ) ) ) 
	H	%	% #{] ] ]_ _ D	 "k~ ~ ~@ @ H
   6 %0K  % % !(  "	 	 	0) 0) 0) 0) 0) 0) 0) 0)f $#$8990" 0" 0" 0" 0"; 0" 0" 0"f sDI~!6           B   6qG qG qG qG qG qG qG qG qG qGrd  