Skip to content

[Refactor] Separate _prepare_inputs to _prepare_inputs and _preprocess#6191

Merged
wangxiyuan merged 5 commits intovllm-project:mainfrom
gcanlin:preprocess
Jan 26, 2026
Merged

[Refactor] Separate _prepare_inputs to _prepare_inputs and _preprocess#6191
wangxiyuan merged 5 commits intovllm-project:mainfrom
gcanlin:preprocess

Conversation

@gcanlin
Copy link
Copy Markdown
Collaborator

@gcanlin gcanlin commented Jan 23, 2026

What this PR does / why we need it?

Align with upstream vLLM. This PR will help downstream vLLM-Omni reduce the cost for maintaining the _prepare_inputs. Besides, it helps vLLM-Ascend code more readable. In the future, we can follow closer to vLLM. The preprocess logic is same as GPUModelRunner. We don't need to maintain it anymore.

Does this PR introduce any user-facing change?

No

How was this patch tested?

CI.

Signed-off-by: gcanlin <canlinguosdu@gmail.com>
@gcanlin gcanlin requested a review from MengqingCao as a code owner January 23, 2026 08:12
@github-actions
Copy link
Copy Markdown
Contributor

👋 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.

@wangxiyuan wangxiyuan added ready read for review ready-for-test start test by label for PR labels Jan 23, 2026
Copy link
Copy Markdown
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 _prepare_inputs method by splitting it into _prepare_inputs and _preprocess, aligning it with the upstream vLLM implementation. This is a good step towards improving code readability and maintainability.

My review focuses on ensuring the refactoring is clean and doesn't introduce new issues. I've identified a couple of minor cleanup opportunities: an unused parameter in the refactored _prepare_inputs method and a confusing TODO comment that appears to be a typo. Addressing these will further improve the code quality.

Comment thread vllm_ascend/worker/model_runner_v1.py Outdated
Signed-off-by: gcanlin <canlinguosdu@gmail.com>
Signed-off-by: gcanlin <canlinguosdu@gmail.com>
@gcanlin
Copy link
Copy Markdown
Collaborator Author

gcanlin commented Jan 23, 2026

@wangxiyuan CI has passed.
@zhenwenqi2024 @kunpengW-code If #6043 can't be ready, we will merge this first. It's better that you can also take a look at this PR.

@github-actions
Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@wangxiyuan
Copy link
Copy Markdown
Collaborator

CI failed

@wangxiyuan
Copy link
Copy Markdown
Collaborator

I think it's related to #6041

@gcanlin
Copy link
Copy Markdown
Collaborator Author

gcanlin commented Jan 25, 2026

I think it's related to #6041

Yes. It seems to be not resulted by this refactor PR.

@wangxiyuan
Copy link
Copy Markdown
Collaborator

you can rebase now.

@gcanlin
Copy link
Copy Markdown
Collaborator Author

gcanlin commented Jan 25, 2026

@wangxiyuan Ready now.

@github-actions
Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Signed-off-by: gcanlin <canlinguosdu@gmail.com>
@wangxiyuan wangxiyuan merged commit 6528967 into vllm-project:main Jan 26, 2026
20 checks passed
starmountain1997 pushed a commit to starmountain1997/vllm-ascend that referenced this pull request Jan 31, 2026
…rocess` (vllm-project#6191)

### What this PR does / why we need it?

Align with upstream vLLM. This PR will help downstream vLLM-Omni reduce
the cost for maintaining the _prepare_inputs. Besides, it helps
vLLM-Ascend code more readable. In the future, we can follow closer to
vLLM. The `preprocess` logic is same as GPUModelRunner. We don't need to
maintain it anymore.

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

CI.

- vLLM version: v0.14.0
- vLLM main:
vllm-project/vllm@d682094

---------

Signed-off-by: gcanlin <canlinguosdu@gmail.com>
starmountain1997 pushed a commit to starmountain1997/vllm-ascend that referenced this pull request Jan 31, 2026
…rocess` (vllm-project#6191)

### What this PR does / why we need it?

Align with upstream vLLM. This PR will help downstream vLLM-Omni reduce
the cost for maintaining the _prepare_inputs. Besides, it helps
vLLM-Ascend code more readable. In the future, we can follow closer to
vLLM. The `preprocess` logic is same as GPUModelRunner. We don't need to
maintain it anymore.

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

CI.

- vLLM version: v0.14.0
- vLLM main:
vllm-project/vllm@d682094

---------

Signed-off-by: gcanlin <canlinguosdu@gmail.com>
ZRJ026 pushed a commit to ZRJ026/vllm-ascend that referenced this pull request Feb 28, 2026
…rocess` (vllm-project#6191)

### What this PR does / why we need it?

Align with upstream vLLM. This PR will help downstream vLLM-Omni reduce
the cost for maintaining the _prepare_inputs. Besides, it helps
vLLM-Ascend code more readable. In the future, we can follow closer to
vLLM. The `preprocess` logic is same as GPUModelRunner. We don't need to
maintain it anymore.

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

CI.

- vLLM version: v0.14.0
- vLLM main:
vllm-project/vllm@d682094

---------

Signed-off-by: gcanlin <canlinguosdu@gmail.com>
Signed-off-by: zrj026 <zhangrunjiang026@gmail.com>
maoxx241 pushed a commit to maoxx241/vllm-ascend that referenced this pull request Mar 2, 2026
…rocess` (vllm-project#6191)

### What this PR does / why we need it?

Align with upstream vLLM. This PR will help downstream vLLM-Omni reduce
the cost for maintaining the _prepare_inputs. Besides, it helps
vLLM-Ascend code more readable. In the future, we can follow closer to
vLLM. The `preprocess` logic is same as GPUModelRunner. We don't need to
maintain it anymore.

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

CI.

- vLLM version: v0.14.0
- vLLM main:
vllm-project/vllm@d682094

---------

Signed-off-by: gcanlin <canlinguosdu@gmail.com>
ZRJ026 pushed a commit to ZRJ026/vllm-ascend that referenced this pull request Mar 4, 2026
…rocess` (vllm-project#6191)

### What this PR does / why we need it?

Align with upstream vLLM. This PR will help downstream vLLM-Omni reduce
the cost for maintaining the _prepare_inputs. Besides, it helps
vLLM-Ascend code more readable. In the future, we can follow closer to
vLLM. The `preprocess` logic is same as GPUModelRunner. We don't need to
maintain it anymore.

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

CI.

- vLLM version: v0.14.0
- vLLM main:
vllm-project/vllm@d682094

---------

Signed-off-by: gcanlin <canlinguosdu@gmail.com>
Signed-off-by: zrj026 <zhangrunjiang026@gmail.com>
LCAIZJ pushed a commit to LCAIZJ/vllm-ascend that referenced this pull request Mar 7, 2026
…rocess` (vllm-project#6191)

### What this PR does / why we need it?

Align with upstream vLLM. This PR will help downstream vLLM-Omni reduce
the cost for maintaining the _prepare_inputs. Besides, it helps
vLLM-Ascend code more readable. In the future, we can follow closer to
vLLM. The `preprocess` logic is same as GPUModelRunner. We don't need to
maintain it anymore.

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

CI.

- vLLM version: v0.14.0
- vLLM main:
vllm-project/vllm@d682094

---------

Signed-off-by: gcanlin <canlinguosdu@gmail.com>
jiangyunfan1 pushed a commit to jiangyunfan1/vllm-ascend that referenced this pull request Apr 9, 2026
…rocess` (vllm-project#6191)

### What this PR does / why we need it?

Align with upstream vLLM. This PR will help downstream vLLM-Omni reduce
the cost for maintaining the _prepare_inputs. Besides, it helps
vLLM-Ascend code more readable. In the future, we can follow closer to
vLLM. The `preprocess` logic is same as GPUModelRunner. We don't need to
maintain it anymore.

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

CI.

- vLLM version: v0.14.0
- vLLM main:
vllm-project/vllm@d682094

---------

Signed-off-by: gcanlin <canlinguosdu@gmail.com>
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.

2 participants