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

warn users when predict/unbatch output length is not same as #requests #408

Merged
merged 8 commits into from
Jan 10, 2025

Conversation

aniketmaurya
Copy link
Collaborator

@aniketmaurya aniketmaurya commented Jan 10, 2025

What does this PR do?

This PR, helps user find the mistake in LitAPI when the output from predict/unbatch is not as the same size as of number of requests.

class ExampleAPI(LitAPI):
    ...
    def predict(self, x):
        return self.model(x)  # returns a list of length same as len(x)

    def unbatch(self, output):
        return [output]   # returns a list of length 1

Also, removes a duplicate code.

Before submitting
  • Was this discussed/agreed via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure to update the docs?
  • Did you write any new necessary tests?

PR review

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in GitHub issues there's a high chance it will not be merged.

Did you have fun?

Make sure you had fun coding 🙃

Copy link

codecov bot commented Jan 10, 2025

Codecov Report

Attention: Patch coverage is 71.42857% with 4 lines in your changes missing coverage. Please review.

Project coverage is 88%. Comparing base (43692d4) to head (dedca3e).
Report is 1 commits behind head on main.

Additional details and impacted files
@@         Coverage Diff         @@
##           main   #408   +/-   ##
===================================
  Coverage    88%    88%           
===================================
  Files        30     30           
  Lines      1976   1946   -30     
===================================
- Hits       1734   1715   -19     
+ Misses      242    231   -11     

@aniketmaurya aniketmaurya enabled auto-merge (squash) January 10, 2025 13:27
@aniketmaurya aniketmaurya disabled auto-merge January 10, 2025 13:27
@aniketmaurya aniketmaurya enabled auto-merge (squash) January 10, 2025 14:11
@aniketmaurya aniketmaurya merged commit 6f1d3df into main Jan 10, 2025
20 of 21 checks passed
@aniketmaurya aniketmaurya deleted the aniket/warn-batching branch January 10, 2025 14:38
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