o
    i~                     @   s  d dl Z d dlZd dlZd dlZd dlZejddd d dlmZmZ zedZ	W n ey4   dZ	Y nw e 
eZdd	 Zd
d ZdZedddkZerQdZne rWdZnde	vrde	vrededfededfededfededfededfededfededfededfededfededfededfededfededfgZeej	Zee	ZdZeD ]\ZZeekreekrdZ nqerered ned ej	 d!e	 d" nvzZd d#lmZ eeejd$Zeed krGeD ]4Z e!d%e   zej"#e$e  W q e%y@ Z& zed&e  d'e&  W Y dZ&[&qdZ&[&ww d(d)l'm"Z" d d*l(T W n e%yg Z& ze!d+e&  W Y dZ&[&ndZ&[&ww d(d,l'm)Z) d d-l*m+Z+ d(d.l'm,Z,m-Z-m.Z.m/Z/ g d/Z0d0d1iZ1d2d3 Z2dS )4    Nignorez3Failed to initialize NumPy: No module named 'numpy')message)PackageNotFoundErrorversiontorchaounknownc                   C   s   t tjd S )Ngit_version)hasattrtorchr    r   r   D/home/ubuntu/.local/lib/python3.10/site-packages/torchao/__init__.py	is_fbcode   s   r   c                 C   sT   t td| }td| }|r#tt| \}}}|rd}|||gS td|  )z
    Parse version string representing pre-release with -1

    Examples: "2.5.0.dev20240708+cu121" -> [2, 5, -1], "2.5.0" -> [2, 5, 0]
    z	(git|dev)z(\d+)\.(\d+)\.(\d+)zInvalid version string format: )boolresearchmatchmapintgroups
ValueError)version_stringis_prereleaser   majorminorpatchr   r   r   _parse_version!   s   
r   F#TORCHAO_FORCE_SKIP_LOADING_SO_FILES01Tz+gitz0.13.0z2.8.0z0.14.0z0.14.1z2.9.0z
2.10.0.devz0.15.0z2.9.1z0.16.0z2.10.0z
2.11.0.devz
0.16.0.devz
0.17.0.devzNSkipping import of cpp extensions due to TORCHAO_FORCE_SKIP_LOADING_SO_FILES=1zDSkipping import of cpp extensions due to incompatible torch version z for torchao version zO             Please see https://github.com/pytorch/ao/issues/2919 for more info)Pathz_C*.sozLoading zFailed to load z:    )ops)*z#Skipping import of cpp extensions: )dtypes)	quantize_)optimquantizationswizzletesting)r$   	autoquantr&   r%   r(   r)   r"   r'   r*   ztorchao.quantization.autoquantc                 C   s@   | t v rdd l}t |  }||}t|| S tdtd| )Nr   zmodule z has no attribute )_lazy_imports	importlibimport_modulegetattrAttributeError__name__)namer,   module_pathmoduler   r   r   __getattr__   s   

r4   )3loggingosr   warningsr
   filterwarningsimportlib.metadatar   r   __version__	getLoggerr0   loggerr   r   skip_loading_so_filesgetenvforce_skip_loading_so_files#torchao_pytorch_compatible_versionscurrent_torch_versioncurrent_torchao_version	torchao_vtorch_vwarningpathlibr    list__file__parentglobso_fileslenfiledebugr"   load_librarystr	Exceptione torchao.csrc_meta_opsr$   torchao.quantizationr%   r&   r'   r(   r)   __all__r+   r4   r   r   r   r   <module>   s    

$