Skip to content

Conversation

Ximingwang-09
Copy link
Contributor

@Ximingwang-09 Ximingwang-09 commented Aug 19, 2025

Purpose

new PR for #21363

Test Plan

#21363

Test Result

#21363

(Optional) Documentation Update


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

Copy link

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

🚀

@mergify mergify bot added new-model Requests to new models qwen Related to Qwen models speculative-decoding labels Aug 19, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for EAGLE for Qwen2 models. The implementation in vllm/model_executor/models/qwen2_eagle.py has a couple of critical issues. The __init__ method of EagleQwen2ForCausalLMEagle is incomplete, missing initialization for lm_head and lora_config, which will lead to runtime errors. Additionally, the load_weights method does not return the set of loaded weights, which breaks the contract of the weight loading interface in vLLM. I've provided suggestions to fix these issues.

Comment on lines +132 to +144
def __init__(self, *, vllm_config: VllmConfig, prefix: str = ""):
nn.Module.__init__(self)
self.config = vllm_config. \
speculative_config.draft_model_config.hf_config
target_layer_num = vllm_config.model_config.get_num_layers(
vllm_config.parallel_config)
self.model = Qwen2Model(vllm_config=vllm_config,
prefix="model",
start_layer_id=target_layer_num)

logit_scale = getattr(self.config, "logit_scale", 1.0)
self.logits_processor = LogitsProcessor(self.config.vocab_size,
scale=logit_scale)
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The __init__ method is incomplete. It inherits from Qwen2ForCausalLM but doesn't initialize all necessary attributes. Specifically, self.lm_head is not initialized, which is used by the inherited compute_logits method, and self.lora_config is not set, which is required by the SupportsLoRA interface. This will lead to runtime errors.

    def __init__(self, *, vllm_config: VllmConfig, prefix: str = ""):
        nn.Module.__init__(self)
        self.config = vllm_config.speculative_config.draft_model_config.hf_config
        self.lora_config = vllm_config.lora_config
        self.quant_config = vllm_config.quant_config

        target_layer_num = vllm_config.model_config.get_num_layers(
            vllm_config.parallel_config)
        self.model = Qwen2Model(vllm_config=vllm_config,
                                prefix="model",
                                start_layer_id=target_layer_num)

        from vllm.distributed import get_pp_group
        from vllm.model_executor.layers.vocab_parallel_embedding import (
            ParallelLMHead)
        from vllm.model_executor.models.utils import (PPMissingLayer,
                                                      maybe_prefix)
        if get_pp_group().is_last_rank:
            self.lm_head = ParallelLMHead(
                self.config.vocab_size,
                self.config.hidden_size,
                quant_config=self.quant_config,
                prefix=maybe_prefix(prefix, "lm_head"))
        else:
            self.lm_head = PPMissingLayer()

        logit_scale = getattr(self.config, "logit_scale", 1.0)
        self.logits_processor = LogitsProcessor(self.config.vocab_size,
                                                scale=logit_scale)

Signed-off-by: 纬杭 <[email protected]>
Signed-off-by: 纬杭 <[email protected]>
Copy link
Member

@DarkLight1337 DarkLight1337 left a comment

Choose a reason for hiding this comment

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

Thanks for updating the PR, can you make use of the newly-introduced SupportsEagle3 interface?

@Ximingwang-09
Copy link
Contributor Author

Thanks for updating the PR, can you make use of the newly-introduced SupportsEagle3 interface?

Sure

fix
Signed-off-by: 纬杭 <[email protected]>
Copy link
Member

@DarkLight1337 DarkLight1337 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@DarkLight1337 DarkLight1337 enabled auto-merge (squash) August 22, 2025 06:29
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Aug 22, 2025
@DarkLight1337
Copy link
Member

PTAL at the failing model test. By the way, Eagle3 support is going to be added soon (#23337), so not sure whether this PR is still needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-model Requests to new models qwen Related to Qwen models ready ONLY add when PR is ready to merge/full CI is needed speculative-decoding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants