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

Rolling batch for huggingface handler #857

Merged
merged 3 commits into from
Jun 24, 2023
Merged

Rolling batch for huggingface handler #857

merged 3 commits into from
Jun 24, 2023

Conversation

sindhuvahinis
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

@sindhuvahinis sindhuvahinis requested review from zachgk, frankfliu and a team as code owners June 23, 2023 05:14
@@ -22,6 +22,7 @@
from djl_python.inputs import Input
from djl_python.outputs import Output
from djl_python.streaming_utils import StreamingUtils
from djl_python.rolling_batch import RollingBatch
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we not using HuggingFace handler, since you already introducing many other options here. Just create a new rolling entrypoint. @frankfliu thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

My suggestion is all traditional pieces stay here, where rolling batch comes to a new chapter

Copy link
Contributor

Choose a reason for hiding this comment

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

huggingface.py should be the entrypoint, but we need consider refactor huggingface.py to be more modularized and handle more complicated cases.

@@ -22,6 +22,7 @@
from djl_python.inputs import Input
from djl_python.outputs import Output
from djl_python.streaming_utils import StreamingUtils
from djl_python.rolling_batch import RollingBatch
Copy link
Contributor

Choose a reason for hiding this comment

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

huggingface.py should be the entrypoint, but we need consider refactor huggingface.py to be more modularized and handle more complicated cases.

self.sampling = False
self.topp = 0.92
self.temperature = 1
self.eos_token_id = kwargs.get('eos_token_id', 50256)
Copy link
Contributor

Choose a reason for hiding this comment

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

We should not hard code eos_token_id, it should based on eos_token char

Copy link
Contributor

Choose a reason for hiding this comment

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

This is configurable by the concumer of the scheduler. Currently the seqBatchScheduler part doesn't have any tokenizer. So the consumer of the scheduler tokenize the eos_token and set it in this searchConfig.

self.topp = 0.92
self.temperature = 1
self.eos_token_id = kwargs.get('eos_token_id', 50256)
self.pad_token_id = kwargs.get('pad_token_id', 50256)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why padding id the same as eos?

Copy link
Contributor

Choose a reason for hiding this comment

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

This is just default value, which can be configurable. Also, the padding is an only placeholder; it won't affect the output.

Copy link
Contributor

Choose a reason for hiding this comment

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

What we should do is provide a default eos and padding char, and based on tokenizer to figure out pad_token_id and eos_token_id

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will note this down,and do these in the next PRs frank

@sindhuvahinis sindhuvahinis merged commit cc5e62c into master Jun 24, 2023
@sindhuvahinis sindhuvahinis deleted the rolling branch June 24, 2023 01:40
KexinFeng pushed a commit to KexinFeng/djl-serving-forked that referenced this pull request Aug 16, 2023
* Rolling batch for huggingface handler
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.

5 participants