o
    ©Ì³iÜ  ã                   @   sH   d dl m Z  d dlZdedefdd„Zdd„ Zd	ed
edefdd„ZdS )é    )ÚdatetimeNÚversionÚreturnc                 C   s   | t jv p	t j| kS )ai  
    Check if torch version is greater than or equal to the given version.

    Args:
        version (str): The torch version to compare against

    Returns:
        bool: True if torch version is greater than or equal to the given version.

    Example:
        >>> print(torch.__version__)
        2.4.0
        >>> torch_version_ge("2.0")
        True
    )ÚtorchÚ__version__)r   © r   úL/home/ubuntu/.local/lib/python3.10/site-packages/torchtune/utils/_version.pyÚtorch_version_ge   s   r	   c                   C   s   t tjdƒ S )NÚgit_version)Úhasattrr   r   r   r   r   r   Ú
_is_fbcode   s   r   Úao_version_strÚdatec                 C   s0   t  |  d¡d  d¡d d¡}|t  |d¡kS )z¶
    Compare a torchao nightly version to a date of the form
    %Y-%m-%d.

    Returns True if the nightly version is greater than or equal to
        the date, False otherwise
    ú+r   Údevé   z%Y%m%dz%Y-%m-%d)r   ÚstrptimeÚsplit)r   r   Úao_datetimer   r   r   Ú_nightly_version_ge#   s   ÿr   )r   r   ÚstrÚboolr	   r   r   r   r   r   r   Ú<module>   s
   