
    ge                         d dl Zd dlmZ d dlmZmZ ddlmZ  eej	        
                    d                    Zdeeef         ded	efd
ZdedefdZdS )    N)Union)Versionparse   )STR_OPERATION_TO_FUNCtorchlibrary_or_version	operationrequirement_versionc                 `   |t          j                    vr3t          dt          t          j                               d|           t           |         }t	          | t
                    r,t          t          j        	                    |                     }  || t          |                    S )a  
    Compares a library version to some requirement using a given operation.

    Args:
        library_or_version (`str` or `packaging.version.Version`):
            A library name or a version to check.
        operation (`str`):
            A string representation of an operator, such as `">"` or `"<="`.
        requirement_version (`str`):
            The version to compare the library version against
    z`operation` must be one of z, received )
r   keys
ValueErrorlist
isinstancestrr   	importlibmetadataversion)r	   r
   r   s      U/var/www/html/ai-engine/env/lib/python3.11/site-packages/accelerate/utils/versions.pycompare_versionsr      s     -24444qt<Q<V<X<X7Y7Yqqfoqqrrr%i0I$c** S"9#5#=#=>P#Q#QRR9'/B)C)CDDD    r   c                 .    t          t          | |          S )a	  
    Compares the current PyTorch version to a given reference with an operation.

    Args:
        operation (`str`):
            A string representation of an operator, such as `">"` or `"<="`
        version (`str`):
            A string version of PyTorch
    )r   torch_version)r
   r   s     r   is_torch_versionr   .   s     M9g>>>r   )importlib.metadatar   typingr   packaging.versionr   r   	constantsr   r   r   r   r   r   r    r   r   <module>r       s              , , , , , , , , , , , , , , i(0099::EsG|)< E Ecf E E E E(
? 
?c 
? 
? 
? 
? 
? 
?r   