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

[api] Add batch support to TextEmbeddingServingTranslator #3084

Merged
merged 1 commit into from
Apr 15, 2024

Conversation

frankfliu
Copy link
Contributor

  • [api] Support "inputs" key in json request for text embedding translator
  • [api] Add batch support to TextEmbeddingServingTranslator

Description

Brief description of what this PR is about

  • If this change is a backward incompatible change, why must this change be made?
  • Interesting edge cases to note here

@frankfliu frankfliu requested review from zachgk and a team as code owners April 13, 2024 06:40
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 92.07921% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 72.29%. Comparing base (ae00167) to head (3fef316).
Report is 10 commits behind head on master.

Files Patch % Lines
...nlp/translator/TextEmbeddingServingTranslator.java 90.00% 4 Missing ⚠️
api/src/main/java/ai/djl/inference/Predictor.java 85.00% 3 Missing ⚠️
.../src/main/java/ai/djl/modality/nlp/TextPrompt.java 95.83% 0 Missing and 1 partial ⚠️

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

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #3084   +/-   ##
=========================================
  Coverage     72.28%   72.29%           
- Complexity     7302     7324   +22     
=========================================
  Files           722      723    +1     
  Lines         32593    32677   +84     
  Branches       3410     3427   +17     
=========================================
+ Hits          23561    23624   +63     
- Misses         7407     7432   +25     
+ Partials       1625     1621    -4     

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

if (metrics != null) {
waitToRead(list);
long tmp = System.nanoTime();
long duration = (tmp - timestamp) / 1000;
long duration = (tmp - timestamp) / 1000 / batchSize;
Copy link
Contributor

Choose a reason for hiding this comment

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

does it make sense to report the average latency per item as the preprocess latency? do we also report the batch size metric somewhere?

I feel like we should report the total time for the full batch, but if this is consistent with how we're doing it elsewhere, or what users typically expect, i'm ok with it. same foes for the other methods we report a similar metric for

Copy link
Contributor Author

Choose a reason for hiding this comment

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

try to align with TEI for batch case. We do report DynamicBatchSize in metrics. We have total inference time as well

@frankfliu frankfliu merged commit 3813405 into deepjavalibrary:master Apr 15, 2024
5 checks passed
@frankfliu frankfliu deleted the batch branch April 15, 2024 21:25
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.

4 participants