-
Notifications
You must be signed in to change notification settings - Fork 657
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
Batch the sequences with ContrastiveSeqBatchScheduler #2572
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KexinFeng
changed the title
Batch the sequence
Batch the sequences with ContrastiveSeqBatchScheduler
Apr 28, 2023
KexinFeng
force-pushed
the
batching
branch
7 times, most recently
from
May 13, 2023 02:03
d021197
to
e84a53d
Compare
zachgk
previously requested changes
May 16, 2023
examples/src/test/java/ai/djl/examples/inference/TextGenerationTest.java
Outdated
Show resolved
Hide resolved
examples/src/main/java/ai/djl/examples/inference/TestLMAdapter.java
Outdated
Show resolved
Hide resolved
examples/src/main/java/ai/djl/examples/inference/TestLMAdapter.java
Outdated
Show resolved
Hide resolved
examples/src/main/java/ai/djl/examples/inference/TestSeqBatchScheduler.java
Outdated
Show resolved
Hide resolved
KexinFeng
force-pushed
the
batching
branch
4 times, most recently
from
May 25, 2023 00:24
cc1a4bb
to
b93bc2c
Compare
KexinFeng
force-pushed
the
batching
branch
5 times, most recently
from
June 8, 2023 14:45
233ae48
to
cf4baa9
Compare
KexinFeng
force-pushed
the
batching
branch
3 times, most recently
from
June 8, 2023 15:45
aa1c04d
to
8316b6a
Compare
KexinFeng
force-pushed
the
batching
branch
14 times, most recently
from
June 13, 2023 20:46
fee47cd
to
14baed8
Compare
…nd_translator GPT2PT.merge
This was referenced Jun 14, 2023
Features have been merged in #2637 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR succeeds PR #2547 #2509 #2557, which contains the benchmark outputs of the searching results.
The traced models can be downloaded here: https://d2l-java-resources.s3.amazonaws.com/tmp_model_unittest/model/nlp/text_generation/ai/djl/pytorch/gpt2/metadata.json and https://d2l-java-resources.s3.amazonaws.com/tmp_model_unittest/gpt2_decoder_model_merged.onnx.gz
Design
Overview
These PRs consists of the following three parts: LMAdapter, LMSearch and SeqBatchScheduler. There are three testing code corresponding to them:
TestLMAdapter.java
,TestLMSearch.java
,TestSeqBatchScheduler.java
. TheTestSeqBatchScheduler.java
utilizes all previous features.New classes
This is partly adapted from the searching algorithms in
TestLMSearch.java
. Currently only the contrastiveSearch has been adapted. The greedySearch and beamSearch will be similarly implemented. On top of that, batching operations are implemented. The system is designed as following, which contains the batching operations like addRequest() and collectAdnTrim()