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

CrossEncoder device #2463

Merged
merged 14 commits into from Feb 1, 2024
Merged

CrossEncoder device #2463

merged 14 commits into from Feb 1, 2024

Conversation

milistu
Copy link
Contributor

@milistu milistu commented Feb 1, 2024

Pull Request Summary

This pull request focuses on enhancing device compatibility and improving code organization by relocating the get_device_name method and utilizing it to support the 'mps' device in CrossEncoder.py.

Key Changes

  • Moved get_device_name from SentenceTransformer.py to util.py for better modularity.
  • Updated CrossEncoder.py to use get_device_name from util.py, enabling support for the 'mps' device.

Testing

  • Validated on M3 Apple Silicon, ensuring CrossEncoder functions correctly with 'mps' device support.

Conclusion

  • Refactoring: Simplified the code by moving the get_device_name function to util.py.
  • Enhanced Device Support: Enabled CrossEncoder to support 'mps' devices, improving performance on macOS platforms.

@milistu milistu changed the title Cross enc device CrossEncoder device Feb 1, 2024
@tomaarsen
Copy link
Collaborator

Hello!

This looks good at a glance! I also like moving get_device_name to util, that makes total sense.
I also see that the git history is a little messy, something seems to have gone wrong there, but I'm not too bothered: I'll eventually just squash the commits into 1 commit when I merge this.

I'll try it out locally in a minute

  • Tom Aarsen

@tomaarsen
Copy link
Collaborator

Very clean indeed, no comments here! Thanks a bunch for this.

  • Tom Aarsen

@tomaarsen tomaarsen merged commit 1b9c6ff into UKPLab:master Feb 1, 2024
9 checks passed
@milistu
Copy link
Contributor Author

milistu commented Feb 1, 2024

Very clean indeed, no comments here! Thanks a bunch for this.

  • Tom Aarsen

Not a problem!
Thank you for a quick review, have a great day

  • Milutin Studen

debanjum added a commit to khoj-ai/khoj that referenced this pull request Mar 10, 2024
- Trigger
   SentenceTransformer Cross Encoder models now run fast on GPU enabled machines, including Mac ARM devices since UKPLab/sentence-transformers#2463

- Details
  - Use cross-encoder to rerank search results by default on GPU machines and when using an inference server
  - Only call search API when pause in typing search query on web, desktop apps
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.

None yet

2 participants