
    sg                     `   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(  )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)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)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)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)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-decoderrM  )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   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   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)r0  	MobileViT)r2  MobileViTV2)r4  Moshi)r6  MPNet)r8  MPT)r:  MRA)r<  MT5)r>  MusicGen)r@  zMusicGen Melody)rB  MVP)myt5r  )rD  NAT)rF  Nemotron)rH  Nezha)nllbNLLB)rJ  zNLLB-MOE)rL  Nougat)rN  u   Nyströmformer)rP  OLMo)rR  OLMo2)rT  OLMoE)rV  zOmDet-Turbo)rX  	OneFormer)rZ  	OpenLlama)r\  z
OpenAI GPT)r^  OPT)r`  OWLv2)rb  zOWL-ViT)rd  	PaliGemma)rf  PatchTSMixer)rh  PatchTST)rj  Pegasus)rl  z	PEGASUS-X)rn  	Perceiver)rp  	Persimmon)rr  Phi)rt  Phi3)rv  Phimoe)phobertPhoBERT)rx  
Pix2Struct)rz  Pixtral)r|  PLBart)r~  
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)r1  zXLM-ProphetNet)r3  zXLM-RoBERTa)r5  zXLM-RoBERTa-XL)zxlm-vzXLM-V)r7  XLNet)xls_rzXLS-R)xlsr_wav2vec2zXLSR-Wav2Vec2)r9  zX-MOD)r;  YOLOS)r=  YOSO)r?  Zamba)rA  ZoeDepth)rY  rv   r   r   gptsan_japaneser   r   r  r  mmbtrD  rH  
open_llamar  r  r  r  r+  r  
transfo_xlr  r  r  xlm_prophetnet))r\  openai)rb   data2vec)rd   r\  )rf   r\  )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 | 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/html/venv/lib/python3.12/site-packages/transformers/models/auto/configuration_auto.pymodel_type_to_module_namerh    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__)configrf  clss      rg  config_class_to_model_typerr    sd    (..0 S&=J #11779 S<<6!J ri  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)_mappingrn  _modulesselfmappings     rg  __init__z_LazyConfigMapping.__init__  s     ri  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)	rn  rw  KeyErrorrh  rx  	importlibimport_modulehasattrgetattr)rz  rf  valuemodule_nametransformers_modules        rg  __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2ri  c                     t        | j                  j                               t        | j                  j                               z   S rv  )listrw  keysrn  rz  s    rg  r  z_LazyConfigMapping.keys  s3    DMM&&()D1D1D1I1I1K,LLLri  c                     | j                   j                         D cg c]  }| |   	 c}t        | j                  j	                               z   S c c}w rv  )rw  r  r  rn  valuesrz  ks     rg  r  z_LazyConfigMapping.values  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 rv  )rw  r  r  rn  rl  r  s     rg  rl  z_LazyConfigMapping.items  sD    &*mm&8&8&:;DG;d4CVCVC\C\C^>___;s   Ac                     t        t        | j                  j                               t        | j                  j                               z         S rv  )iterr  rw  r  rn  r  s    rg  __iter__z_LazyConfigMapping.__iter__  s8    D++-.d6I6I6N6N6P1QQRRri  c                 >    || j                   v xs || j                  v S rv  )rw  rn  rz  items     rg  __contains__z_LazyConfigMapping.__contains__  s!    t}}$C0C0C(CCri  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)rw  r  
ValueErrorrn  )rz  rf  r  exist_oks       rg  registerz_LazyConfigMapping.register   s@     $--$$&&xq%cdee#(C ri  NF)ro  
__module____qualname____doc__r|  r  r  r  rl  r  r  r   ri  rg  rt  rt    s4    
3"M\`SD)ri  rt  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)rw  _initialized_datary  s     rg  r|  z_LazyLoadAllMappings.__init__  s    !
ri  c                    | j                   ry | j                  j                         D ]P  \  }}t        |      }t	        j
                  d| d      }t        ||      }| j                  j                  |       R d| _         y )Nr~  r  T)	r  rw  rl  rh  r  r  r  r  update)rz  
model_typemap_namer  moduler{  s         rg  _initializez _LazyLoadAllMappings._initialize  s{    $(MM$7$7$9 	' J3J?K,,q->@UVFfh/GJJg&		' !ri  c                 @    | j                          | j                  |   S rv  r  r  )rz  rf  s     rg  r  z _LazyLoadAllMappings.__getitem__&  s    zz#ri  c                 V    | j                          | j                  j                         S rv  r  r  r  r  s    rg  r  z_LazyLoadAllMappings.keys*      zz  ri  c                 V    | j                          | j                  j                         S rv  )r  r  r  r  s    rg  r  z_LazyLoadAllMappings.values.  s!    zz  ""ri  c                 V    | j                          | j                  j                         S rv  r  r  s    rg  rl  z_LazyLoadAllMappings.items2  r  ri  c                 L    | j                          t        | j                        S rv  )r  r  r  r  s    rg  r  z_LazyLoadAllMappings.__iter__6  s    DJJri  c                 >    | j                          || j                  v S rv  r  r  s     rg  r  z!_LazyLoadAllMappings.__contains__:  s    tzz!!ri  N)ro  r  r  r  r|  r  r  r  r  rl  r  r  r  ri  rg  r  r    s/    

!!#! "ri  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)r  cs     rg  _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.r  r  z- **z** -- z (z model)z- [`z`] configuration class: 
)r  rk  rl  MODEL_NAMES_MAPPINGr  sortedr  r  )indentconfig_to_classuse_model_typesr  rp  model_type_to_namer  linesclasconfig_to_nameconfig_to_model_nameconfig_names               rg  _list_model_optionsr  E  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    )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        rg  docstring_decoratorz>replace_list_option_in_docstrings.<locals>.docstring_decoratorg  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   
	ri  r  )r  r  r  s   `` rg  !replace_list_option_in_docstringsr  f  s    . ri  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    rg  r|  zAutoConfig.__init__  s    \
 	
ri  r  c           	          |t         v rt         |   } ||i |S t        d| ddj                  t         j                                      )NzUnrecognized model identifier: z. Should contain one of , )rm  r  r  r  )rq  r  argskwargsconfig_classs        rg  	for_modelzAutoConfig.for_model  sY    ')*5L000-j\9QRVR[R[\j\o\o\qRrQst
 	
ri  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_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.)rf  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_dictrm  r	   r   ospathisdirregister_for_auto_classfrom_pretrainedr  	from_dictr  r  r  strr
   r  )rq  pretrained_model_name_or_pathr  r  r  r  config_dictunused_kwargshas_remote_codehas_local_code	class_refr  patterns                rg  r  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i i 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  rm  r  )r  rp  r  s      rg  r  zAutoConfig.register#  sc     f./F4E4E4S**0*;*;)<<LZL Y 
 	
FXFri  Nr  )ro  r  r  r  r|  classmethodr  r  r  r  staticmethodr  r  ri  rg  r  r    s_    
 
3 
 
 &(G
 ) G
R G Gri  r  )NT)#r  r  r  r  r  collectionsr   typingr   r   configuration_utilsr   dynamic_module_utilsr   r	   utilsr
   r   
get_loggerro  loggerrk  r  rd  rc  rh  rr  rt  rm  r  r  r  r  r  r  r  ri  rg  <module>r     s      	 	  #  3 \ ) 
		H	% #_a H	 "@B L
 6 %0% !("	0) 0)f $$890"; 0"f sDI~!6  B6qG qGri  