-
-
Notifications
You must be signed in to change notification settings - Fork 11.9k
[Core] Speculative Early-Exit for LRMs implemented on Eagle3 #27192
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
base: main
Are you sure you want to change the base?
Changes from all commits
befedf8
ba6928c
aab5498
cb49a05
e402b30
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,7 +28,7 @@ | |
|
|
||
| import torch | ||
| from torch import nn | ||
| from transformers import LlamaConfig | ||
| from transformers import AutoTokenizer, LlamaConfig | ||
|
|
||
| from vllm.attention import Attention, AttentionType | ||
| from vllm.compilation.decorators import support_torch_compile | ||
|
|
@@ -47,6 +47,7 @@ | |
| from vllm.model_executor.model_loader.weight_utils import ( | ||
| default_weight_loader, maybe_remap_kv_scale_name) | ||
| from vllm.model_executor.sampling_metadata import SamplingMetadata | ||
| from vllm.model_executor.utils import ThinkSettings | ||
| from vllm.sequence import IntermediateTensors | ||
|
|
||
| from .interfaces import SupportsEagle3, SupportsLoRA, SupportsPP | ||
|
|
@@ -549,6 +550,30 @@ def __init__(self, | |
| self.make_empty_intermediate_tensors = ( | ||
| self.model.make_empty_intermediate_tensors) | ||
|
|
||
| tokenizer = AutoTokenizer.from_pretrained( | ||
| vllm_config.model_config.model) | ||
| start_think_ids = tokenizer.encode("<think>", add_special_tokens=False) | ||
| stop_think_ids = tokenizer.encode("</think>", add_special_tokens=False) | ||
| assert len(start_think_ids) == 1 and len(stop_think_ids) == 1, \ | ||
| f"Invalid think IDs: " \ | ||
| f"</think> {start_think_ids}, " \ | ||
| f"</think> {stop_think_ids}" | ||
|
|
||
| self.think_settings = ThinkSettings( | ||
| start_think_id=start_think_ids[0], | ||
| stop_think_id=stop_think_ids[0], | ||
| ) | ||
|
|
||
| for text in self.think_settings.step_split_tokens: | ||
| encoded_tokens = tokenizer.encode(text, add_special_tokens=False) | ||
| if len(encoded_tokens) == 1: | ||
| self.think_settings.step_split_token_ids.add(encoded_tokens[0]) | ||
| for text in self.think_settings.discourse_marker_tokens: | ||
| encoded_tokens = tokenizer.encode(text, add_special_tokens=False) | ||
| if len(encoded_tokens) == 1: | ||
| self.think_settings.discourse_marker_token_ids.add( | ||
| encoded_tokens[0]) | ||
|
Comment on lines
+553
to
+575
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The model now unconditionally constructs an Useful? React with 👍 / 👎. |
||
|
|
||
| def set_aux_hidden_state_layers(self, layers: tuple[int]) -> None: | ||
| self.model.aux_hidden_state_layers = layers | ||
|
|
||
|
|
||
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.
The f-string in this assertion message has a typo. It shows
</think>for bothstart_think_idsandstop_think_ids, which can be misleading during debugging. The first one should be<think>.