Skip to content

Commit 799f67b

Browse files
baymax591masoudhashemi
authored andcommitted
[vllm] fix: verl + vllm-ascend(version 0.9.1) running failed issue (verl-project#3345)
### What does this PR do? After [pr#3285](verl-project@19020f6), [issue 2564](verl-project#2564) began to reappear. Following the modification of [pr#2782](verl-project#2782), [issue 2564](verl-project#2564) was solved. ### Checklist Before Starting - [x] Search for similar PRs. Paste at least one query link here: [pr#2782](verl-project#2782) - [x] Format the PR title as `[{modules}] {type}: {description}` (This will be checked by the CI) - `{modules}` include `fsdp`, `megatron`, `sglang`, `vllm`, `rollout`, `trainer`, `ci`, `training_utils`, `recipe`, `hardware`, `deployment`, `ray`, `worker`, `single_controller`, `misc`, `perf`, `model`, `algo`, `env`, `tool`, `ckpt`, `doc`, `data` - If this PR involves multiple modules, separate them with `,` like `[megatron, fsdp, doc]` - `{type}` is in `feat`, `fix`, `refactor`, `chore`, `test` - If this PR breaks any API (CLI arguments, config, function signature, etc.), add `[BREAKING]` to the beginning of the title. - Example: `[BREAKING][fsdp, megatron] feat: dynamic batching` ### Test > For changes that can not be tested by CI (e.g., algorithm implementation, new model support), validate by experiment(s) and show results like training curve plots, evaluation results, etc. ### API and Usage Example > Demonstrate how the API changes if any, and provide usage example(s) if possible. ```python # Add code snippet or script demonstrating how to use this ``` ### Design & Code Changes > Demonstrate the high-level design if this PR is complex, and list the specific changes. ### Checklist Before Submitting > [!IMPORTANT] > Please check all the following items before requesting a review, otherwise the reviewer might deprioritize this PR for review. - [x] Read the [Contribute Guide](https://github.com/volcengine/verl/blob/main/CONTRIBUTING.md). - [x] Apply [pre-commit checks](https://github.com/volcengine/verl/blob/main/CONTRIBUTING.md#code-linting-and-formatting): `pre-commit install && pre-commit run --all-files --show-diff-on-failure --color=always` - [ ] Add / Update [the documentation](https://github.com/volcengine/verl/tree/main/docs). - [ ] Add unit or end-to-end test(s) to [the CI workflow](https://github.com/volcengine/verl/tree/main/.github/workflows) to cover all the code. If not feasible, explain why: ... - [ ] Once your PR is ready for CI, send a message in [the `ci-request` channel](https://verl-project.slack.com/archives/C091TCESWB1) in [the `verl` Slack workspace](https://join.slack.com/t/verl-project/shared_invite/zt-3855yhg8g-CTkqXu~hKojPCmo7k_yXTQ). (If not accessible, please try [the Feishu group (飞书群)](https://applink.larkoffice.com/client/chat/chatter/add_by_link?link_token=772jd4f1-cd91-441e-a820-498c6614126a).)
1 parent 60038d9 commit 799f67b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

verl/workers/rollout/vllm_rollout/vllm_rollout_spmd.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
from verl.utils.ray_utils import ray_noset_visible_devices
6262
from verl.utils.torch_functional import get_response_mask, pad_2d_list_to_length
6363
from verl.utils.vllm import TensorLoRARequest, VLLMHijack, is_version_ge
64-
from verl.utils.vllm.patch import patch_vllm_moe_model_weight_loader
6564
from verl.workers.config import HFModelConfig, RolloutConfig
6665
from verl.workers.rollout.base import BaseRollout
6766

@@ -432,6 +431,8 @@ async def update_weights(self, weights: Generator[tuple[str, torch.Tensor], None
432431
self.inference_engine.llm_engine.add_lora(lora_reqest)
433432
logger.info(f"vLLM load weights, loaded_params: {len(weights)}")
434433
else:
434+
from verl.utils.vllm.patch import patch_vllm_moe_model_weight_loader
435+
435436
model = self.inference_engine.llm_engine.model_executor.driver_worker.worker.model_runner.model
436437
patch_vllm_moe_model_weight_loader(model)
437438
model.load_weights(weights)
@@ -550,6 +551,8 @@ async def update_weights(self, weights: Generator[tuple[str, torch.Tensor], None
550551
Args:
551552
weights: A generator that yields the name of the weight tensor and the tensor itself.
552553
"""
554+
from verl.utils.vllm.patch import patch_vllm_moe_model_weight_loader
555+
553556
model = self.inference_engine.worker.model_runner.model
554557
patch_vllm_moe_model_weight_loader(model)
555558
model.load_weights(weights)

0 commit comments

Comments
 (0)