-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Speculative #1308
Speculative #1308
Conversation
- Still wrong when batched - Incorrect returned payload. (No multiple ids/logprobs)
Upgrading Cargo? Undo update.
router/client/src/lib.rs
Outdated
pub use pb::generate::v1::InfoResponse as ShardInfo; | ||
pub use pb::generate::v1::{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub use pb::generate::v1::InfoResponse as ShardInfo; | |
pub use pb::generate::v1::{ | |
pub use pb::generate::v2::InfoResponse as ShardInfo; | |
pub use pb::generate::v2::{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
router/src/infer.rs
Outdated
@@ -515,6 +515,7 @@ fn send_responses( | |||
|
|||
let mut stopped = false; | |||
|
|||
tracing::info!("Generation: {:?}", generation); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tracing::info!("Generation: {:?}", generation); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
router/src/infer.rs
Outdated
text: generation.token_text, | ||
logprob: generation.token_logprob, | ||
special: generation.token_is_special, | ||
let tokens: Vec<Token> = if let Some(tokens_) = generation.tokens { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should .expect()
here as this should be a bug if tokens is empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also if the vecs are not the same size.
@@ -97,6 +101,8 @@ def get_model( | |||
else: | |||
raise RuntimeError(f"Unknown dtype {dtype}") | |||
|
|||
SPECULATE = 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to proper handling.
next_input_ids, next_token_logprobs, logprobs = batch.next_token_chooser( | ||
batch.all_input_ids_tensor[:, : batch.max_seqlen], next_token_logits | ||
|
||
from text_generation_server.models import SPECULATE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a get like we do for the cache manager instead.
# next_token_ids, | ||
# next_token_logprobs, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# next_token_ids, | |
# next_token_logprobs, |
# next_token_id, | ||
# next_token_logprob, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# next_token_id, | |
# next_token_logprob, |
if not stop: | ||
stopped = False | ||
left = 0 | ||
for j, next_token_id in enumerate(_next_token_ids): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this could happen in the same for loop as above?
We are also missing:
|
Did all 3. |
Padded zeros was the worst case scenario.
Bad degradation on pad tokens for ngram Invalid batch discard `stopped` value could be incorrect.
search on device instead of on CPU with bad worst cases O(n)
Sorry you reviewed this, I was making adjustements to reduce the overhead. Cleaned it up. |
@OlivierDehaene Good for review this time, I'll run a few benches. |
Co-authored-by: OlivierDehaene <[email protected]>
What does this PR do?
Fixes # (issue)
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.