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

multi-GPU support for mine_hard_negatives #2967

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

alperctnkaya
Copy link

Added support for multi-GPU encoding in sentence embeddings with model.encode_multi_process

@tomaarsen tomaarsen changed the base branch from v3.1-release to master October 17, 2024 15:52
@tomaarsen tomaarsen force-pushed the patch-2 branch 2 times, most recently from ab85d71 to 25f1c08 Compare October 17, 2024 15:57
Because this also supports multiple CPUs & multi_process is what the underlying code is called.
Also stop the pools afterwards again
And remove code duplication
@tomaarsen
Copy link
Collaborator

tomaarsen commented Nov 26, 2024

Hello!

Apologies for the delay.
I made some changes to the PR:

  1. Rename use_multiple_gpus to use_multi_process, because it also supports multi-processing for CPUs.
  2. Remove code duplication because the query/corpus embedding is the same regardless of whether faiss is used or not.
  3. Add model.stop_multi_process_pool(pool) to avoid the multiprocessing pool components from being kept unnecessarily.
  4. Added a docstring for use_multi_process
  5. Update use_multi_process so that you can both use True for all GPUs/4 CPUs or a list of devices for more customizability.

I'm curious what you think @alperctnkaya!

  • Tom Aarsen

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

Successfully merging this pull request may close these issues.

2 participants