BjornNyberg / Geometric-Attributes-Toolbox

The Geometric Attributes toolbox is a set of QGIS tools designed for the geometric attribute and shape characterization of modern depositional elements
GNU General Public License v3.0
67 stars 8 forks source link

SAM - "WARNING! No GPU detected, reverting to CPU which may be slow..." #16

Open mvsc1 opened 1 year ago

mvsc1 commented 1 year ago

Windows 11 Python 3.9.12

Segment Anything Model (SAM) runs without GPU/cuda after being installed with Configure Segment Anything Model (SAM) in QGIS. It seems the configure tool installs its own torch 2.01 version which only runs on the CPU.

Before installation: PyTorch 2.0.1 with CUDA 11.8 installed - torch.cuda.is_available() returns True After installation: Another PyTorch 2.0.1 (without CUDA) is also installed - torch.cuda.is_available() returns False

If I uninstall torch 2.0.1 but keep torch 2.0.1 with cu118, the tool doesn't run anymore.

Any way to use the model with GPU in QGIS?

BjornNyberg commented 1 year ago

@mvsc1

This is indeed strange that PyTorch would be working prior to the configure tool and im not sure the source of this error. The configure tool here simply tries to utilize pip install samgeo which will install the SAM module directly from here.

Im not aware of any compatability issues between PyTorch and the underlying QGIS packages. Did you still have this issue?

CharlesGag commented 1 year ago

Windows 10 QGIS 3.30.3 Python 3.9.13

Hello,

I just installed it using through the QGIS app and I get this as well. Anything you want me to look at or change ?

Thank you so much for the great work.

jf-oshea commented 1 year ago

Windows 10 QGIS 3.30.3 Python 3.10.11

I'm also having this issue. Would love to see this working as intended. Looks dope.

BjornNyberg commented 1 year ago

Hi all,

I am looking into the issue. Seems to be some conflict with the libraries but im not sure which yet.

BjornNyberg commented 1 year ago

Unfortunately, I have not found a solution here. Any contributions/help related to this issue would be appreciated. Please keep in mind that the GPU will only be available for CUDA compatible devices.

One solution would be to create a bat file linked to anaconda for execution of the samgeo module to keep environments seperate.

BjornNyberg commented 11 months ago

Does a force reinstall of torch solve the issue here? i.e. from the OSGeo4W console type

pip3 install --force-reinstall torch