Skip to content

Conversation

@wxsIcey
Copy link
Collaborator

@wxsIcey wxsIcey commented Oct 22, 2025

What this PR does / why we need it?

[Bug Fix] Fixes ngram spec decode bug introduced by vllm vllm-project/vllm#24986

Does this PR introduce any user-facing change?

N/A

How was this patch tested?

def main():
    prompts = [
        "The future of AI is",
    ]

    # Create a sampling params object.
    sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
    # Create an LLM.
    llm = LLM(
            model="LLM-Research/Meta-Llama-3.1-8B-Instruct",
            tensor_parallel_size=1,
            speculative_config={
                "method": "ngram",
                "num_speculative_tokens": 5, # 每次最多推测 5 个 token
                "prompt_lookup_max": 4, # 最多使用 4 个 n-gram 进行匹配
            },
            enforce_eager=True,
        )

    # Generate texts from the prompts.
    outputs = llm.generate(prompts, sampling_params)
    print(f"Outputs: {outputs}")
    for output in outputs:
        prompt = output.prompt
        generated_text = output.outputs[0].text
        print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")

Signed-off-by: Icey <[email protected]>
@wxsIcey wxsIcey changed the title [Bug Fix] Fixes ngram spec decode bug introduced by vllm https://github.com/vllm-project/vllm/pull/24986 [Bug Fix] Fixes ngram spec decode bug introduced by vllm Oct 22, 2025
@github-actions
Copy link

👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:‌‌

  • A PR should do only one thing, smaller PRs enable faster reviews.
  • Every PR should include unit tests and end-to-end tests ‌to ensure it works and is not broken by other future PRs.
  • Write the commit message by fulfilling the PR description to help reviewer and future developers understand.

If CI fails, you can run linting and testing checks locally according Contributing and Testing.

Signed-off-by: Icey <[email protected]>
@wxsIcey wxsIcey marked this pull request as ready for review October 28, 2025 03:34
@wxsIcey wxsIcey changed the title [Bug Fix] Fixes ngram spec decode bug introduced by vllm [0.11.0][Bug Fix] Fixes ngram spec decode bug introduced by vllm Oct 28, 2025
@wxsIcey wxsIcey changed the title [0.11.0][Bug Fix] Fixes ngram spec decode bug introduced by vllm [Bug Fix] Fixes ngram spec decode bug introduced by vllm Oct 28, 2025
@wxsIcey wxsIcey added ready read for review ready-for-test start test by label for PR labels Oct 28, 2025
@wxsIcey wxsIcey closed this Nov 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready read for review ready-for-test start test by label for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant