o
    oiR
                     @   sd   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m	Z	 d dl
mZmZ dd Zdd	 ZdS )
    N)PACKAGE_GITHUB_URL)get_cuda_specs)print_cuda_diagnosticsprint_cuda_runtime_diagnostics)print_dedentedprint_headerc            	      C   s   ddl m}  | d u rtd ddlm} tjtdd	 }tdd	 }|j
  }||g}|| }| }|  |  |j
  }||ksQJ d S )Nr   )liba  
            Couldn't load the bitsandbytes library, likely due to missing binaries.
            Please ensure bitsandbytes is properly installed.

            For source installations, compile the binaries with `cmake -DCOMPUTE_BACKEND=cuda -S .`.
            See the documentation for more details if needed.

            Trying a simple check anyway, but this will likely fail...
            )Adam
   )bitsandbytes.cextensionr   r   bitsandbytes.optimr	   torchnn	Parameterrandcudadatasumitembackwardstep)	r   r	   pap1adamoutlossp2 r   Q/home/ubuntu/.local/lib/python3.10/site-packages/bitsandbytes/diagnostics/main.pysanity_check   s    
r    c                  C   s  t d t d t d t d t } td|  tj s-td td td td | r3t|  t  t d t d	 t d td
 zt  td td W d S  t	ye   tdt
 d Y n tyq   t  Y nw tdt d td d S )N zBUG REPORT INFORMATIONOTHERzCUDA specs:z3Torch says CUDA is not available. Possible reasons:z1. CUDA driver not installedz2. CUDA not installedz/3. You have multiple conflicting CUDA librarieszDEBUG INFO ENDz?Checking that the library is importable and CUDA is callable...zSUCCESS!zInstallation was successful!z	WARNING: z is currently running as CPU-only!
Therefore, 8-bit optimizers and GPU quantization are unavailable.

If you think that this is so erroneously,
please report an issue!zm
        Above we output some debug information.
        Please provide this info when creating an issue via zy/issues/new/choose
        WARNING: Please be sure to sanitize sensitive info from the output before posting it.
           )r   r   printr   r   is_availabler   r   r    ImportError__package__	Exception	traceback	print_excr   r   sysexit)
cuda_specsr   r   r   main-   sH   


r.   )r+   r)   r   bitsandbytes.constsr   bitsandbytes.cuda_specsr   bitsandbytes.diagnostics.cudar   r   bitsandbytes.diagnostics.utilsr   r   r    r.   r   r   r   r   <module>   s    