ó
    >:jÓB  ã                  ó   • S SK Jr  S SKrS SKrS SKrS SKrS SKrS SKJ	r	J
r
Jr  S SKJrJr  S SKrS SKJr  S SKJrJr  S SKJr  SS	KJrJrJr  S
1rS rSS jrSS jr\
 " S S\5      5       r \
 " S S\ 5      5       r!\
 " S S\!5      5       r"g)é    )ÚannotationsN)ÚasdictÚ	dataclassÚfield)ÚOptionalÚUnion)Úhf_hub_download)ÚPushToHubMixinÚhttp_user_agent)Ú__version__é   )ÚCONFIG_NAMEÚPeftTypeÚTaskTypeÚ	peft_typec                óØ   • [         R                  " U R                  5      R                  n[	        UR                  5       5      [	        UR                  5       5      -
  nU H  nX	 M     X4$ )zõMake PEFT configs forward-compatible by removing unused kwargs that were added in later PEFT versions.

This assumes that removing the unused kwargs will not affect the default behavior.

Returns the filtered kwargs and the set of removed keys.
)ÚinspectÚ	signatureÚ__init__Ú
parametersÚsetÚkeys)ÚclsÚkwargsÚsignature_parametersÚunexpected_kwargsÚkeys        ÚH/home/mande/repo/quber/.venv/lib/python3.13/site-packages/peft/config.pyÚ_check_and_remove_unused_kwargsr   %   s\   € ô #×,Ò,¨S¯\©\Ó:×EÑEÐÜ˜FŸK™K›MÓ*¬SÐ1E×1JÑ1JÓ1LÓ-MÑMÐÛ ˆØŠKñ !àÐ$Ð$ó    c                óX   • [         R                  R                  U 5      R                  S L$ ©N)Ú	packagingÚversionÚVersionÚdev)r$   s    r   Ú_is_dev_versionr'   4   s$   € ä×Ñ×$Ñ$ WÓ-×1Ñ1¸Ð=Ð=r    c                óœ  •  [         R                  R                  U 5      nUR                  =(       d    /  Ho  nUR
                  S:X  d  M  [        R                  " UR                  U5      R                  5       5      nUR                  S5      nU(       d  Mb  SU;   d  Mj  US   s  $    g ! [         R                  R                   a     g f = f)Nzdirect_url.jsonÚvcs_infoÚ	commit_id)Ú	importlibÚmetadataÚdistributionÚPackageNotFoundErrorÚfilesÚnameÚjsonÚloadsÚlocate_fileÚ	read_textÚget)Úpkg_nameÚdistÚpathÚ
direct_urlr)   s        r   Ú_get_commit_hashr:   9   s®   € ðÜ×!Ñ!×.Ñ.¨xÓ8ˆð
 —
‘
× ˜bÒ ˆØ�9‰9Ð)Õ)ÜŸš T×%5Ñ%5°dÓ%;×$FÑ$FÓ$HÓIˆJØ!—~‘~ jÓ1ˆHßˆx˜K¨8Õ3Ø Ñ,Ò,ñ !ð øô ×Ñ×2Ñ2ó Ùðús   ‚B* Â*CÃ
Cc                  óT  • \ rS rSr% Sr\" SSS0S9rS\S'   \" SSS	0S9rS
\S'   \" SSS0S9r	S\S'   \" SSS0S9r
S\S'   S r\SS j5       rS S jrS!S jr\S 5       r\S"S#S jj5       r\S$S j5       r\S 5       r\  S%S j5       r\S 5       r\S&S j5       r\S&S j5       rSrg)'ÚPeftConfigMixinéL   a'  
This is the base configuration class for PEFT adapter models. It contains all the methods that are common to all
PEFT adapter models. This class inherits from [`~transformers.utils.PushToHubMixin`] which contains the methods to
push your model to the Hub. The method `save_pretrained` will save the configuration of your adapter model in a
directory. The method `from_pretrained` will load the configuration of your adapter model from a directory.

Args:
    peft_type (Union[[`~peft.utils.config.PeftType`], `str`]): The type of Peft method to use.
NÚhelpzThe type of task.©Údefaultr,   zOptional[TaskType]Ú	task_typezThe type of PEFT model.zOptional[PeftType]r   zEAn auto mapping dict to help retrieve the base model class if needed.zOptional[dict]Úauto_mappingz'PEFT version, leave empty to auto-fill.úOptional[str]Úpeft_versionc                óü   • U R                   bL  U R                   [        [        5      ;  a/  [        SU R                    SSR	                  [        5       S35      eU R
                  c  U R                  5       U l        g g )NzInvalid task type: 'z,'. Must be one of the following task types: z, Ú.)rA   Úlistr   Ú
ValueErrorÚjoinrD   Ú_get_peft_version©Úselfs    r   Ú__post_init__ÚPeftConfigMixin.__post_init___   ss   € à�N‰NÑ&¨T¯^©^Ä4ÌÃ>Ó-QÜØ& t§~¡~Ð&6Ð6bÐcg×clÑclÔmuÓcvÐbwÐwxÐyóð ð ×ÑÑ$Ø $× 6Ñ 6Ó 8ˆDÕð %r    c                 ó¸   • [         n [        U 5      (       d  U $  [        S5      nUc  SnU SU 3-   n U $ ! [         a    [        R
                  " S5        Sn N.f = f)NÚpeftÚUNKNOWNz A dev version of PEFT is used but there was an error while trying to determine the commit hash. Please open an issue: https://github.com/huggingface/peft/issuesÚ@)r   r'   r:   Ú	ExceptionÚwarningsÚwarn)r$   Úgit_hashs     r   rJ   Ú!PeftConfigMixin._get_peft_versionh   st   € ô ˆÜ˜w×'Ñ'ØˆNð
	!Ü'¨Ó/ˆHØÑØ$�ð ˜a ˜z˜NÑ*ˆØˆøô ó 	!ä�MŠMðSôð !ŠHð	!ús   š4 ´"AÁAc                ó   • [        U 5      $ )zC
Returns the configuration for your adapter model as a dictionary.
)r   rK   s    r   Úto_dictÚPeftConfigMixin.to_dict~   s   € ô �d‹|Ðr    c           	     ó>  • [         R                  R                  U5      (       a  [        SU S35      e[         R                  " USS9  UR                  SS5      nU R                  5       nUR                  5        H)  u  pV[        U[        5      (       d  M  [        U5      XE'   M+     [         R                  R                  U[        5      nUb  X4S'   [        US5       nUR                  [        R                   " US	SS
95        SSS5        g! , (       d  f       g= f)a^  
This method saves the configuration of your adapter model in a directory.

Args:
    save_directory (`str`):
        The directory where the configuration will be saved.
    kwargs (additional keyword arguments, *optional*):
        Additional keyword arguments passed along to the [`~transformers.utils.PushToHubMixin.push_to_hub`]
        method.
zProvided path (z#) should be a directory, not a fileT)Úexist_okÚauto_mapping_dictNrB   Úwé   )ÚindentÚ	sort_keys)Úosr8   ÚisfileÚAssertionErrorÚmakedirsÚpoprY   ÚitemsÚ
isinstancer   rG   rI   r   ÚopenÚwriter1   Údumps)	rL   Úsave_directoryr   r]   Úoutput_dictr   ÚvalueÚoutput_pathÚwriters	            r   Úsave_pretrainedÚPeftConfigMixin.save_pretrained„   sß   € ô �7‰7�>‰>˜.×)Ñ)Ü  ?°>Ð2BÐBeÐ!fÓgÐgä
�Š�N¨TÒ2Ø"ŸJ™JÐ':¸DÓAÐà—l‘l“nˆà%×+Ñ+Ö-‰JˆCÜ˜%¤×%Ó%Ü#'¨£;�Ó ñ .ô —g‘g—l‘l >´;Ó?ˆð Ñ(Ø*;˜Ñ'ô �+˜sÔ# vØ�L‰LœŸš K¸ÀTÑJÔK÷ $×#Ö#ús   Ã&DÄ
Dc                óÚ  • SSK Jn  SU;   a
  US   nX#   nOU n U" S0 UD6nU$ ! [         a¼  nS[        U5      ;  a  Ue[	        XA5      u  px[
        R                  [        UR                  5       5      5      (       d   [        SU R                   S[
         S35      e[        R                  " S[        U5       S	UR                   S
35        UR                  " S0 UD6n SnAU$ SnAff = f)ai  
This method loads the configuration of your adapter model from a set of kwargs.

The appropriate configuration type is determined by the `peft_type` argument. If `peft_type` is not provided,
the calling class type is instantiated.

Args:
    kwargs (configuration keyword arguments):
        Keyword arguments passed along to the configuration initialization.
r   )ÚPEFT_TYPE_TO_CONFIG_MAPPINGr   z"got an unexpected keyword argumentzThe z> config that is trying to be loaded is missing required keys: rF   zUnexpected keyword arguments z for class a,  , these are ignored. This probably means that you're loading a configuration file that was saved using a higher version of the library and additional parameters have been introduced since. It is highly recommended to upgrade the PEFT version before continuing (e.g. by running `pip install -U peft`).N© )Úpeft.mappingrt   Ú	TypeErrorÚstrr   ÚMIN_EXPECTED_CONFIG_KEYSÚissubsetr   r   Ú__name__rT   rU   ÚsortedÚfrom_peft_type)	r   r   rt   r   Ú
config_clsÚconfigÚexcÚfiltered_kwargsr   s	            r   r}   ÚPeftConfigMixin.from_peft_type¥   s  € õ 	=ð" ˜&Ó Ø˜{Ñ+ˆIØ4Ñ?‰JàˆJð	BÙÑ) &Ñ)ˆFð4 ˆøô3 ó 	Bð 4¼3¸s»8ÓCØ�	ä1PÐQ[Ó1dÑ.ˆOÜ+×4Ñ4´S¸×9MÑ9MÓ9OÓ5P×QÑQÜØ˜3Ÿ<™<˜.Ð(fÜ/Ð0°ð3óð ô
 �MŠMØ/´Ð7HÓ0IÐ/JÈ+ÐV`×ViÑViÐUjð kð ôð  ×.Ò.ÑA°ÑAŒFØˆûð3	Bús   š$ ¤
C*®B1C%Ã%C*c                ó^  • Ub  [         R                  R                  X5      OUnU R                  U5      u  pVnSU;  a  [	        5       US'   [         R                  R                  [         R                  R                  U[        5      5      (       a%  [         R                  R                  U[        5      nO [        U[        4SU0UD6nU R                  U5      n
0 UEU
EnU R                  " S0 UD6nU R                  " S0 UD6$ ! [         a  n	[        S[         SU S35      U	eSn	A	ff = f)a\  
This method loads the configuration of your adapter model from a directory.

Args:
    pretrained_model_name_or_path (`str`):
        The directory or the Hub repository id where the configuration is saved.
    kwargs (additional keyword arguments, *optional*):
        Additional keyword arguments passed along to the child class initialization.
NÚ
user_agentÚ	subfolderúCan't find 'ú' at 'Ú'ru   )rb   r8   rI   Ú_split_kwargsr   rc   r   r	   rS   rH   Úfrom_json_fileÚcheck_kwargsr}   )r   Úpretrained_model_name_or_pathr…   r   r8   Úhf_hub_download_kwargsÚclass_kwargsÚ_Úconfig_filer€   Úloaded_attributess              r   Úfrom_pretrainedÚPeftConfigMixin.from_pretrainedæ   s-  € ð Ñ$ô �G‰G�L‰LÐ6ÔBà.ð 	ð 36×2CÑ2CÀFÓ2KÑ/Ð¨aØÐ5Ó5Ü3BÓ3DÐ" <Ñ0ä�7‰7�>‰>œ"Ÿ'™'Ÿ,™, t¬[Ó9×:Ñ:ÜŸ'™'Ÿ,™, t¬[Ó9‰KðnÜ-Ø1´;ñØJSðØWmñ�ð  ×.Ñ.¨{Ó;ÐØ6�LÐ6Ð$5Ð6ˆØ×!Ò!Ñ+ FÑ+ˆØ×!Ò!Ñ+ FÑ+Ð+øô ó nÜ  <´¨}¸FÐC`ÐBaÐabÐ!cÓdÐjmÐmûðnús   Â8D Ä
D,ÄD'Ä'D,c                óº   • [        U5       n[        R                  " U5      nSSS5        SW;   a  [        R                  " S5        US	 U$ ! , (       d  f       N/= f)zt
Loads a configuration file from a json file.

Args:
    path_json_file (`str`):
        The path to the json file.
NÚruntime_configzzThe configuration file contains a `runtime_config` key. This is ignored. Runtime configurations are only valid at runtime.)ri   r1   ÚloadrT   rU   )r   Úpath_json_filer   ÚfileÚjson_objects        r   rŠ   ÚPeftConfigMixin.from_json_file
  sV   € ô �.Ô! TÜŸ)š) D›/ˆK÷ "ð ˜{Ó*Ü�MŠMð Môð Ð,Ð-àÐ÷ "Õ!ús   ŒAÁ
Ac                óê   • 0 n0 n0 nUR                  5        HV  u  pVU[        R                  " [        5      R                  ;   a  XbU'   M3  U[        U R                  5      ;   a  XcU'   MR  XdU'   MX     X#U4$ r"   )rg   r   r   r	   r   rG   Ú__annotations__)r   r   r�   rŽ   Úother_kwargsr   rn   s          r   r‰   ÚPeftConfigMixin._split_kwargs  su   € à!#ÐØˆØˆà Ÿ,™,ž.‰JˆCØ”g×'Ò'¬Ó8×CÑCÓCØ.3 sÓ+Øœ˜S×0Ñ0Ó1Ó1Ø$)˜SÓ!à$)˜SÓ!ñ )ð &°\ÐAÐAr    c                óÜ  • UR                  SS 5      nUb  [        R                  R                  X5      OUn[        R                  R	                  [        R                  R                  U[
        5      5      (       a%  [        R                  R                  U[
        5      nO [        U[
        40 UD6nU R                  U5      nUS   $ ! [         a    [        S[
         SU S35      ef = f)Nr…   r†   r‡   rˆ   r   )
r5   rb   r8   rI   rc   r   r	   rS   rH   rŠ   )r   Úmodel_idr�   r…   r8   r�   r‘   s          r   Ú_get_peft_typeÚPeftConfigMixin._get_peft_type/  sÐ   € ð +×.Ñ.¨{¸DÓAˆ	à4=Ñ4IŒr�w‰w�|‰|˜HÔ0Èxˆä�7‰7�>‰>œ"Ÿ'™'Ÿ,™, t¬[Ó9×:Ñ:ÜŸ'™'Ÿ,™, t¬[Ó9‰KðPÜ-ØÜñð -ñ�ð  ×.Ñ.¨{Ó;ÐØ  Ñ-Ð-øô	 ó PÜ  <´¨}¸FÀ8À*ÈAÐ!NÓOÐOðPús   Â#C
 Ã
!C+c                ó   • U$ )ztCheck kwargs before initializing the config instance.

Subclasses can override this method to add specific checks.

ru   )r   r   s     r   r‹   ÚPeftConfigMixin.check_kwargsH  s	   € ð ˆr    c                ó   • g)úF
Utility method to check if the configuration is for prompt learning.
Fru   rK   s    r   Úis_prompt_learningÚ"PeftConfigMixin.is_prompt_learningQ  s   € ð
 r    c                ó   • g)z1Return True if this is an adaption prompt config.Fru   rK   s    r   Úis_adaption_promptÚ"PeftConfigMixin.is_adaption_promptX  s   € ð r    )rD   )Úreturnrx   )r¬   Údict)rl   rx   r¬   ÚNoner"   )rŒ   rx   r…   rC   )r—   rx   )r    rx   ©r¬   Úbool)r{   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   rA   rœ   r   rB   rD   rM   ÚstaticmethodrJ   rY   rq   Úclassmethodr}   r’   rŠ   r‰   r¡   r‹   Úpropertyr§   rª   Ú__static_attributes__ru   r    r   r<   r<   L   s?  ‡ ññ %*°$À&ÐJ]ÐA^Ñ$_€IÐ!Ó_Ù$)°$À&ÐJcÐAdÑ$e€IÐ!ÓeÙ#(Ø Ð(oÐpñ$€L�.ó ñ #(°ÀÐHqÐ?rÑ"s€L�-Ósò9ð óó ðô*ôLðB ñ>ó ð>ð@ õ!,ó ð!,ðF óó ðð( ñBó ðBð ð.àó.ó ð.ð0 ñó ðð óó ðð óó ór    r<   c                  ó¦   • \ rS rSr% Sr\" SSS0S9rS\S'   \" SSS	0S9rS\S
'   \" SSS0S9r	S\S'   \" SSS0S9r
S\S'   \" SSS0S9rS\S'   Srg)Ú
PeftConfigi^  az  
This is the base configuration class to store the configuration of a [`PeftModel`].

Args:
    peft_type (Union[[`~peft.utils.config.PeftType`], `str`]): The type of Peft method to use.
    task_type (Union[[`~peft.utils.config.TaskType`], `str`]): The type of task to perform.
    inference_mode (`bool`, defaults to `False`): Whether to use the Peft model in inference mode.
Nr>   z"The name of the base model to use.r?   rC   Úbase_model_name_or_pathz'The specific base model version to use.Úrevisionz	Peft typezOptional[Union[str, PeftType]]r   z	Task typezOptional[Union[str, TaskType]]rA   FzWhether to use inference moder°   Úinference_moderu   )r{   r±   r²   r³   r´   r   r»   rœ   r¼   r   rA   r½   r¸   ru   r    r   rº   rº   ^  s†   ‡ ññ .3Ø Ð(LÐMñ.Ð˜]ó ñ $¨D¸FÐDmÐ;nÑo€HˆmÓoÙ05¸dÈfÐVaÐMbÑ0c€IÐ-ÓcÙ05¸dÈfÐVaÐMbÑ0c€IÐ-ÓcÙ ¨¸&ÐBaÐ9bÑc€N�DÖcr    rº   c                  óÖ   • \ rS rSr% Sr\" SSS0S9rS\S'   \" SSS	0S9rS\S
'   \" SSS0S9r	S\S'   \" SSS0S9r
S\S'   \" SSS0S9rS\S'   \" SSS0S9rS\S'   \SS j5       rSrg)ÚPromptLearningConfigir  a5  
This is the base configuration class to store the configuration of [`PrefixTuning`], [`PromptEncoder`], or
[`PromptTuning`].

Args:
    num_virtual_tokens (`int`): The number of virtual tokens to use.
    token_dim (`int`): The hidden embedding dimension of the base transformer model.
    num_transformer_submodules (`int`): The number of transformer submodules in the base transformer model.
    num_attention_heads (`int`): The number of attention heads in the base transformer model.
    num_layers (`int`): The number of layers in the base transformer model.
Nr>   zNumber of virtual tokensr?   ÚintÚnum_virtual_tokensz<The hidden embedding dimension of the base transformer modelÚ	token_dimz Number of transformer submoduleszOptional[int]Únum_transformer_submoduleszNumber of attention headsÚnum_attention_headszNumber of transformer layersÚ
num_layersa&  List of extra modules to be set as trainable and saved in the final checkpoint. For example, in Sequence Classification or Token Classification tasks, the final layer `classifier/score` are randomly initialized and as such need to be trainable and saved. The module(s) will be fully fine-tuned.zOptional[list[str]]Úmodules_to_savec                ó   • g)r¦   Tru   rK   s    r   r§   Ú'PromptLearningConfig.is_prompt_learning“  s   € ð
 r    ru   r¯   )r{   r±   r²   r³   r´   r   rÁ   rœ   rÂ   rÃ   rÄ   rÅ   rÆ   r·   r§   r¸   ru   r    r   r¿   r¿   r  sÃ   ‡ ñ
ñ $¨D¸FÐD^Ð;_Ñ`Ð˜Ó`ÙØ Ð(fÐgñ€Iˆsó ñ 16Ø Ð(JÐKñ1Ð ó ñ */°tÀvÐOjÐFkÑ)lÐ˜ÓlÙ %¨d¸fÐFdÐ=eÑ f€J�ÓfÙ+0Øàð 6ð
ñ,€OÐ(ó ð óó ór    r¿   )r$   rx   r¬   r°   )r6   rx   r¬   z
str | None)#Ú
__future__r   Úimportlib.metadatar+   r   r1   rb   rT   Údataclassesr   r   r   Útypingr   r   Úpackaging.versionr#   Úhuggingface_hubr	   Útransformers.utilsr
   r   rP   r   Úutilsr   r   r   ry   r   r'   r:   r<   rº   r¿   ru   r    r   Ú<module>rÑ      s¥   ðõ #ã Û Û Û 	Û ß 0Ñ 0ß "ã Ý +ß >å ç 2Ñ 2ð (˜=Ð ò%ô>ô
ð& ôN�nó Nó ðNðb ôd�ó dó ðdð& ô%˜:ó %ó ñ%r    