Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] compute_patch_embeddings is not using GPU #5350

Open
dangom13 opened this issue Jan 6, 2025 · 1 comment
Open

[BUG] compute_patch_embeddings is not using GPU #5350

dangom13 opened this issue Jan 6, 2025 · 1 comment
Labels
bug Bug fixes

Comments

@dangom13
Copy link

dangom13 commented Jan 6, 2025

When computing embeddings, only CPU is used even though GPUs are available. I'm using the following code snippet:
embeddings_model = foz.load_zoo_model("zero-shot-classification-transformer-torch", name_or_path="google/siglip-so400m-patch14-384")
dataset.compute_patch_embeddings(embeddings_model, detections_field, embeddings_field=embeddings_field)

@dangom13 dangom13 added the bug Bug fixes label Jan 6, 2025
@Burhan-Q
Copy link
Contributor

Burhan-Q commented Feb 9, 2025

Assuming that's a transformers library model, if the hardware is there, you'll need to ensure that PyTorch with CUDA is installed in the same environment as fiftyone or the CPU will get used for computation. Check out the "Getting started locally" page from PyTorch on how to install with CUDA for your OS.

d, "device", default="cuda" if torch.cuda.is_available() else "cpu"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug fixes
Projects
None yet
Development

No branches or pull requests

2 participants