-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
[Model] vllm v1 support mlp_speculator #21276
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?
Conversation
Signed-off-by: skylee-01 <497627264@qq.com>
Signed-off-by: skylee-01 <497627264@qq.com>
Signed-off-by: skylee-01 <497627264@qq.com>
Signed-off-by: skylee-01 <497627264@qq.com>
Signed-off-by: skylee-01 <497627264@qq.com>
👋 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 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 🚀 |
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.
Code Review
This pull request adds support for the mlp_speculator
speculative decoding method in vLLM's v1 architecture. The changes include a new proposer implementation for v1, modifications to the core MLPSpeculator
model to support being used as a draft model, and integration into the GPUModelRunner
. My review has identified several critical issues in the new implementation related to incorrect logic for processing proposal tokens, a crash in the dummy_run
due to a missing argument, and flawed logic in the modified MLPSpeculator
model. These issues need to be addressed to ensure correctness and prevent runtime errors.
The content is updated to the new PR, and the old PR is discarded. |
Signed-off-by: skylee-01 <497627264@qq.com>
Use the following script to test: # -*- coding: utf-8 -*-
import sys
import os
os.environ["VLLM_USE_V1"] = "1"
custom_vllm_path = '/path/to/your/vllm'
if custom_vllm_path not in sys.path:
sys.path.insert(0, custom_vllm_path)
from vllm import LLM, SamplingParams
prompts = [
"1+1= ",
]
sampling_params = SamplingParams(temperature=0, max_tokens=20)
model = "/path/to/your/model/Meta-Llama-3.1-8B-Instruct" # Please replace with your model path
llm = LLM(
model=model,
enforce_eager=True,
max_model_len=3000,
gpu_memory_utilization=0.9,
tensor_parallel_size=1,
speculative_config={
"method": "mlp_speculator",
"model": "/path/to/your/speculative/model/llama3-8b-accelerator/", # Please replace with your speculative model path
"draft_tensor_parallel_size": 1,
"num_speculative_tokens": 2,
},
)
import time
t1 = time.time()
for i in range(100):
print("************************************************")
outputs = llm.generate(prompts, sampling_params)
for output in outputs:
answer = output.outputs[0].text
print(f"answer:{answer}")
print("time:", time.time() - t1) |
I've increased the tests and updated the code to the latest vllm version. |
Essential Elements of an Effective PR Description Checklist
supported_models.md
andexamples
for a new model.Purpose
vllm v1 support mlp_speculator
Test Plan
Test Result
(Optional) Documentation Update