Skip to content

Conversation

@gcanlin
Copy link
Contributor

@gcanlin gcanlin commented Dec 15, 2025

What this PR does / why we need it?

Related to #4084. Before we add the patches temporarily for making set_forward_context patched by set_ascend_forward_context in the function _process_image_input and _process_video_input of Qwen2.5-VL and Qwen2.5-Omni models. After removing these patches, I met the AttributeError for ForwardContext missing prefetch_mlp_enabled. So we need to add the defensive check for prefetch_mlp_enabled.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

vllm serve Qwen/Qwen2.5-VL-7B-Instruct \
    --max-model-len 30000 \
    --max-num-batched-tokens 50000 \
    --max-num-seqs 30 \
    --no-enable-prefix-caching \
    --trust-remote-code \
    --dtype bfloat16
{"id":"chatcmpl-b66d8acb76905c49","object":"chat.completion","created":1765796863,"model":"/root/.cache/modelscope/hub/models/Qwen/Qwen2.5-VL-7B-Instruct","choices":[{"index":0,"message":{"role":"assistant","content":"The text in the illustration reads \"TONGYI Qwen.\"","refusal":null,"annotations":null,"audio":null,"function_call":null,"tool_calls":[],"reasoning":null,"reasoning_content":null},"logprobs":null,"finish_reason":"stop","stop_reason":null,"token_ids":null}],"service_tier":null,"system_fingerprint":null,"usage":{"prompt_tokens":73,"total_tokens":88,"completion_tokens":15,"prompt_tokens_details":null},"prompt_logprobs":null,"prompt_token_ids":null,"kv_transfer_params":null}

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 refactors the codebase by removing temporary patches for the Qwen2.5-VL and Qwen2.5-Omni models. These patches were responsible for setting an Ascend-specific forward context. Their removal led to an AttributeError due to the prefetch_mlp_enabled attribute being accessed without being set. The pull request addresses this by defensively accessing the attribute using getattr with a default value. This is a clean and robust solution that improves code maintainability by removing temporary workarounds and preventing potential runtime errors. The changes are correct and well-implemented.

@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: gcanlin <[email protected]>
@shen-shanshan
Copy link
Collaborator

LGTM, thanks~

@wangxiyuan wangxiyuan added ready read for review ready-for-test start test by label for PR labels Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module:ops 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.

3 participants