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

Add GPU acceleration via Pytorch #8

Open
0hq opened this issue Jul 3, 2023 · 1 comment
Open

Add GPU acceleration via Pytorch #8

0hq opened this issue Jul 3, 2023 · 1 comment

Comments

@0hq
Copy link
Owner

0hq commented Jul 3, 2023

Let's start GPU accelerating with a Pytorch index. Dot products/cosine similarity are both nearly equivalent to a matrix multiplication, so using hardware accelerators seems to be useful here. On 32 GB of VRAM, we could fit 22 million MiniLM embeddings (384 dimensions on f32 precision) on a single GPU.

@go-noah
Copy link

go-noah commented Jul 6, 2023

I've been implementing and using pretty much the same ideas you're thinking of in tensorflow and java series.

Of course, I did the exact same thing with Pytorch, and the problem of finding the top k was also considered, as well as batch processing, dynamic batch processing, etc.

If you take a look at my code and agree with the direction I think the implementation should go, I'll contribute to this repository.

https://github.com/go-noah/akka-dynamic-batch-serving/blob/main/tensorflow-gpu-cosine-similarity/src/main/scala/serving/model/CosineSimilarity.scala

https://github.com/go-noah/akka-dynamic-batch-serving/blob/main/tensorflow-gpu-cosine-similarity/README.md

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

No branches or pull requests

2 participants