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

[python] validate each request in the batch #1008

Merged
merged 1 commit into from
Aug 10, 2023

Conversation

frankfliu
Copy link
Contributor

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 August 9, 2023 22:58
if self.rolling_batch_type:
if inputs.get_property("reset_rollingbatch"):
self.rolling_batch.reset()
result = self.rolling_batch.inference(input_data, parameters)
for i in range(inputs.get_batch_size()):
outputs.add(result[i], key="data", batch_index=i)
for i in range(len(input_data)):
Copy link
Contributor

Choose a reason for hiding this comment

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

use input size

if err:
outputs.add(err, key="data", batch_index=i)
else:
outputs.add(result[i], key="data", batch_index=i)
Copy link
Contributor

Choose a reason for hiding this comment

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

i is not the right index, probably we need to +1 everytime we insert a new value. Or use iterator to iter a value.


prediction = self.hf_pipeline(input_data, **parameters[0])
else:
prediction = []
Copy link
Contributor

Choose a reason for hiding this comment

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

need to check rolling batch here. If rolling batch, need to return all errors

@lanking520 lanking520 self-requested a review August 10, 2023 01:39
@frankfliu frankfliu force-pushed the batch branch 2 times, most recently from bf92704 to 252b199 Compare August 10, 2023 02:34
inputs)
if len(input_data) == 0:
for i in range(len(batch)):
outputs.add(errors.get(i), key="data", batch_index=i)
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this work for dynamic batch?

Copy link
Contributor

Choose a reason for hiding this comment

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

this place may also need the json double dumps

@frankfliu frankfliu force-pushed the batch branch 2 times, most recently from 9aa4816 to 741beb8 Compare August 10, 2023 03:05
@frankfliu frankfliu merged commit 12985e9 into deepjavalibrary:master Aug 10, 2023
@frankfliu frankfliu deleted the batch branch August 10, 2023 04:54
KexinFeng pushed a commit to KexinFeng/djl-serving-forked that referenced this pull request Aug 16, 2023
KexinFeng pushed a commit to KexinFeng/djl-serving-forked that referenced this pull request Aug 16, 2023
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