Skip to content

[Bugfix] Fix EAGLE3 broken logits #18909

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

Merged
merged 2 commits into from
Jun 1, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions vllm/model_executor/models/llama_eagle3.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ def compute_logits(
logits = self.logits_processor(self.lm_head, hidden_states,
sampling_metadata)
if self.draft_id_to_target_id is None:
assert logits.shape[1] == self.config.vocab_size, \
"Expected logits to have shape " \
f"(*, {self.config.vocab_size}), but got {logits.shape}"
Comment on lines 217 to +220
Copy link
Collaborator

Choose a reason for hiding this comment

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

A dumb question: Now that we don't set self.draft_id_to_target_id = None, how can this branch be taken?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@benchislett ^ Could you please answer this question?

return logits

base = torch.arange(self.config.draft_vocab_size, device=logits.device)
Expand All @@ -234,24 +237,22 @@ def combine_hidden_states(
return self.model.fc(hidden_states)

def load_weights(self, weights: Iterable[tuple[str, torch.Tensor]]):
loader = AutoWeightsLoader(
self,
skip_prefixes=None,
)

model_weights = {}
includes_draft_id_mapping = False
for name, loaded_weight in weights:
if "t2d" in name:
continue
if "d2t" in name:
name = name.replace("d2t", "draft_id_to_target_id")
includes_draft_id_mapping = True
elif "lm_head" not in name:
name = "model." + name
model_weights[name] = loaded_weight

loaded_weights = loader.load_weights(model_weights.items())

if 'd2t' not in loaded_weights:
self.draft_id_to_target_id = None

return loaded_weights
loader = AutoWeightsLoader(
self,
skip_prefixes=None,
skip_substrs=["draft_id_to_target_id"] \
if not includes_draft_id_mapping else None,
)
loader.load_weights(model_weights.items())