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

Follow up PR for Audio End to End testing #390

Merged
merged 16 commits into from
Oct 1, 2024

Conversation

wirthual
Copy link
Collaborator

#378 This PR adds support for handing text and urls for the audio embeddings endpoint.

Extended the test to test text only, mixed text and urls and also check a meta test for the embeddings.

Implemented for the audio endpoint, if this scheme is acceptable happy to port it to the vision endpoint.

Cheers

@codecov-commenter
Copy link

codecov-commenter commented Sep 30, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.99%. Comparing base (638205c) to head (a74a5df).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #390   +/-   ##
=======================================
  Coverage   78.99%   78.99%           
=======================================
  Files          37       37           
  Lines        2804     2804           
=======================================
  Hits         2215     2215           
  Misses        589      589           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wirthual wirthual marked this pull request as ready for review September 30, 2024 02:56
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR enhances the audio embeddings functionality in the infinity_emb library, addressing issue #378 by improving support for mixed input types and expanding test coverage.

  • Modified AudioEmbeddingInput in pymodels.py to accept both text and URL inputs
  • Extended _embeddings_audio function in infinity_server.py to process mixed input types (audio URLs and text)
  • Added new tests in test_torch_audio.py for text-only input, mixed text/URL input, and embedding comparisons
  • Implemented cosine similarity function for comparing audio embeddings
  • Removed skip decorator from text-only test, improving overall test coverage

3 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings

libs/infinity_emb/infinity_emb/infinity_server.py Outdated Show resolved Hide resolved
libs/infinity_emb/infinity_emb/infinity_server.py Outdated Show resolved Hide resolved
Comment on lines 128 to 133
assert cosine_similarity(
embeddings_audio_beep, embeddings_text_beep
) > cosine_similarity(embeddings_audio_beep, embeddings_text_fish)
assert cosine_similarity(
embeddings_audio_beep, embeddings_text_beep
) > cosine_similarity(embeddings_audio_beep, embeddings_text_horse)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Add a small tolerance to comparisons to account for floating-point precision

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a greater than is fine here I guess

@michaelfeil
Copy link
Owner

@wirthual Wait, I am confused - the “/embeddings” endpoint already works for audio!

@wirthual
Copy link
Collaborator Author

wirthual commented Sep 30, 2024

@wirthual Wait, I am confused - the “/embeddings” endpoint already works for audio!

Isnt the /embeddings endpoint for text only and the /embeddings_audio for the clap model?

Copy link
Owner

@michaelfeil michaelfeil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the contribution! Feel free to merge once all test are passing.

@michaelfeil michaelfeil merged commit 5881a74 into michaelfeil:main Oct 1, 2024
35 of 36 checks passed
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.

3 participants