
    謜i                        d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl	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 ddlmZ ddlmZmZ ddlmZ dd	lmZmZmZmZmZ dd
lm Z m!Z!  ejD                  e#      Z$de%de%fdZ& ejN                         Z(d Z)de%ejT                  z  ddfdZ+de%ejT                  z  de,e%   fdZ-de%ejT                  z  de,e%   fdZ.de%ejT                  z  de,e%   fdZ/de%ejT                  z  de,e%   fdZ0ddde%de%ejT                  z  de1de2fdZ3	 	 	 	 	 	 	 	 d1de%ejT                  z  de%de%ejT                  z  dz  de1de4e%e%f   dz  d e1e%z  dz  d!e%dz  d"e1d#e%dz  d$e%dz  de%fd%Z5	 	 	 	 	 	 	 	 d1d&e%de%ejT                  z  de%ejT                  z  dz  de1de4e%e%f   dz  d e1e%z  dz  d!e%dz  d"e1d#e%dz  d'e%dz  de2fd(Z6d2d)ed*e%ejT                  z  d+e4dz  de,e%   fd,Z7d- Z8d.Z9	 d3d/Z:d4d0Z;y)5z3Utilities 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_versionnamereturnc                 <   | j                  dd      j                  dd      }|r|d   j                         rd| }t        j                  |      rt        j                  d| d|  d	       |S |j                         st        j                  d| d|  d
       |S )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_r   _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     ]/mnt/e/genesis-system/.venv/lib/python3.12/site-packages/transformers/dynamic_module_utils.py_sanitize_module_namer"   1   s    " ||C)11#zBHHQK'')xj>"xjdV <H H	
 O ""$xjdV <H H	
 O    c                  <   t         t        j                  v ryt        j                  j                  t                t	        j
                  t         d       t        t               dz  } | j                         s%| j                          t        j                          yy)z_
    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_modulesr2   U   sj    
 388#HHOO$%KK 40%&6I##% r#   c                 X   t                t        t              | z  j                         }|j                  j                         st        |j                         t        j                  |d       |dz  }|j                         s%|j                          t        j                          yy)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)r2   r   r
   resolveparentr-   create_dynamic_moduler+   r,   r.   r/   r0   )r   dynamic_module_pathr1   s      r!   r6   r6   e   s      01D8AAC%%,,.1889KK#d3#m3I 	##%	 r#   module_filec                 ,   t        | d      5 }|j                         }ddd       t        j                  dt        j                        }|t        j                  d|t        j                        z  }t        t        |            S # 1 sw Y   lxY w)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)r8   fcontentrelative_importss       r!   get_relative_importsrH   {   s{     
kG	, &&( zz"=wbll[

#A7RTR^R^__$%&& s   B

Bc                 D   d}| g}g }|sg }|D ]  }|j                  t        |              t        |       j                  }|D cg c]  }t	        ||z         d }}|D cg c]	  }||vs| }}t        |      dk(  }|j                  |       |s|S c c}w c c}w )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   )extendrH   r   r5   strlen)	r8   	no_changefiles_to_checkall_relative_importsnew_importsrE   module_pathmnew_import_filess	            r!   get_relative_import_filesrU      s     I!]N  	8A3A67	8 ;'..BMNQs;?34C8NN%5WBV9V!WW'1,	##N3    OWs   B$	B.Bfilenamec                     t        | d      5 }|j                         }ddd       t               ddlfdt	        j
                        } |       t              S # 1 sw Y   FxY w)a  
    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                 v   t        | t        j                        ry t        | t        j                        r| j                  }t        j
                  |      D ]x  }t        |t        j                        st        |j                  dd      }|j                  d      r|j                  d      s!t        	j                  j                  |      sx y  nt        | t        j                        rD| j                  D ]4  }|j                   j#                  d      d   }|s$j%                  |       6 nft        | t        j&                        rL| j(                  dk(  r=| j*                  r1| j*                  j#                  d      d   }|rj%                  |       t        j,                  |       D ]
  } |        y )Nid 	availableis_flash_attnr   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)
nodera   condition_nodecheck_functionalias
top_modulechildimported_modulesrecursive_look_for_importstransformerss
          r!   rz   z/get_imports.<locals>.recursive_look_for_imports   sW   dCGG$cff%99D"%((4. 
nchh7%,^-@-@$%KN&//<*55oF"<#5#5#B#BNS 
 cjj) 5"ZZ--c215
$((45 cnn-zzQ4;;![[..s3A6
$((4 ))$/ 	.E&u-	.r#   )r>   r?   rD   transformers.utilsr^   parsesorted)rV   rE   rF   treery   rz   r{   s       @@@r!   get_importsr      sg     
h	) Q&&(u.B 99WDt$"##U s   A''A0c                    t        |       }g }|D ]  }	 t        j                  |        t        |      dkD  r0t        ddj                  |       dd	j                  |       d
      t        |       S # t        $ rE}t        j                  d| d|        dt        |      v r|j                  |       n Y d}~d}~ww xY w)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  `)r   r/   import_moduleImportErrorr   r   rL   r*   rM   joinrH   )rV   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   A44	C=;B==CFforce_reload
class_namerR   r   c          
         t         j                  j                  |      }|j                  d      }|j	                  t         j                  j
                  d      }t        t              |z  }t        5  |r4t        j                  j                  |d       t        j                          t        j                  j                  |      }t        j                  j!                  ||      }|gt#        t%        t        t'        |                  z   }t)        j*                  dj-                  d |D                    j/                         }|3t        j                  j1                  |      }	|	t        j                  |<   n|}	t3        |	dd      |k7  r"|j4                  j7                  |	       ||	_        t3        |	|       cddd       S # 1 sw Y   yxY w)	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.
    rJ   r   N)locationr#   c              3   T   K   | ]   }t        |      |j                         z    " y wN)bytes
read_bytes).0rE   s     r!   	<genexpr>z&get_class_in_module.<locals>.<genexpr>*  s      2cQR58alln3L2cs   &(__transformers_module_hash__rZ   )r+   r)   normpathremovesuffixr   sepr   r
   _HF_REMOTE_CODE_LOCKr(   modulespopr/   r0   getutilspec_from_file_locationr~   maprU   hashlibsha256r   	hexdigestmodule_from_specrd   loaderexec_moduler   )
r   rR   r   r   r8   cached_modulemodule_specmodule_filesmodule_hashrq   s
             r!   get_class_in_moduler   
  sc   & 77K(DU#D<<S)D-.<K	 +KKOOD$''')+.;;??4+@nn<<TK<X %0=6#dD]^iDj:k3l#l">>#((2cVb2c*cdnnp  ^^44[AF &CKK"F692>+M**622=F/vz*-+ + +s   3E
GGpretrained_model_name_or_path	cache_dirforce_downloadproxiestokenrevisionlocal_files_only	repo_type_commit_hashc
                    t               r|st        j                  d       d}t        |       } t        j
                  j                  |       }|r)t        t        j
                  j                  |             }nVt        j
                  j                  j                  t        t        | j                  d                  }t        | |||	|      }g }	 t        | |||||||||	
      }|s|k7  r|j                  |       t#        |      }t$        t        j
                  j                  z   |z   }t'        |       t)        t*              |z  }|t        t        j
                  j                  |             k(  r)||z  j-                         r"t/        j0                  |t        ||z              sM||z  j2                  j5                  dd	       t7        j8                  |||z         t;        j<                          |D ]  }t)        |      j2                  | d
z  }t        j
                  j                  | |      }||z  j-                         r#t/        j0                  |t        ||z              rtt7        j8                  |||z         t;        j<                           nt?        ||	      }||z  }|t        j
                  j                  z   |z   }t        j
                  j                  ||      }t'        t)        |      j2                         ||z  j-                         s-t7        j8                  |||z         t;        j<                          |D ]g  }||z  j2                  | d
z  j-                         r'tA        | t)        |      j2                  |z   d
|||||||	       |j                  | d
       i tC        |      dkD  rP|Ndj                  |D cg c]  }d| 	 c}      }|dn| d}d| |  }t        jE                  d| d| d       t        j
                  j                  ||      S # t         $ r t        j                  d| d|  d        w xY wc c}w )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=TrueT/)r   r   r   )r   r   r   r   r   r   r   r   zCould not locate the z inside r   )parentsr&   rJ   )r   r   r   r   r   r   r   r   
z- rZ   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   inforL   r+   r)   isdirr"   basenamer   r   r   rm   r   r   r*   OSErrorr   r   r6   r   r
   r-   filecmpcmpr5   mkdirshutilcopyr/   r0   r   get_cached_module_filerM   r   )r   r8   r   r   r   r   r   r   r   r   deprecated_kwargs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_pathrE   repo_type_strurls                             r!   r   r   :  s(   t !1AB %((E$F!ww}}:;H)"''*:*:;X*YZ	GGKK$$S)>@]@c@cdg@h%ij	.);)Vbnw
 I*))-% 
 M-AA[) ##78N 6CiON.)*+n<N)"''*:*:;X*YZZ ,446gkk #n{&B"C?
 k)1177t7TKK,n{.JK'')+ 	.M -44-7LLM!#.K]!["]2::<GKK"C(F$GE .0NO++-	. **>M (+5'"''++5C*,'',,~{*S'd#BCJJK,446KK,n{.JK'')+ 	8M#k199}oS<QQYY[&1K(//-?@D'#1#%%5!,
   M?#!67	8 9~h.II;AA3x;<	'/	{"5E'7T6UVGuCPY{AA	
 77<<44I  +K=A^@__`abv <s   -P9 Q#9'Q class_referencecode_revisionc
                     d| v r| j                  d      \  }} n|}| j                  d      \  }}|	||k(  r|}	t        ||dz   |||||	||	      }t        |||      S )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   rJ   )r   r   r   r   r   r   r   r   )rm   r   r   )r   r   r   r   r   r   r   r   r   r   kwargsrepo_idr8   r   final_modules                  r!   get_class_from_dynamic_moduler     s    n #2#8#8#> /-33C8K!>'!I )e%)
L z<nUUr#   objfolderconfigc                 \     j                   dk(  rt        j                  d  d| d       y fd}t        |t        t
        f      r|D ]
  } ||        n
| ||       g }t        j                   j                      j                  }t        |      t        |      j                  z  }t        j                  ||       |j                  |       t        |      D ]J  }t        |      t        |      j                  z  }t        j                  ||       |j                  |       L |S )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                    
j                   j                  }|j                  d      d   }| d
j                   j                   }d|v rd }d }
j                   j                  j	                  d      rf| d
j                   j                   }t        
dd       Yt        
d      }|j                  }|j                  d      d   }| d|j                   }n| d
j                   j                   }||f}t        | t              r'| j                  di       }	||	
j                  <   |	| d<   y t        | dd       || j                  
j                  <   y 
j                  |i| _
        y )Nr   	TokenizerFastslow_tokenizer_classauto_map)	__class__
__module__rm   __name__rf   rd   r]   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_configz3custom_object_save.<locals>._set_auto_map_in_config`  sq   mm..!'',R0"m1S]]%;%;$<=	)##' #' }}%%..v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$-/CDIgt${{:r2H(1HS__%"*GJWj$/;09GS__- #;Gr#   )r   r   r   r]   rC   tupler(   r   __file__r   r   r   r   r*   rU   )	r   r   r   r   cfgresultobject_file	dest_fileneeded_files	   `        r!   custom_object_saver   J  s    ~~#.se4x @ 	

 	<@ &4-( 	)C#C(	)		'F++cnn-66KV[ 1 6 67I
KKY'
MM) 1= !LD$5$:$:;	K+i !
 Mr#   c                     t        d      )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.)
ValueError)signumframes     r!   _raise_timeout_errorr     s    
	c r#      c                    |^|d| d| d| d}nOt         j                  j                  |      r'd| dt         j                  j                  |       d}n	d| d| d}| |rd} n|rt        d	kD  rd}	 t        j
                  t
        j                  t              }t        j                  t               | =t        | d
| d      }|j                         dv rd} n|j                         dv rd} | =t        j                  d	       	 |Ht        j
                  t
        j                  |       t        j                  d	       n|rt        dd       |r|s| st        | d
| d      | S # t        $ r t        | d
| d      w xY w# |:t        j
                  t
        j                  |       t        j                  d	       w w xY w)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/Fr   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0rZ   zS.
Please pass the argument `trust_remote_code=True` to allow custom code to be run.)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_coder    s   . $!*-RS`Ra b,,9?$@ 
 WW]]:&!* . ggooj9:$@  "* .,,6<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   6A?E/ 6E/ /F

F >Gc                    g }	 t        d| |d|}t        |d      5 }|j                         }ddd       |D ]  }|j                         }|r|j	                  d      r'	 t        |      \  }}}		 t        j                  j                  |      }
|E|	C t        j                  |      t        j                  |
      t        j                  |	            }nd}|r|j                  | d|
 d	        	 |r!t!        d
|  ddj#                  |      z         y# 1 sw Y   xY w# t        $ r
 |}d\  }}	Y w xY w# t        j                  j                  $ r |j                  | d       Y 7w xY w# t        $ r Y w xY w)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_idrV   rN#NNz (installed: None)Tz (installed: )z4Missing requirements in your local environment for `z`:
r    )r   r>   	readlinesstriprg   r   r   r/   metadatar   PackageNotFoundErrorr*   r   from_stringr}   r   r   r   )r  requirements_filer   failedrequirementsrE   requirementpackage_name	delimiterversion_numberlocal_package_versionis_satisfieds               r!   check_python_requirementsr-    s    F""i?M^ibhi,$ 	);;=L	) ( 	UK%++-K+"8"8"=7:OP[:\7i
(1(:(:(B(B<(P%
 $)CG0<<YGMM"78'--:W   $];P:QQRST5	U> B?BSSWX[_[d[dek[ll
 	
 E	) 	)  7*,6)	>7 %%:: -?@A  sp   E4 D1E4 !D&1D<AE4 E4 D#E4 &D96E4 8D99E4 <1E1-E4 0E11E4 4	F ?F )NFNNNFNNr   r  )zrequirements.txt)<__doc__r^   r   r   r/   importlib.metadataimportlib.utilr   r+   r@   r   r	  r(   	threadingpathlibr   typesr   typingr   huggingface_hubr   r   	packagingr   ri   r
   r   r   r   r   utils.import_utilsr   r   
get_loggerr   r   rL   r"   Lockr   r2   PathLiker6   rC   rH   rU   r   r   booltyper   r   r   r   r   r   r  r  r-  r  r#   r!   <module>r=     sj   : 
       	 	   
     C   I 
		H	%  B &y~~' & &bkk 1 &d &,'cBKK&7 'DI '* 3+<  c  @4$#+ 4$S	 4$n *C"++-  *$s)  *N 	-+-+r{{"-+ 	-+
 
-+f +/ %)#" #_5#&#4_5_5 R[[ 4'_5 	_5
 #s(^d"_5 #:_5 Dj_5 _5 Tz_5 *_5 	_5J +/ %)#"  $kVkV#&#4kV R[[ 4'kV 	kV
 #s(^d"kV #:kV DjkV kV TzkV :kV 
kV\IC Ir{{): ID4K I[_`c[d IX   gkRj5
r#   