
    khE                        d dl Z d dlZd dlZddlmZ dZd Z	 e j                  dk(  reej                  dk  rVe j                  d   Z
e
j                  d	      ZeD ]1  Ze j                  j                  e      s	  e j                  e       3  ed
      Zej$                  j'                  e       dZd Zd Zd Zd Z e        y# e$ r Y tw xY w# eef$ r Y %w xY w)    N   )_get_extension_pathFc                       y)NF r       Q/var/www/teggl/fontify/venv/lib/python3.12/site-packages/torchvision/extension.py_has_opsr	      s    r   nt)   	   PATH;_CTc                       y)NTr   r   r   r   r	   r	   %   s    r   c                  .    t               st        d      y )Na  Couldn't load custom C++ ops. This can happen if your PyTorch and torchvision versions are incompatible, or if you had errors while compiling torchvision from source. For further information on the compatible versions, check https://github.com/pytorch/vision#installation for the compatibility matrix. Please check your PyTorch version with torch.__version__ and your torchvision version with torchvision.__version__ and verify if they are compatible, and if not please reinstall torchvision so that it matches your PyTorch install.)r	   RuntimeErrorr   r   r   _assert_has_opsr   ,   s    :T
 	
 r   c                     t         syddlm}  t        j                  j
                  j                         }|dk7  r| t        |      }t        |      dk  rt        |d         }t        |d         }nt        |dd       }t        |d         }| j                  d      }t        |d         }t        |d         }||k7  rt        d	| d| d
| d| d	      |S )z`
    Make sure that CUDA versions match between the pytorch install and torchvision install
    r   )cudai'     r   .r   zqDetected that PyTorch and torchvision were compiled with different CUDA major versions. PyTorch has CUDA Version=z" and torchvision has CUDA Version=zE. Please reinstall the torchvision that matches your PyTorch install.)_HAS_OPStorch.versionr   torchopstorchvision_cuda_versionstrintsplitr   )torch_version_cuda_version
tv_versiontv_majortv_minor	t_versiont_majort_minors           r   _check_cuda_versionr*   9   s     8yy$$224H2~,8]
z?U":a=)H:a=)H:a?+H:a=)H&,,S1	il#il#h,,39AgY ?  (z8* 5VV  Or   c                 X    t        |       }t        j                  j                  |       y )N)r   r   r   load_library)lib_namelib_paths     r   _load_libraryr/   W   s    "8,H	II8$r   )ossysr   _internally_replaced_utilsr   r   r	   nameversion_infoenvironenv_pathr!   path_arrpathexistsadd_dll_directory	Exceptionr.   r   r,   ImportErrorOSErrorr   r*   r/   r   r   r   <module>r>      s    	 
  ; 	 
ww$3++f4::f%>>#& 	Dww~~d#(B((.	 #4(H	II8$H

<%
  } !  	W 		s6   AC 9C*C CC CC CC