Skip to content

Conversation

@omkar-334
Copy link

@omkar-334 omkar-334 commented Nov 22, 2025

Resolves #3350

Implemented 4 functions to support multiprocessing, exactly as done in SentenceTransformer.py

  1. start_multi_process_pool - same as before
  2. stop_multi_process_pool - same as before
  3. _predict_multi_process - similar to _encode_multi_process
  4. _predict_multi_process_worker - similar to _encode_multi_process_worker

So far, multiprocessing support has been added to both predict and rank methods of CrossEncoder.py.

I've included code for raising Error if any of the worker processes result in an error. Can remove this after testing.
I've tested this on macOS, but need to test on Colab GPU and confirm.

@tomaarsen some functions like _encode_multi_process_worker and _encode_multi_process do not have docstrings and params. Should I add them in this PR itself?

@omkar-334 omkar-334 marked this pull request as ready for review November 24, 2025 10:25
@tomaarsen
Copy link
Member

Well done! This is looking great in my early tests, with some speedups for e.g. multi-processing on CPUs. I'll have a deeper look at the code itself later, but I'd like to include this in the next release 🤗

  • Tom Aarsen

@omkar-334
Copy link
Author

hey, thank you! I shall include my test results here shortly.
Other than that, are there any issues or features at the top of your head that I can work upon? I've scoured through the open issues and most look resolved..
thanks!

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.

Hard examples mining with multi GPU

2 participants