
    eThw                     r   S r SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK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  SSKJr  SSKJrJrJr  SSKJr  SSKJr  SS	KJrJrJrJrJrJ r   SS
K!J"r"J#r#  \ RH                  " \%5      r&\RN                  " 5       r(S r)S\\*\RV                  4   SS4S jr,S\\*\RV                  4   S\-\*   4S jr.S\\*\RV                  4   S\-\*   4S jr/S\\*\RV                  4   S\-\*   4S jr0S\\*\RV                  4   S\-\*   4S jr1SS.S\*S\\*\RV                  4   S\2S\34S jjr4         S1S\\*\RV                  4   S\*S\\\*\RV                  4      S\2S\\2   S\\5\*\*4      S \\\2\*4      S!\\*   S"\2S#\\*   S$\\*   S\*4S% jjr6         S1S&\*S\\*\RV                  4   S\\\*\RV                  4      S\2S\\2   S\\5\*\*4      S \\\2\*4      S!\\*   S"\2S#\\*   S'\\*   S\34S( jjr7S2S)\S*\\*\RV                  4   S+\\5   S\-\*   4S, jjr8S- r9S.r:S2S/ jr;S3S0 jr<g)4z3Utilities to dynamically load objects from the Hub.    N)Path)
ModuleType)AnyOptionalUnion)try_to_load_from_cache)version   )HF_MODULES_CACHE TRANSFORMERS_DYNAMIC_MODULE_NAMEcached_fileextract_commit_hashis_offline_modelogging)VersionComparisonsplit_package_versionc                  H   [         [        R                  ;   a  g[        R                  R                  [         5        [        R
                  " [         SS9  [        [         5      S-  n U R                  5       (       d&  U R                  5         [        R                  " 5         gg)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    Y/var/www/auris/envauris/lib/python3.13/site-packages/transformers/dynamic_module_utils.pyinit_hf_modulesr"   3   sm    
 388#HHOO$%KK 40%&6I##%     namereturnc                 j   [        5         [        [        5      U -  R                  5       nUR                  R                  5       (       d  [        UR                  5        [        R                  " USS9  US-  nUR                  5       (       d&  UR                  5         [        R                  " 5         gg)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)r"   r   r   resolveparentr   create_dynamic_moduler   r   r   r   r   )r$   dynamic_module_pathr    s      r!   r)   r)   C   s      01D8AAC%%,,..1889KK#d3#m3I 	##%	 r#   module_filec                 (   [        U SS9 nUR                  5       nSSS5        [        R                  " SW[        R                  S9nU[        R                  " SU[        R                  S9-  n[        [        U5      5      $ ! , (       d  f       Nm= f)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	MULTILINElistset)r+   fcontentrelative_importss       r!   get_relative_importsr;   Y   st     
kG	,&&( 
- zz"=wbll[

#A7RTR^R^__$%&& 
-	,s   B
Bc                    SnU /n/ nU(       d  / nU H  nUR                  [        U5      5        M     [        U 5      R                  nU Vs/ s H  n[	        Xg-  5      PM     nnU Vs/ s H  oUU;  d  M
  UPM     nnU Vs/ s H  oU S3PM	     nn[        U5      S:H  nUR                  U5        U(       d  M  U$ s  snf s  snf s  snf )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.pyr   )extendr;   r   r(   strlen)	r+   	no_changefiles_to_checkall_relative_importsnew_importsr8   module_pathmnew_import_filess	            r!   get_relative_import_filesrH   n   s     I!]N A3A67   ;'..:EF+QC0+F'7Y'7!DX;XA'7Y-=>-=Cs)-=>()Q.	##N3 i   GY>s   B=*	C7CCfilenamec                    ^^^ [        U SS9 nUR                  5       nSSS5        [        5       mSSKmUUU4S jm[        R
                  " W5      nT" U5        [        T5      $ ! , (       d  f       NM= f)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.
r-   r.   Nr   c                   > [        U [        R                  5      (       a  g [        U [        R                  5      (       a  U R                  n[        R
                  " U5       H  n[        U[        R                  5      (       d  M$  [        UR                  SS5      nUR                  S5      (       a  UR                  S5      (       d'  [        T	R                  R                  U5      (       d  M    g    O[        U [        R                  5      (       aL  U R                   H;  nUR                   R#                  S5      S   nU(       d  M*  TR%                  U5        M=     Ov[        U [        R&                  5      (       aW  U R(                  S:X  aG  U R*                  (       a6  U R*                  R#                  S5      S   nU(       a  TR%                  U5        [        R,                  " U 5       H  nT" U5        M     g )Nid 	availableis_flash_attn.r   )
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)
noderU   condition_nodecheck_functionalias
top_modulechildimported_modulesrecursive_look_for_importstransformerss
          r!   rn   /get_imports.<locals>.recursive_look_for_imports   sb   dCGG$$cff%%99D"%((4.nchh77%,^-@-@$%KN&//<<*55oFF"<#5#5#B#BNSS  #1 cjj))"ZZ--c215
:$((4 $ cnn--zzQ4;;![[..s3A6
$((4 ))$/E&u- 0r#   )r1   r2   r7   transformers.utilsrR   parsesorted)rI   r8   r9   treerm   rn   ro   s       @@@r!   get_importsru      s`     
h	)Q&&( 
*u.B 99WDt$"##U 
*	)s   A&&
A4c                    [        U 5      n/ nU H  n [        R                  " U5        M     [        U5      S:  a0  [        SSR                  U5       SS	R                  U5       S
35      e[        U 5      $ ! [         aG  n[        R                  SU SU 35        S[        U5      ;   a  UR                  U5         SnAM  e SnAff = f)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 namedNr   z\This modeling file requires the following packages that were not found in your environment: z, z. Run `pip install  `)ru   r   import_moduleImportErrorloggerwarningr?   r   r@   joinr;   )rI   importsmissing_packagesimp	exceptions        r!   check_importsr      s     (#G
	##C(  q jyy)*++>sxxHX?Y>ZZ[]
 	

  ))!  	NNCC59+VW !C	N2 '',,	s   A88
C	;CCC	Fforce_reload
class_namerE   r   c          
         [         R                  R                  U5      nUR                  S5      (       a  USS nUR	                  [         R                  R
                  S5      n[        [        5      U-  n[           U(       a5  [        R                  R                  US5        [        R                  " 5         [        R                  R                  U5      n[        R                  R!                  X4S9nU/[#        [%        [        ['        U5      5      5      -   n[(        R*                  " SR-                  S U 5       5      5      R/                  5       nUc3  [        R                  R1                  U5      n	U	[        R                  U'   OUn	[3        U	SS	5      U:w  a!  UR4                  R7                  U	5        Xl        [3        X5      sSSS5        $ ! , (       d  f       g= f)
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.
r=   NrP   )locationr#   c              3   Z   #    U  H!  n[        U5      UR                  5       -   v   M#     g 7fN)bytes
read_bytes).0r8   s     r!   	<genexpr>&get_class_in_module.<locals>.<genexpr>
  s"     2cVbQR58alln3LVbs   )+__transformers_module_hash__rM   )r   r   normpathrZ   replacesepr   r   _HF_REMOTE_CODE_LOCKr   modulespopr   r   getutilspec_from_file_locationrs   maprH   hashlibsha256r}   	hexdigestmodule_from_specrX   loaderexec_moduler   )
r   rE   r   r$   r+   cached_modulemodule_specmodule_filesmodule_hashre   s
             r!   get_class_in_moduler      s^   & 77K(D}}UCRy<<S)D-.<K	KKOOD$''').1kkood.Cnn<<T<X %0=6#dD]^iDj:k3l#l">>#((2cVb2c*cdnnp  ^^44[AF &CKK"F692>+M**622=/v*- 
		s   =EG
G"pretrained_model_name_or_path	cache_dirforce_downloadresume_downloadproxiestokenrevisionlocal_files_only	repo_type_commit_hashc                    UR                  SS5      nUb+  [        R                  " S[        5        Ub  [	        S5      eUn[        5       (       a  U(       d  [        R                  S5        Sn[        U 5      n [        R                  R                  U 5      nU(       a   [        R                  R                  U 5      nO5U R                  S[        R                  R                  5      n[        XX*U	S9n/ n [!        U UUUUUUUUU	U
S	9nU(       d  WU:w  a  UR#                  U5        ['        U5      n[(        [        R                  R                  -   U-   n[+        U5        [-        [.        5      U-  nU[        R                  R                  U 5      :X  Ga  UU-  R1                  5       (       a(  [2        R4                  " U[        UU-  5      5      (       d/  [6        R8                  " UUU-  5        [:        R<                  " 5         U H  nU S3n[        R                  R?                  U U5      nUU-  R1                  5       (       a*  [2        R4                  " U[        UU-  5      5      (       a  Mj  [6        R8                  " UUU-  5        [:        R<                  " 5         M     GO[A        UU
5      nUU-  nU[        R                  R                  -   U-   n[        R                  R?                  UU5      n[+        [-        U5      RB                  5        UU-  R1                  5       (       d/  [6        R8                  " UUU-  5        [:        R<                  " 5         U HI  nUU S3-  R1                  5       (       a  M   [E        U U S3UUUUUUUUS9
  UR#                  U S35        MK     [G        U5      S:  aU  UcR  SR?                  U Vs/ s H  nSU 3PM
     sn5      nU	c  SOU	 S3nSU U  3n[        RI                  SU SU S35        [        R                  R?                  UU5      $ ! [$         a    [        R                  S
U SU  S35        e f = fs  snf )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.
    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.
    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 `huggingface-cli 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.
use_auth_tokenNrThe `use_auth_token` argument is deprecated and will be removed in v5 of Transformers. Please use `token` instead.V`token` and `use_auth_token` are both specified. Please set only the argument `token`.z+Offline mode: forcing local_files_only=TrueT/)r   r   r   )	r   r   r   r   r   r   r   r   r   zCould not locate the z inside rP   r=   )r   r   r   r   r   r   r   r   r   
z- rM   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   warningswarnFutureWarning
ValueErrorr   r{   infor?   r   r   isdirbasenamer   r   r   r   r   OSErrorr   r   r)   r   r   r   filecmpcmpshutilcopyr   r   r}   r   r(   get_cached_module_filer@   r|   )r   r+   r   r   r   r   r   r   r   r   r   deprecated_kwargsr   is_local	submoduler   	new_filesresolved_module_filemodules_neededfull_submodulesubmodule_pathmodule_neededmodule_needed_filecommit_hashfull_submodule_module_file_pathr8   repo_type_strurls                               r!   r   r     s   | '**+;TBN! A	
 uvv!1AB %((E$F!ww}}:;HGG$$%BC	199#rww{{K	.))nw
 I*))+-% 
 M-AA[) ##78N 6CiON.)*+n<NBGG$$%BCC ,4466gkk #n{&B"C?
 ?
 KK,n{.JK'')+M,oS1M!#.K]!["]2::<<GKK"C(F$GE E .0NO++- , **>M (+5'"''++5C*,'',,~{*S'd#BCJJK,4466KK,n{.JK'')+M"c%::BBDD&1$oS)'#1$3#%%5!,   M?#!67 ,  9~h.II;AA3x;<	'/	{"5E'7T6UVGuCPY{AA	
 77<<44I  +K=A^@__`abv <s   71P1 Q1(Qclass_referencecode_revisionc                 4   UR                  SS5      nUb+  [        R                  " S[        5        Ub  [	        S5      eUnSU ;   a  U R                  S5      u  pOUnU R                  S5      u  pU
c  X:X  a  Un
[        UUS-   UUUUUU
UU	S9
n[        UUUS	9$ )
aN  
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.
    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.
    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 `huggingface-cli 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")
```r   Nr   r   z--rP   r=   )r   r   r   r   r   r   r   r   r   )r   r   r   r   r   ra   r   r   )r   r   r   r   r   r   r   r   r   r   r   kwargsr   repo_idr+   r   final_modules                    r!   get_class_from_dynamic_moduler     s    t ZZ 0$7N! A	
 uvv #2#8#8#> /-33C8K!>!I )e%')L z<nUUr#   objfolderconfigc                 t  ^  T R                   S:X  a  [        R                  ST  SU S35        gU 4S jn[        U[        [
        45      (       a  U H  nU" U5        M     OUb  U" U5        / n[        R                  T R                      R                  n[        U5      [        U5      R                  -  n[        R                  " Xg5        UR                  U5        [        U5       HK  n[        U5      [        U5      R                  -  n[        R                  " X5        UR                  U5        MM     U$ )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                   > T
R                   R                  nUR                  S5      S   nU ST
R                   R                   3nSU;   a  S nS nT
R                   R                  R	                  S5      (       ag  U ST
R                   R                   3n[        T
SS 5      b=  [        T
S5      nUR                  nUR                  S5      S   nU SUR                   3nOU ST
R                   R                   3nXE4n[        U [        5      (       a%  U R                  S0 5      n	X9T
R                  '   XS'   g [        U SS 5      b  X0R                  T
R                  '   g T
R                  U0U l
        g )NrP   	TokenizerFastslow_tokenizer_classauto_map)	__class__
__module__ra   __name__rZ   rX   rQ   dictr   _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_config3custom_object_save.<locals>._set_auto_map_in_config^  so   mm..!'',R0"m1S]]%;%;$<=	)##' #' }}%%..v66*5a8N8N7O'P$3 6=I%,S2H%IN+9+D+D(+?+E+Ec+J2+N(.B-C1^E\E\D]+^( +6a8N8N7O'P$-DIgt$${{:r2H(1S__%"*JWj$/;09S__- #;Gr#   )r   r{   r|   rQ   r6   tupler   r   __file__r   r$   r   r   r   rH   )	r   r   r   r   cfgresultobject_file	dest_fileneeded_files	   `        r!   custom_object_saver   H  s
    ~~#.se4x @ 	

 	<@ &4-((C#C( 		'F++cnn-66KV[ 1 6 67I
KK'
MM) 1=LD$5$:$:;	K+i  >
 Mr#   c                     [        S5      e)NzLoading 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                 `   U=(       d    SU S3nU Gc  U(       a  Sn GOU(       a  [         S:  a  Sn [        R                  " [        R                  [        5      n[        R                  " [         5        U cC  [        U SU S35      nUR                  5       S;   a  S	n OUR                  5       S
;   a  Sn U c  MC  [        R                  " S5         Ub;  [        R                  " [        R                  U5        [        R                  " S5        OU(       a  [        SS5        U(       a  U(       d  U (       d  [        U SU S35      eU $ ! [         a    [        U SU S35      ef = f! Ub<  [        R                  " [        R                  U5        [        R                  " S5        f f = f)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.
zThe repository `zJ` contains custom code which must be executed to correctly load the model.NFr   z9 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] )yesy1T)non0rM   zS.
Please pass the argument `trust_remote_code=True` to allow custom code to be run.)	TIME_OUT_REMOTE_CODEsignalSIGALRMr   alarminputlower	Exceptionr   )trust_remote_code
model_namehas_local_codehas_remote_codeerror_messageprev_sig_handleranswers          r!   resolve_trust_remote_coder    s   . 	 	uj\)st 
   %!5!9#$#)==AU#V 12'/"(/)bcmbn oE FF
 ||~)::,0)+??,1) (/ Q $/MM&..2BCLLO t,~6GoVWaVb c` a
 	

 )   $o%^_i^j kh i  $/MM&..2BCLLO 0s   BE <E E))E, ,AF-c                 L   / n [        SXS.UD6n[        US5       nUR                  5       nSSS5        U H  nUR                  5       nU(       a  UR	                  S5      (       a  M2   [        U5      u  pxn	 [        R                  R                  U5      n
UbI  U	bF  [        R                  " U5      " [        R                  " U
5      [        R                  " U	5      5      nOSnU(       a  M  UR                  U SU
 S	35        M     U(       a!  [!        S
U  S3SR#                  U5      -   5      eg! , (       d  f       GN= f! [         a	    UnSu  p Nf = f! [        R                  R                   a    UR                  U S35         GMZ  f = f! [         a     Nf = f)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_idrI   rN#)NNz (installed: None)Tz (installed: )z4Missing requirements in your local environment for `z`:
r    )r   r1   	readlinesstripr[   r   r   r   metadatar	   PackageNotFoundErrorr   r   from_stringrr   r   rz   r}   )r  requirements_filer   failedrequirementsr8   requirementpackage_name	delimiterversion_numberlocal_package_versionis_satisfieds               r!   check_python_requirementsr)    s    F""i?ibhi,$;;=L % (K%++-K+"8"8"="=7:OP[:\7
(1(:(:(B(B<(P%
 $)C0<<YGMM"78'--:W   $<];P:QQRST5 (> B?BSSWX[_[d[dek[ll
 	
 E %$  7*,6)	>7 %%:: -?@A  sp   F D4<F +E:EAF 0F 4
E>F EF EF 2FF FF 
F#"F#)	NFNNNNFNNr   )zrequirements.txt)=__doc__rR   r   r   r   importlib.metadataimportlib.utilr   r3   r   r  r   	threadingr   pathlibr   typesr   typingr   r   r   huggingface_hubr   	packagingr	   r]   r   r   r   r   r   r   utils.import_utilsr   r   
get_loggerr   r{   Lockr   r"   r?   PathLiker)   r6   r;   rH   ru   r   booltyper   r   r   r   r   r   r  r  r)  r  r#   r!   <module>r9     s   : 
      	 	   
     ' ' 2   I 
		H	% ~~' & &c2;;&6 7 &D &,'eC,<&= '$s) '* 5bkk1A+B  tCy  B4$%R[[ 01 4$d3i 4$n *E#r{{"23  *S	  *N 	.+.+sBKK'(.+ 	.+
 
.+h 48 &*(,(,""#"&n5#(bkk)9#:n5n5 c2;;./0n5 	n5
 d^n5 d38n%n5 E$)$%n5 smn5 n5 }n5 3-n5 	n5h 48 &*(,(,""##'zVzV#(bkk)9#:zV c2;;./0zV 	zV
 d^zV d38n%zV E$)$%zV smzV zV }zV C=zV 
zVzIC IsBKK/?)@ I(SW. Idhildm IX  BJ5
r#   