+
    QV-jyŽ  ã                   óà  € R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RIt^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt ^ RIHtHt ^ RIHt ^RIHtHtHtHtHt ^RIH t H!t! ]PD                  ! ]#4      t$R	 R
 lt%]PL                  ! 4       t'R t(R R lt)R R lt*R R lt+R R lt,R R lt-RR/R R llt.R R lt/R%R R llt0R%R R llt1R&R  R! llt2R" t3^t4R'R# lt5R(R$ lt6R# ))z3Utilities to dynamically load objects from the Hub.N)ÚPath)Ú
ModuleType)ÚAny)Úis_offline_modeÚtry_to_load_from_cache)Úversion)ÚHF_MODULES_CACHEÚ TRANSFORMERS_DYNAMIC_MODULE_NAMEÚcached_fileÚextract_commit_hashÚlogging)ÚVersionComparisonÚsplit_package_versionc                ó0   € V ^8„  d   QhR\         R\         /# )é   ÚnameÚreturn)Ústr)Úformats   "Úr/Volumes/fast/ai/experiments/ui-tars-smoke/.venv/lib/python3.14/site-packages/transformers/dynamic_module_utils.pyÚ__annotate__r   1   s   € ÷ ñ ¤ð ¬ñ ó    c                óv  € V P                  RR4      P                  RR4      pV'       d#   V^ ,          P                  4       '       d   RV 2p\        P                  ! V4      '       d   \        P                  RV RV  R24       V# VP                  4       '       g   \        P                  RV RV  R	24       V# )
a¸  
Tries to sanitize a module name so that it can be used as a Python module.

The following transformations are applied:

1. Replace `.` in module names with `_dot_`.
2. Replace `-` in module names with `_hyphen_`.
3. If the module name starts with a digit, prepend it with `_`.
4. Warn if the sanitized name is a Python reserved keyword or not a valid identifier.

If the input name is already a valid identifier, it is returned unchanged.
Ú.Ú_dot_Ú-Ú_hyphen_Ú_zThe module name z (originally z\) is a reserved keyword in Python. Please rename the original module to avoid import issues.z]) is not a valid Python identifier. Please rename the original module to avoid import issues.)ÚreplaceÚisdigitÚkeywordÚ	iskeywordÚloggerÚwarningÚisidentifier)r   Únew_names   & r   Ú_sanitize_module_namer&   1   s»   € ð" �|‰|˜C Ó)×1Ñ1°#°zÓB€Hß�H˜Q•K×'Ñ'×)Ò)Ø�x�j�>ˆÜ×Ò˜×"Ò"Ü�‰Ø˜x˜j¨°d°Vð <Hð Hô	
ð €Oð ×"Ñ"×$Ò$Ü�‰Ø˜x˜j¨°d°Vð <Hð Hô	
ð €Or   c                 ó`  € \         \        P                  9   d   R# \        P                  P                  \         4       \        P
                  ! \         RR7       \        \         4      R,          p V P                  4       '       g(   V P                  4        \        P                  ! 4        R# R# )zW
Creates the cache directory for modules with an init, and adds it to the Python path.
NT©Úexist_okú__init__.py)r   ÚsysÚpathÚappendÚosÚmakedirsr   ÚexistsÚtouchÚ	importlibÚinvalidate_caches)Ú	init_paths    r   Úinit_hf_modulesr5   U   sm   € ô
 œ3Ÿ8™8Ô#Ùä‡H�H‡O�OÔ$Ô%Ü‡K‚KÔ ¨4Õ0ÜÔ%Ó&¨Õ6€IØ×Ñ×ÒØ�‰ÔÜ×#Ò#Ö%ñ r   c                óR   € V ^8„  d   QhR\         \        P                  ,          RR/# )r   r   r   N©r   r.   ÚPathLike)r   s   "r   r   r   e   s#   € ÷ &ñ &¤¤b§k¡kÕ 1ð &°dñ &r   c                óˆ  € \        4        \        \        4      V ,          P                  4       pVP                  P                  4       '       g   \        VP                  4       \        P                  ! VRR7       VR,          pVP                  4       '       g(   VP                  4        \        P                  ! 4        R# R# )zš
Creates a dynamic module in the cache directory for modules.

Args:
    name (`str` or `os.PathLike`):
        The name of the dynamic module to create.
Tr(   r*   N)r5   r   r   ÚresolveÚparentr0   Úcreate_dynamic_moduler.   r/   r1   r2   r3   )r   Údynamic_module_pathr4   s   &  r   r<   r<   e   s�   € ô ÔÜÔ 0Ó1°DÕ8×AÑAÓCÐà×%Ñ%×,Ñ,×.Ò.ÜÐ1×8Ñ8Ô9Ü‡K‚KÐ#¨dÕ3Ø# mÕ3€IØ×Ñ×ÒØ�‰Ôô 	×#Ò#Ö%ñ	 r   c                óp   € V ^8„  d   QhR\         \        P                  ,          R\        \         ,          /# ©r   Úmodule_filer   ©r   r.   r8   Úlist)r   s   "r   r   r   {   s'   € ÷ 'ñ '¤c¬B¯K©KÕ&7ð '¼DÄ½Iñ 'r   c                óV  € \        V RR7      ;_uu_ 4       pVP                  4       pRRR4       \        P                  ! RX\        P                  R7      pV\        P                  ! RV\        P                  R7      ,          p\        \        V4      4      #   + '       g   i     Ly; i)zÜ
Get the list of modules that are relatively imported in a module file.

Args:
    module_file (`str` or `os.PathLike`): The module file to inspect.

Returns:
    `list[str]`: The list of relative imports in the module.
úutf-8©ÚencodingNz^\s*import\s+\.(\S+)\s*$)Úflagsz^\s*from\s+\.(\S+)\s+import)ÚopenÚreadÚreÚfindallÚ	MULTILINErB   Úset)r@   ÚfÚcontentÚrelative_importss   &   r   Úget_relative_importsrQ   {   sw   € ô 
ˆk G×	,Õ	,°Ø—&‘&“(ˆ÷ 
-ô —z’zÐ"=¸wÌbÏlÉlÔ[ÐàœŸ
š
Ð#AÀ7ÔRT×R^ÑR^Ô_Õ_Ðä”Ð$Ó%Ó&Ð&÷ 
-×	,ús   –BÂB(	c                óp   € V ^8„  d   QhR\         \        P                  ,          R\        \         ,          /# r?   rA   )r   s   "r   r   r   �   s'   € ÷  ñ  ¬3´·±Õ+<ð  ÄÄcÅñ  r   c                óf  € RpV .p. pV'       g˜   . pV F  pVP                  \        V4      4       K  	  \        V 4      P                  pV Uu. uF  p\	        Wg,          4       R2NK  	  ppV Uu. uF  qUV9  g   K  VNK  	  pp\        V4      ^ 8H  pVP                  V4       KŸ  V# u upi u upi )a»  
Get the list of all files that are needed for a given module. Note that this function recurses through the relative
imports (if a imports b and b imports c, it will return module files for b and c).

Args:
    module_file (`str` or `os.PathLike`): The module file to inspect.

Returns:
    `list[str]`: The list of all relative imports a given module needs (recursively), which will give us the list
    of module files a given module needs.
Fú.py)ÚextendrQ   r   r;   r   Úlen)	r@   Ú	no_changeÚfiles_to_checkÚall_relative_importsÚnew_importsrN   Úmodule_pathÚmÚnew_import_filess	   &        r   Úget_relative_import_filesr^   �   s¾   € ð €IØ!�]€NØÐ÷ ØˆÛˆAØ×ÑÔ3°AÓ6Ö7ñ  ô ˜;Ó'×.Ñ.ˆÙBMÓNÁ+¸Qœs ;¥?Ó3Ð4°CÓ8Á+ÐÐNÙ%5ÓWÑ%5 ÐBVÑ9VŸ!˜!Ñ%5ˆÐWä˜Ó'¨1Ñ,ˆ	Ø×#Ñ# NÖ3àÐùò OùÚWs   ÁB)Á1B.Á>B.c                óp   € V ^8„  d   QhR\         \        P                  ,          R\        \         ,          /# ©r   Úfilenamer   rA   )r   s   "r   r   r   °   s'   € ÷ 4$ñ 4$œ#¤§¡Õ+ð 4$´´Sµ	ñ 4$r   c                ó  aaa€ \        V RR7      ;_uu_ 4       pVP                  4       pRRR4       \        4       o^ RIoVVV3R lo\        P
                  ! X4      pS! V4       \        S4      #   + '       g   i     LO; i)zú
Extracts all the libraries (not relative imports this time) that are imported in a file.

Args:
    filename (`str` or `os.PathLike`): The module file to inspect.

Returns:
    `list[str]`: The list of all packages required to use the input module.
rD   rE   Nc                 ó(  <€ \        V \        P                  4      '       d   R # \        V \        P                  4      '       d»   V P                  p\        P
                  ! V4       F“  p\        V\        P                  4      '       g   K%  \        VP                  RR4      pVP                  R4      '       d   VP                  R4      '       g)   \        S	P                  P                  V4      '       g   K’   R # 	  Mï\        V \        P                  4      '       dR   V P                   F@  pVP                   P#                  R4      ^ ,          pV'       g   K/  SP%                  V4       KB  	  M~\        V \        P&                  4      '       d_   V P(                  ^ 8X  dN   V P*                  '       d<   V P*                  P#                  R4      ^ ,          pV'       d   SP%                  V4       \        P,                  ! V 4       F  pS! V4       K  	  R # )NÚidÚ Ú	availableÚis_flash_attnr   )Ú
isinstanceÚastÚTryÚIfÚtestÚwalkÚCallÚgetattrÚfuncÚendswithÚ
startswithÚhasattrÚutilsÚimport_utilsÚImportÚnamesr   ÚsplitÚaddÚ
ImportFromÚlevelÚmoduleÚiter_child_nodes)
Únoderl   Úcondition_nodeÚcheck_functionÚaliasÚ
top_moduleÚchildÚimported_modulesÚrecursive_look_for_importsÚtransformerss
   &      €€€r   r…   Ú/get_imports.<locals>.recursive_look_for_importsÀ   sd  ø€ Ü�dœCŸG™G×$Ò$ÙÜ˜œcŸf™f×%Ò%Ø—9‘9ˆDÜ"%§(¢(¨4¦.�Ü˜n¬c¯h©h×7Ô7Ü%,¨^×-@Ñ-@À$ÈÓ%K�Nà&×/Ñ/°×<Ò<Ø*×5Ñ5°o×FÒFÜ" <×#5Ñ#5×#BÑ#BÀN×SÔSò ò #1ô ˜œcŸj™j×)Ò)àŸœ�Ø"ŸZ™Z×-Ñ-¨cÓ2°1Õ5�
ß‘:Ø$×(Ñ(¨Ö4ò $ô ˜œcŸn™n×-Ò-à�z‰z˜QŒ 4§;§; ;Ø!Ÿ[™[×.Ñ.¨sÓ3°AÕ6�
ßØ$×(Ñ(¨Ô4ô ×)Ò)¨$Ö/ˆEÙ& uÖ-ó 0r   )rH   rI   rM   Útransformers.utilsri   ÚparseÚsorted)ra   rN   rO   Útreer„   r…   r†   s   &   @@@r   Úget_importsrŒ   °   sc   ú€ ô 
ˆh ×	)Õ	)¨QØ—&‘&“(ˆ÷ 
*ä“uÐã÷.ôB �9Š9�WÓ€DÙ˜tÔ$äÐ"Ó#Ð#÷U 
*×	)ús   ™A1Á1B	c                óp   € V ^8„  d   QhR\         \        P                  ,          R\        \         ,          /# r`   rA   )r   s   "r   r   r   ç   s'   € ÷  *ñ  *œC¤"§+¡+Õ-ð  *´$´sµ)ñ  *r   c                óž  € \        V 4      p. pV F  p \        P                  ! V4       K  	  \        V4      ^ 8”  d1   \        RRP                  V4       RRP                  V4       R	24      h\        V 4      #   \         dI   p\        P                  RT RT 24       R\        T4      9   d   TP                  T4        Rp?K¶  h Rp?ii ; i)
a  
Check if the current Python environment contains all the libraries that are imported in a file. Will raise if a
library is missing.

Args:
    filename (`str` or `os.PathLike`): The module file to check.

Returns:
    `list[str]`: The list of relative imports in the file.
z&Encountered exception while importing z: zNo module namedNz\This modeling file requires the following packages that were not found in your environment: z, z. Run `pip install Ú Ú`)rŒ   r2   Úimport_moduleÚImportErrorr"   r#   r   r-   rV   ÚjoinrQ   )ra   ÚimportsÚmissing_packagesÚimpÚ	exceptions   &    r   Úcheck_importsr˜   ç   s×   € ô ˜(Ó#€GØÐÛˆð
	Ü×#Ò# CÖ(ñ ô ÐÓ˜qÔ ÜØjØ�y‰yÐ)Ó*Ð+Ð+>¸s¿x¹xÐHXÓ?YÐ>ZÐZ[ð]ó
ð 	
ô
   Ó)Ð)øô! ô 	Ü�N‰NÐCÀCÀ5ÈÈ9È+ÐVÔWð !¤C¨	£NÔ2Ø ×'Ñ'¨×,Ò,àûð	ús   ”A9Á9CÂ<CÃCÃCÚforce_reloadFc                ór   € V ^8„  d   QhR\         R\         \        P                  ,          R\        R\        /# )r   Ú
class_namer[   r™   r   )r   r.   r8   ÚboolÚtype)r   s   "r   r   r   
  s9   € ÷ -+ñ -+Üð-+ä”r—{‘{Õ"ð-+ô ð	-+ô
 
ñ-+r   c               óê  € \         P                  P                  V4      pVP                  R4      pVP	                  \         P                  P
                  R4      p\        \        4      V,          p\        ;_uu_ 4        V'       d6   \        P                  P                  VR4       \        P                  ! 4        \        P                  P                  V4      p\        P                  P!                  W4R7      pV.\#        \%        \        \'        V4      4      4      ,           p\(        P*                  ! RP-                  R V 4       4      4      P/                  4       pVf4   \        P                  P1                  V4      p	V	\        P                  V&   MTp	\3        V	RR4      V8w  d"   VP4                  P7                  V	4       W‰n        \3        W�4      uuRRR4       #   + '       g   i     R# ; i)	aò  
Import a module on the cache directory for modules and extract a class from it.

Args:
    class_name (`str`): The name of the class to import.
    module_path (`str` or `os.PathLike`): The path to the module to import.
    force_reload (`bool`, *optional*, defaults to `False`):
        Whether to reload the dynamic module from file if it already exists in `sys.modules`.
        Otherwise, the module is only reloaded if the file has changed.

Returns:
    `typing.Type`: The class looked for.
rT   r   N)Úlocationr   c              3   ób   "  € T F%  p\        V4      VP                  4       ,           x € K'  	  R # 5i©N)ÚbytesÚ
read_bytes)Ú.0rN   s   & r   Ú	<genexpr>Ú&get_class_in_module.<locals>.<genexpr>*  s%   é € Ð2cÑVbÐQR´5¸³8¸a¿l¹l»n×3LÒ3LÓVbùs   ‚-/Ú__transformers_module_hash__re   )r.   r,   ÚnormpathÚremovesuffixr   Úsepr   r   Ú_HF_REMOTE_CODE_LOCKr+   ÚmodulesÚpopr2   r3   ÚgetÚutilÚspec_from_file_locationrŠ   Úmapr^   ÚhashlibÚsha256r“   Ú	hexdigestÚmodule_from_specro   ÚloaderÚexec_moduler§   )
r›   r[   r™   r   r@   Úcached_moduleÚmodule_specÚmodule_filesÚmodule_hashr|   s
   &&$       r   Úget_class_in_moduler¼   
  sZ  € ô& �7‰7×Ñ˜KÓ(€DØ×Ñ˜UÓ#€DØ�<‰<œŸ™Ÿ™ SÓ)€DÜÔ-Ó.°Õ<€Kß	Ö	ßÜ�K‰K�O‰O˜D $Ô'Ü×'Ò'Ô)Ü+.¯;©;¯?©?¸4Ó+@ˆÜ—n‘n×<Ñ<¸TÐ<ÓXˆð %0 =´6¼#¼dÔD]Ð^iÓDjÓ:kÓ3lÕ#lˆÜ"Ÿ>š>¨#¯(©(Ñ2cÑVbÓ2cÓ*cÓd×nÑnÓpˆð Ò Ü—^‘^×4Ñ4°[ÓAˆFà &ŒC�K‰K˜Òà"ˆFä�6Ð9¸2Ó>À+ÔMØ×Ñ×*Ñ*¨6Ô2Ø2=Ô/Ü�vÓ*÷- 
×	×	Ó	ús   Á?EG!Ç!G2	c                ó�   € V ^8„  d   QhR\         \        P                  ,          R\         \        P                  ,          R\         /# )r   Úpretrained_model_name_or_pathÚresolved_module_filer   r7   )r   s   "r   r   r   :  s8   € ÷ .ñ .Ü#&¬¯©Õ#4ð.ä¤§¡Õ+ð.ô 	ñ.r   c                ó  a	€ \        V 4      P                  4       o	\        V4      P                  4       pR V	3R llpV! V4      V3.p\        V4       F5  p\        V4      P                  4       pVP                  V! V4      V34       K7  	  \        P
                  ! 4       p\        VR R7       FD  w  rxVP                  VP                  R4      4       VP                  VP                  4       4       KF  	  VP                  4       R,          # )zf
Computes a stable hash from the bytes of the local source file and its relative-import source files.
c                ó0   € V ^8„  d   QhR\         R\        /# )r   Úsource_file_pathr   )r   r   )r   s   "r   r   Ú6_compute_local_source_files_hash.<locals>.__annotate__D  s   € ÷ /ñ /¼ð /Äñ /r   c                 ó†   <€  V P                  S4      P                  4       #   \         d    T P                  4       u # i ; ir¡   )Úrelative_toÚas_posixÚ
ValueError)rÂ   Ú
model_paths   &€r   Ú_resolve_relative_source_pathÚG_compute_local_source_files_hash.<locals>._resolve_relative_source_pathD  s@   ø€ ð	/Ø#×/Ñ/°
Ó;×DÑDÓFÐFøÜô 	/à#×,Ñ,Ó.Ò.ð	/ús   ƒ" ¢A ¿A c                 ó   € V ^ ,          # )é    © )Úentrys   &r   Ú<lambda>Ú2_compute_local_source_files_hash.<locals>.<lambda>S  s	   € ÈEÐRSÎHr   )ÚkeyrD   :Né   N)r   r:   r^   r-   r²   r³   rŠ   ÚupdateÚencoder£   r´   )
r¾   r¿   rÉ   Úfiles_to_hashÚsource_filerÂ   Úsource_files_hashÚrelative_pathÚ	file_pathrÈ   s
   &&       @r   Ú _compute_local_source_files_hashrÚ   :  sý   ø€ ô Ð3Ó4×<Ñ<Ó>€JÜÐ 4Ó5×=Ñ=Ó?Ð÷/ð /ñ 
'Ð';Ó	<Ð>RÐSð€Mô 1Ð1EÖFˆÜ Ó,×4Ñ4Ó6ÐØ×ÑÑ;Ð<LÓMÐO_Ð`Öañ Gô  ŸšÓ(ÐÜ$*¨=Ñ>T×$UÑ ˆØ× Ñ  ×!5Ñ!5°gÓ!>Ô?Ø× Ñ  ×!5Ñ!5Ó!7Ö8ñ %Vð ×&Ñ&Ó(¨Õ-Ð-r   c                ó|  € V ^8„  d   QhR\         \        P                  ,          R\         R\         \        P                  ,          R,          R\        R\        \         \         3,          R,          R\        \         ,          R,          R\         R,          R	\        R
\         R,          R\         R,          R\         /# )r   r¾   r@   Ú	cache_dirNÚforce_downloadÚproxiesÚtokenÚrevisionÚlocal_files_onlyÚ	repo_typeÚ_commit_hashr   )r   r.   r8   rœ   Údict)r   s   "r   r   r   Z  s¼   € ÷ g5ñ g5Ü#&¬¯©Õ#4ðg5äðg5ô ”R—[‘[Õ  4Õ'ðg5ô ð	g5ô
 ”#”s�(�^˜dÕ"ðg5ô ”#�:˜Õðg5ô �D�jðg5ô ðg5ô �T�zðg5ô ˜•*ðg5ô 	ñg5r   c
                ó¦
  € \        4       '       d    V'       g   \        P                  R4       Rp\        V 4      p \        P
                  P                  V 4      pRpV'       gU   \        P
                  P                  P                  \        \        V P                  R4      4      4      p\        WW)VR7      p. p \        V VVVVVVVVV	R7
      pV'       g   WÏ8w  d   VP                  V4       \!        T4      pT'       d‡   \        \        P
                  P#                  \        P
                  P%                  T 4      4      4      p\'        Y4      pT'       d-   \        P
                  P                  P                  TT.4      pMTp\(        \        P
                  P                  ,           X,           p\+        T4       \-        \.        4      T,          pT'       Eda   TT,          P1                  4       '       d.   \2        P4                  ! T\        TT,          4      4      '       gX   TT,          P6                  P9                  RRR
7       \:        P<                  ! TTT,          4       \>        P@                  ! 4        \C        T4       F®  p \-        T4      PE                  T 4      pTT,          pTP1                  4       '       d)   \2        P4                  ! T\        T4      4      '       d   Ke  TP6                  P9                  RRR
7       \:        P<                  ! TT4       \>        P@                  ! 4        K°  	  EMK\I        Yù4      pTT,          pT\        P
                  P                  ,           T,           p\        P
                  P                  TT4      p\+        \-        T4      P6                  4       TT,          P1                  4       '       g4   \:        P<                  ! TTT,          4       \>        P@                  ! 4        T F{  pTT,          P6                  T R2,          P1                  4       '       d   K6  \K        T \-        T4      P6                  T,           R2TTTTTTTR7	       TP                  T R24       K}  	  \M        T4      ^ 8”  dW   TfS   RP                  T Uu. uF  pRT 2NK
  	  up4      pTf   RMT R2pRT T  2p\        PO                  RT RT R24       \        P
                  P                  TT4      #   \         d    \        P                  RT RT  R	24       h i ; i  \F         d     EKÀ  i ; iu upi )aŠ  
Prepares Downloads a module from a local folder or a distant repo and returns its path inside the cached
Transformers module.

Args:
    pretrained_model_name_or_path (`str` or `os.PathLike`):
        This 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
          [`~PreTrainedTokenizer.save_pretrained`] method, e.g., `./my_model_directory/`.

    module_file (`str`):
        The name of the module file containing the class to look for.
    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 to (re-)download the configuration files and override the cached versions if they
        exist.
    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.
    token (`str` or *bool*, *optional*):
        The token to use as HTTP bearer authorization for remote files. If `True`, will use the token generated
        when running `hf auth login` (stored in `~/.huggingface`).
    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.
    local_files_only (`bool`, *optional*, defaults to `False`):
        If `True`, will only try to load the tokenizer configuration from local files.
    repo_type (`str`, *optional*):
        Specify the repo type (useful when downloading from a space for instance).

<Tip>

Passing `token=True` is required when you want to use a private model.

</Tip>

Returns:
    `str`: The path to the module inside the cache.
z+Offline mode: forcing local_files_only=TrueTNÚ/)rÜ   rà   râ   )rÜ   rÝ   rÞ   rá   rß   rà   râ   rã   zCould not locate the z inside r   )Úparentsr)   rT   )rÜ   rÝ   rÞ   rß   rà   rá   rã   Ú
z- re   zs/zhttps://huggingface.co/z9A new version of the following files was downloaded from z:
z–
. Make sure to double-check they do not contain any added malicious code. To avoid downloading new versions of the code file, you can pin a revision.)(r   r"   Úinfor   r.   r,   Úisdirrª   r“   r±   r&   rx   r   r
   r-   ÚOSErrorr˜   Úbasenamer¨   rÚ   r	   r<   r   r   r0   ÚfilecmpÚcmpr;   ÚmkdirÚshutilÚcopyfiler2   r3   r^   rÅ   rÇ   r   Úget_cached_module_filerV   r#   )r¾   r@   rÜ   rÝ   rÞ   rß   rà   rá   râ   rã   Údeprecated_kwargsÚis_localr¸   Ú	submoduleÚ	new_filesr¿   Úmodules_neededÚlocal_model_nameÚlocal_source_files_hashÚfull_submoduleÚsubmodule_pathrÖ   Úmodule_neededÚtarget_pathÚcommit_hashÚfull_submodule_module_file_pathrN   Úrepo_type_strÚurls   &&&&&&&&&&,                  r   rò   rò   Z  ss  € ôt ×Ò×!1Ü�‰ÐAÔBØÐô %(Ð(EÓ$FÐ!Ü�w‰w�}‰}Ð:Ó;€HØ€MßÜ—G‘G—K‘K×$Ñ$¤SÔ)>Ð@]×@cÑ@cÐdgÓ@hÓ%iÓjˆ	Ü.Ø)À)Ðnwô
ˆð €Iðä*Ø)ØØØ)ØØ-ØØØØ%ô 
Ð÷ ˜MÔAØ×Ñ˜[Ô)ô #Ð#7Ó8€NßÜ0´·±×1AÑ1AÄ"Ç'Á'×BRÑBRÐSpÓBqÓ1rÓsÐÜ"BÐC`Ó"wÐßÜŸ™Ÿ™×(Ñ(Ð*:Ð<SÐ)TÓU‰Ià/ˆIô 6¼¿¹¿¹ÕCÀiÕO€NÜ˜.Ô)ÜÔ*Ó+¨nÕ<€Nß€xð  Õ,×4Ñ4×6Ò6¼g¿kºkØ ¤# n°{Õ&BÓ"C÷?
ò ?
ð ˜kÕ)×1Ñ1×7Ñ7ÀÈtÐ7ÔTÜ�OŠOÐ0°.À;Õ2NÔOÜ×'Ò'Ô)Ü4Ð5IÖJˆKðÜ $ [Ó 1× =Ñ =Ð>[Ó \�Ø,¨}Õ<�ð ×%Ñ%×'Ò'¬w¯{ª{¸;ÌÈKÓHX×/YÔ/YØ×"Ñ"×(Ñ(°ÀÐ(ÔEÜ—’ ¨[Ô9Ü×+Ò+Ö-ó Kô *Ð*>ÓMˆð (¨+Õ5ˆØ'¬"¯'©'¯+©+Õ5¸ÕCˆÜ*,¯'©'¯,©,°~À{Ó*SÐ'ÜœdÐ#BÓC×JÑJÔKà Õ,×4Ñ4×6Ò6Ü�OŠOÐ0°.À;Õ2NÔOÜ×'Ò'Ô)ã+ˆMØ# kÕ1×9Ñ9¸}¸oÈSÐ<QÕQ×YÑY×[Ô[Ü&Ø1Ü˜KÓ(×/Ñ/°-Õ?Ð@ÀÐDØ'Ø#1Ø#ØØ%Ø%5Ø!,õ
ð × Ñ  M ?°#Ð!6Ö7ñ ,ô ˆ9ƒ~˜Ô˜hÒ.Ø—I‘I±Ó;±¨A  A 3›x±Ñ;Ó<ˆ	Ø'Ò/™¸	°{À"Ð5EˆØ'¨ Ð7TÐ6UÐVˆÜ�‰ØGÈÀuÈCÐPYÈ{ðAðAô	
ô �7‰7�<‰<˜¨Ó4Ð4øô[ ô Ü�‰Ð+¨K¨=¸ÐA^Ð@_Ð_`ÐaÔbØðûô> ô ÛðüòJ <s$   Â;4T Ê#T;Ò,UÔ)T8Ô;UÕ
Uc                ó|  € V ^8„  d   QhR\         R\         \        P                  ,          R\         \        P                  ,          R,          R\        R\        \         \         3,          R,          R\        \         ,          R,          R\         R,          R	\        R
\         R,          R\         R,          R\
        /# )r   Úclass_referencer¾   rÜ   NrÝ   rÞ   rß   rà   rá   râ   Úcode_revisionr   )r   r.   r8   rœ   rä   r�   )r   s   "r   r   r     sÉ   € ÷ kVñ kVÜðkVä#&¬¯©Õ#4ðkVô ”R—[‘[Õ  4Õ'ðkVô ð	kVô
 ”#”s�(�^˜dÕ"ðkVô ”#�:˜ÕðkVô �D�jðkVô ðkVô �T�zðkVô ˜•:ðkVô 
ñkVr   c
                óÊ   € RV 9   d   V P                  R4      w  r°MTpV P                  R4      w  rÍV	f	   W8X  d   Tp	\        VVR,           VVVVV	VVR7	      p\        WÞVR7      # )aª  
Extracts a class from a module file, present in the local folder or repository of a model.

<Tip warning={true}>

Calling this function will execute the code in the module file found locally or downloaded from the Hub. It should
therefore only be called on trusted repos.

</Tip>



Args:
    class_reference (`str`):
        The full name of the class to load, including its module and optionally its repo.
    pretrained_model_name_or_path (`str` or `os.PathLike`):
        This 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
          [`~PreTrainedTokenizer.save_pretrained`] method, e.g., `./my_model_directory/`.

        This is used when `class_reference` does not specify another repo.
    module_file (`str`):
        The name of the module file containing the class to look for.
    class_name (`str`):
        The name of the class to import in the module.
    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 to (re-)download the configuration files and override the cached versions if they
        exist.
    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.
    token (`str` or `bool`, *optional*):
        The token to use as HTTP bearer authorization for remote files. If `True`, will use the token generated
        when running `hf auth login` (stored in `~/.huggingface`).
    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.
    local_files_only (`bool`, *optional*, defaults to `False`):
        If `True`, will only try to load the tokenizer configuration from local files.
    repo_type (`str`, *optional*):
        Specify the repo type (useful when downloading from a space for instance).
    code_revision (`str`, *optional*, defaults to `"main"`):
        The specific revision to use for the code on the Hub, if the code leaves in a different repository than the
        rest of the model. 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.

<Tip>

Passing `token=True` is required when you want to use a private model.

</Tip>

Returns:
    `typing.Type`: The class, dynamically imported from the module.

Examples:

```python
# Download module `modeling.py` from huggingface.co and cache then extract the class `MyBertModel` from this
# module.
cls = get_class_from_dynamic_module("modeling.MyBertModel", "sgugger/my-bert-model")

# Download module `modeling.py` from a given repo and cache then extract the class `MyBertModel` from this
# module.
cls = get_class_from_dynamic_module("sgugger/my-bert-model--modeling.MyBertModel", "sgugger/another-bert-model")
```z--r   rT   )rÜ   rÝ   rÞ   rß   rà   rá   râ   )r™   )rx   rò   r¼   )r  r¾   rÜ   rÝ   rÞ   rß   rà   rá   râ   r  ÚkwargsÚrepo_idr@   r›   Úfinal_modules   &&&&&&&&&&,    r   Úget_class_from_dynamic_moduler	    s„   € ðn ˆÔØ#2×#8Ñ#8¸Ó#>Ñ ˆ�à/ˆØ-×3Ñ3°CÓ8Ñ€KàÒÐ!>Ô!IØ ˆä)ØØ�eÕØØ%ØØØØ)Øô
€Lô ˜zÀnÔUÐUr   c          	      ó–   € V ^8„  d   QhR\         R\        \        P                  ,          R\        R,          R\
        \        ,          /# )r   ÚobjÚfolderÚconfigNr   )r   r   r.   r8   rä   rB   )r   s   "r   r   r   r  sB   € ÷ Iñ IœCð I¬¬r¯{©{Õ):ð IÄDÈ4ÅKð IÔ[_Ô`cÕ[dñ Ir   c                ó”  a € S P                   R8X  d   \        P                  RS  RV R24       R# V 3R lp\        V\        \
        34      '       d   V F  pV! V4       K  	  MVe	   V! V4       . p\        P                  S P                   ,          P                  p\        V4      \        V4      P                  ,          p\        P                  ! Wg4       VP                  V4       \        V4       FO  p\        V4      \        V4      P                  ,          p\        P                  ! W‡4       VP                  V4       KQ  	  V# )aå  
Save the modeling files corresponding to a custom model/configuration/tokenizer etc. in a given folder. Optionally
adds the proper fields in a config.

Args:
    obj (`Any`): The object for which to save the module files.
    folder (`str` or `os.PathLike`): The folder where to save.
    config (`PreTrainedConfig` or dictionary, `optional`):
        A config in which to register the auto_map corresponding to this custom object.

Returns:
    `list[str]`: The list of files saved.
Ú__main__z We can't save the code defining z in z¢ as it's been defined in __main__. You should put this code in a separate module so we can include it in the saved folder and make it easier to share via the Hub.Nc                 ó
  <€ S
P                   P                  pVP                  R 4      R,          pV R S
P                   P                   2pRV9   dº   RpRpS
P                   P                  P	                  R4      '       dm   V R S
P                   P                   2p\        S
RR4      eB   \        S
R4      pVP                  pVP                  R 4      R,          pV R VP                   2pMV R S
P                   P                   2pWE3p\        V \        4      '       d'   V P                  R/ 4      p	W9S
P                  &   W�R&   R# \        V RR4      e   W0P                  S
P                  &   R# S
P                  V/V n
        R# )r   Ú	TokenizerNÚFastÚslow_tokenizer_classÚauto_mapéÿÿÿÿ)Ú	__class__Ú
__module__rx   Ú__name__rq   ro   rh   rä   r®   Ú_auto_classr  )Ú_configÚmodule_nameÚlast_moduleÚ	full_namer  Úfast_tokenizer_classÚslow_tokenizerÚslow_tok_module_nameÚlast_slow_tok_moduler  r  s   &         €r   Ú_set_auto_map_in_configÚ3custom_object_save.<locals>._set_auto_map_in_configˆ  so  ø€ Ø—m‘m×.Ñ.ˆØ!×'Ñ'¨Ó,¨RÕ0ˆØ"�m 1 S§]¡]×%;Ñ%;Ð$<Ð=ˆ	à˜)Ô#Ø#'Ð Ø#'Ð Ø�}‰}×%Ñ%×.Ñ.¨v×6Ò6à*5¨°a¸¿¹×8NÑ8NÐ7OÐ'PÐ$Ü˜3Ð 6¸Ó=ÒIÜ%,¨SÐ2HÓ%I�NØ+9×+DÑ+DÐ(Ø+?×+EÑ+EÀcÓ+JÈ2Õ+NÐ(Ø.BÐ-CÀ1À^×E\ÑE\ÐD]Ð+^Ð(øð +6¨°a¸¿¹×8NÑ8NÐ7OÐ'PÐ$à-ÐDˆIä�gœt×$Ò$Ø—{‘{ :¨rÓ2ˆHØ(1�S—_‘_Ñ%Ø"*�JÓÜ�W˜j¨$Ó/Ò;Ø09×Ñ˜SŸ_™_Ó-à #§¡°Ð;ˆGÖr   )r  r"   r#   rh   rB   Útupler+   r¬   Ú__file__r   r   rð   rñ   r-   r^   )	r  r  r  r"  ÚcfgÚresultÚobject_fileÚ	dest_fileÚneeded_files	   f&&      r   Úcustom_object_saver+  r  s
  ø€ ð ‡~�~˜Ô#Ü�‰Ø.¨s¨e°4¸°xð @ð ô	
ñ
 	õ<ô@ �&œ4¤˜-×(Ò(ÛˆCÙ# CÖ(ò à	Ò	Ù Ô'à€Fä—+‘+˜cŸn™nÕ-×6Ñ6€KÜ�V“¤ [Ó 1× 6Ñ 6Õ7€IÜ
‡O‚O�KÔ+Ø
‡M�M�)Ôô 1°Ö=ˆÜ˜“L¤D¨Ó$5×$:Ñ$:Õ;ˆ	Ü�Š˜Ô/Ø�‰�iÖ ñ >ð
 €Mr   c                 ó   € \        R 4      h)z¿Loading this model requires you to execute custom code contained in the model repository on your local machine. Please set the option `trust_remote_code=True` to permit loading of this model.)rÇ   )ÚsignumÚframes   &&r   Ú_raise_timeout_errorr/  ¾  s   € Ü
ð	cóð r   c                ó2  € Vfg   Ve   RV RV RV R2pMU\         P                  P                  V4      '       d(   RV R\         P                  P                  V4       R2pM	RV RV R2pV Ef   V'       d   Rp EMV'       dò   \        ^ 8”  dç   Rp \
        P
                  ! \
        P                  \        4      p\
        P                  ! \        4       V fF   \        V R	V R
24      pVP                  4       R9   d   Rp K.  VP                  4       R9   g   KE  Rp KI  \
        P                  ! ^ 4        Te<   \
        P
                  ! \
        P                  T4       \
        P                  ! ^ 4       MV'       d   \        RR4       V'       d"   V'       g   V '       g   \        V R	V R24      hV #   \         d    \        T R	T R24      hi ; i  Te=   \
        P
                  ! \
        P                  T4       \
        P                  ! ^ 4       i i ; i)aÔ  
Resolves the `trust_remote_code` argument. If there is remote code to be loaded, the user must opt-in to loading
it.

Args:
    trust_remote_code (`bool` or `None`):
        User-defined `trust_remote_code` value.
    model_name (`str`):
        The name of the model repository in huggingface.co.
    has_local_code (`bool`):
        Whether the model has local code.
    has_remote_code (`bool`):
        Whether the model has remote code.
    error_message (`str`, *optional*):
        Custom error message to display if there is remote code to load and the user didn't opt-in. If unset, the error
        message will be regarding loading a model with custom code.

Returns:
    The resolved `trust_remote_code` value.
NzThe repository z% references custom code contained in zm which must be executed to correctly load the model. You can inspect the repository content at https://hf.co/z .
zt contains custom code which must be executed to correctly load the model. You can inspect the repository content at z‚ contains custom code which must be executed to correctly load the model. You can inspect the repository content at https://hf.co/Fz9 You can inspect the repository content at https://hf.co/zƒ.
You can avoid this prompt in future by passing the argument `trust_remote_code=True`.

Do you wish to run the custom code? [y/N] TzS.
Please pass the argument `trust_remote_code=True` to allow custom code to be run.)ÚyesÚyÚ1)ÚnoÚnÚ0re   )r.   r,   rê   ÚabspathÚTIME_OUT_REMOTE_CODEÚsignalÚSIGALRMr/  ÚalarmÚinputÚlowerÚ	ExceptionrÇ   )Útrust_remote_codeÚ
model_nameÚhas_local_codeÚhas_remote_codeÚerror_messageÚupstream_repoÚprev_sig_handlerÚanswers   &&&&&&  r   Úresolve_trust_remote_coderG  È  s  € ð. ÒØÒ$à! * Ð-RÐS`ÐRað b,à,9¨?¸$ð@ñ ô
 �W‰W�]‰]˜:×&Ò&à! * ð .ä Ÿg™gŸo™o¨jÓ9Ð:¸$ð@ñ ð " * ð .,à,6¨<°tð=ð ð Ó ßØ %ÒßÔ!5¸Ô!9Ø#Ðð$Ü#)§=¢=´·±ÔAUÓ#VÐ Ü—’Ô1Ô2Ø'Ò/Ü"Ø(˜/Ð)bÐcmÐbnð oEð Fó�Fð
 —|‘|“~Ð):Ô:Ø,0Ò)ØŸ™›Ð+?Ö?Ø,1Ò)Ü—’˜Q•ð $Ò/Ü—M’M¤&§.¡.Ð2BÔCÜ—L’L ”Oøßä   tÔ,çŸ~×6GÜØˆoÐVÐWaÐVbð c`ð aó
ð 	
ð
 Ðøô) ô ä Ø$�oÐ%^Ð_iÐ^jð khð ióð ðûð $Ò/Ü—M’M¤&§.¡.Ð2BÔCÜ—L’L •Oð 0ús    ÂBF4 ÄF4 Æ4GÇG ÇAHc                ó�  € . p \        RRV RV/VB p\        VR4      ;_uu_ 4       pVP                  4       pRRR4       V FÝ  pVP                  4       pV'       d   VP	                  R4      '       d   K4   \        V4      w  rxp	 \        P                  P                  V4      p
TeT   T	eP   \        P                  ! T4      P                  \        P                  ! T
4      \        P                  ! T	4      4      pMRpT'       d   KÆ  TP                  T RT
 R	24       Kß  	  V'       d&   \#        R
V  R2RP%                  V4      ,           4      hR#   + '       g   i     EL#; i  \         d	    TpRRr˜ Lói ; i  \        P                  P                   d    TP                  T R24        EKq  i ; i  \          d     L¡i ; i)aÉ  
Tries to locate `requirements_file` in a local folder or repo, and confirms that the environment has all the
python dependencies installed.

Args:
    path_or_repo_id (`str` or `os.PathLike`):
        This can be either:
        - a string, the *model id* of a model repo on huggingface.co.
        - a path to a *directory* potentially containing the file.
    kwargs (`dict[str, Any]`, *optional*):
        Additional arguments to pass to `cached_file`.
Úpath_or_repo_idra   ÚrNÚ#z (installed: None)Tz (installed: Ú)z4Missing requirements in your local environment for `z`:
rè   rÍ   )r
   rH   Ú	readlinesÚstriprr   r   rÇ   r2   Úmetadatar   ÚPackageNotFoundErrorr-   r   Úfrom_stringÚvaluer‰   rë   r’   r“   )rI  Úrequirements_filer  ÚfailedÚrequirementsrN   ÚrequirementÚpackage_nameÚ	delimiterÚversion_numberÚlocal_package_versionÚis_satisfieds   &&,         r   Úcheck_python_requirementsr\    sµ  € ð €Fð"Ü"Ñi°?ÐiÐM^ÐiÐbhÑiˆÜ�, ×$Ô$¨ØŸ;™;›=ˆL÷ %ó (ˆKØ%×+Ñ+Ó-ˆKß +×"8Ñ"8¸×"=Ò"=Ùð7ä:OÐP[Ó:\Ñ7�¨ð
Ü(1×(:Ñ(:×(BÑ(BÀ<Ó(PÐ%ð
 Ò$¨Ò)CÜ0×<Ò<¸YÓG×MÑMÜ—M’MÐ"7Ó8¼'¿-º-ÈÓ:Wó ‘ð  $�ç‘<Ø—‘  ¨]Ð;PÐ:QÐQRÐSÖTñ5 (÷> ÜØBÀ?ÐBSÐSWÐXÐ[_×[dÑ[dÐekÓ[lÕló
ð 	
ñ ÷E %×$Ð$ûô ô 7Ø*�Ø,0°$š>ð7ûô ×%Ñ%×:Ñ:ô Ø—‘  Ð-?Ð@ÔAÛðûô ô Ùðúsv   „#F7 §E¸;F7 Á4F7 Á7E&ÂE<Â%AF7 ÄF7 ÅE#	Å	F7 Å&E9Å6F7 Å8E9Å9F7 Å<3F4Æ/F7 Æ3F4Æ4F7 Æ7GÇG)NFNNNFNNr¡   )NN)zrequirements.txt)7Ú__doc__ri   rí   r²   r2   Úimportlib.metadataÚimportlib.utilr    r.   rJ   rð   r9  r+   Ú	threadingÚpathlibr   Útypesr   Útypingr   Úhuggingface_hubr   r   Ú	packagingr   rt   r   r	   r
   r   r   Úutils.import_utilsr   r   Ú
get_loggerr  r"   r&   ÚLockr«   r5   r<   rQ   r^   rŒ   r˜   r¼   rÚ   rò   r	  r+  r/  r8  rG  r\  rÍ   r   r   Ú<module>ri     sÝ   ðñ :ã 
Û Û Û Û Û Û Û 	Û 	Û Û Û 
Û Ý Ý Ý ç CÝ ÷õ ÷ Ið 
×	Ò	˜HÓ	%€õðB !—~’~Ó'Ð ò&õ &õ,'õ* õ@4$õn *ðF-+ð ÷	-+õ`.÷@g5÷TkV÷\IòXð Ð ôRöj5
r   