[Refactor] [MoE] Rename moe-related classes & files#3646
[Refactor] [MoE] Rename moe-related classes & files#3646wangxiyuan merged 1 commit intovllm-project:mainfrom
Conversation
|
👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:
If CI fails, you can run linting and testing checks locally according Contributing and Testing. |
There was a problem hiding this comment.
Code Review
This pull request is a refactoring effort to rename and restructure Mixture-of-Experts (MoE) related files. The changes are largely consistent with this goal, involving file moves and import path updates. However, I've identified a systematic error in the new import paths across several files. It appears a refactoring script may have incorrectly added an extra .fused_moe segment to many import paths, which will lead to ImportError exceptions and break the build. I have provided critical comments with suggestions to correct these paths. Apart from these import issues, the refactoring appears to be in good order.
| from vllm_ascend.ops.fused_moe.fused_moe.experts_selector import select_experts | ||
| from vllm_ascend.ops.fused_moe.fused_moe.moe_comm_method import setup_moe_comm_method |
There was a problem hiding this comment.
The import paths for experts_selector and moe_comm_method are incorrect. The file vllm_ascend/ops/fused_moe/fused_moe.py is not a package, so you cannot import from it. The extra .fused_moe in the path should be removed.
| from vllm_ascend.ops.fused_moe.fused_moe.experts_selector import select_experts | |
| from vllm_ascend.ops.fused_moe.fused_moe.moe_comm_method import setup_moe_comm_method | |
| from vllm_ascend.ops.fused_moe.experts_selector import select_experts | |
| from vllm_ascend.ops.fused_moe.moe_comm_method import setup_moe_comm_method |
| from vllm_ascend.ops.fused_moe.fused_moe.prepare_finalize import ( | ||
| PrepareAndFinalizeWithAll2All, | ||
| PrepareAndFinalizeWithAllGather, PrepareAndFinalizeWithMC2, | ||
| PrepareAndFinalizeWithNaiveMulticast) | ||
| from vllm_ascend.ops.fused_moe.fused_moe.moe_mlp import unified_apply_mlp | ||
| from vllm_ascend.ops.fused_moe.fused_moe.token_dispatcher import (TokenDispatcherWithAll2AllV, | ||
| TokenDispatcherWithAllGather, | ||
| TokenDispatcherWithMC2, | ||
| TokenDispatcherWithMoge) |
There was a problem hiding this comment.
The import paths for prepare_finalize, moe_mlp, and token_dispatcher are incorrect. The file vllm_ascend/ops/fused_moe/fused_moe.py is not a package, so you cannot import from it. The extra .fused_moe in the import paths should be removed.
| from vllm_ascend.ops.fused_moe.fused_moe.prepare_finalize import ( | |
| PrepareAndFinalizeWithAll2All, | |
| PrepareAndFinalizeWithAllGather, PrepareAndFinalizeWithMC2, | |
| PrepareAndFinalizeWithNaiveMulticast) | |
| from vllm_ascend.ops.fused_moe.fused_moe.moe_mlp import unified_apply_mlp | |
| from vllm_ascend.ops.fused_moe.fused_moe.token_dispatcher import (TokenDispatcherWithAll2AllV, | |
| TokenDispatcherWithAllGather, | |
| TokenDispatcherWithMC2, | |
| TokenDispatcherWithMoge) | |
| from vllm_ascend.ops.fused_moe.prepare_finalize import ( | |
| PrepareAndFinalizeWithAll2All, | |
| PrepareAndFinalizeWithAllGather, PrepareAndFinalizeWithMC2, | |
| PrepareAndFinalizeWithNaiveMulticast) | |
| from vllm_ascend.ops.fused_moe.moe_mlp import unified_apply_mlp | |
| from vllm_ascend.ops.fused_moe.token_dispatcher import (TokenDispatcherWithAll2AllV, | |
| TokenDispatcherWithAllGather, | |
| TokenDispatcherWithMC2, | |
| TokenDispatcherWithMoge) |
| from vllm_ascend.ops.fused_moe.fused_moe.comm_utils import ( | ||
| async_all_to_all, gather_from_sequence_parallel_region) |
There was a problem hiding this comment.
The import path for comm_utils is incorrect. The file vllm_ascend/ops/fused_moe/fused_moe.py is not a package, so you cannot import from it. The extra .fused_moe in the path should be removed.
| from vllm_ascend.ops.fused_moe.fused_moe.comm_utils import ( | |
| async_all_to_all, gather_from_sequence_parallel_region) | |
| from vllm_ascend.ops.fused_moe.comm_utils import ( | |
| async_all_to_all, gather_from_sequence_parallel_region) |
| from vllm_ascend.ascend_config import get_ascend_config | ||
| from vllm_ascend.distributed.parallel_state import get_mc2_group | ||
| from vllm_ascend.ops.moe.experts_selector import select_experts | ||
| from vllm_ascend.ops.fused_moe.fused_moe.experts_selector import select_experts |
There was a problem hiding this comment.
The import path for experts_selector is incorrect. The file vllm_ascend/ops/fused_moe/fused_moe.py is not a package, so you cannot import from it. The extra .fused_moe in the path should be removed.
| from vllm_ascend.ops.fused_moe.fused_moe.experts_selector import select_experts | |
| from vllm_ascend.ops.fused_moe.experts_selector import select_experts |
vllm_ascend/quantization/w8a8.py
Outdated
|
|
||
| from vllm_ascend.attention.attention_v1 import AscendAttentionState | ||
| from vllm_ascend.ops.moe.experts_selector import select_experts | ||
| from vllm_ascend.ops.fused_moe.fused_moe.experts_selector import select_experts |
There was a problem hiding this comment.
The import path for experts_selector is incorrect. The file vllm_ascend/ops/fused_moe/fused_moe.py is not a package, so you cannot import from it. The extra .fused_moe in the path should be removed.
| from vllm_ascend.ops.fused_moe.fused_moe.experts_selector import select_experts | |
| from vllm_ascend.ops.fused_moe.experts_selector import select_experts |
| from vllm_ascend.ascend_config import get_ascend_config | ||
| from vllm_ascend.distributed.parallel_state import get_mc2_group | ||
| from vllm_ascend.ops.moe.experts_selector import select_experts | ||
| from vllm_ascend.ops.fused_moe.fused_moe.experts_selector import select_experts |
There was a problem hiding this comment.
The import path for experts_selector is incorrect. The file vllm_ascend/ops/fused_moe/fused_moe.py is not a package, so you cannot import from it. The extra .fused_moe in the path should be removed.
| from vllm_ascend.ops.fused_moe.fused_moe.experts_selector import select_experts | |
| from vllm_ascend.ops.fused_moe.experts_selector import select_experts |
| forward_context = get_forward_context() | ||
|
|
||
| from vllm_ascend.ops.moe.moe_comm_method import get_moe_comm_method | ||
| from vllm_ascend.ops.fused_moe.fused_moe.moe_comm_method import get_moe_comm_method |
There was a problem hiding this comment.
The import path for moe_comm_method is incorrect. The file vllm_ascend/ops/fused_moe/fused_moe.py is not a package, so you cannot import from it. The extra .fused_moe in the path should be removed.
| from vllm_ascend.ops.fused_moe.fused_moe.moe_comm_method import get_moe_comm_method | |
| from vllm_ascend.ops.fused_moe.moe_comm_method import get_moe_comm_method |
ad23123 to
eb5a40b
Compare
cb64583 to
6321254
Compare
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Signed-off-by: Pr0Wh1teGivee <calvin_zhu0210@outlook.com>
6321254 to
2250e59
Compare
### What this PR does / why we need it? 1. Rename common_fused_moe.py to fused_moe.py. 2. Rename fused_moe_prepare_and_finalize.py / FusedMoEPrepareAndFinalize to prepare_finalize.py / PrepareAndFinalize. 3. Rename vllm_ascend/ops/moe to vllm_ascend/ops/fused_moe. 4. Move vllm_ascend/ops/fused_moe.py to vllm_ascend/ops/fused_moe/fused_moe.py ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? e2e & ut - vLLM version: v0.11.0rc3 - vLLM main: vllm-project/vllm@17c540a Signed-off-by: Pr0Wh1teGivee <calvin_zhu0210@outlook.com> Signed-off-by: luolun <luolun1995@cmbchina.com>
### What this PR does / why we need it? 1. Rename common_fused_moe.py to fused_moe.py. 2. Rename fused_moe_prepare_and_finalize.py / FusedMoEPrepareAndFinalize to prepare_finalize.py / PrepareAndFinalize. 3. Rename vllm_ascend/ops/moe to vllm_ascend/ops/fused_moe. 4. Move vllm_ascend/ops/fused_moe.py to vllm_ascend/ops/fused_moe/fused_moe.py ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? e2e & ut - vLLM version: v0.11.0rc3 - vLLM main: vllm-project/vllm@17c540a Signed-off-by: Pr0Wh1teGivee <calvin_zhu0210@outlook.com> Signed-off-by: hwhaokun <haokun0405@163.com>
### What this PR does / why we need it? 1. Rename common_fused_moe.py to fused_moe.py. 2. Rename fused_moe_prepare_and_finalize.py / FusedMoEPrepareAndFinalize to prepare_finalize.py / PrepareAndFinalize. 3. Rename vllm_ascend/ops/moe to vllm_ascend/ops/fused_moe. 4. Move vllm_ascend/ops/fused_moe.py to vllm_ascend/ops/fused_moe/fused_moe.py ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? e2e & ut - vLLM version: v0.11.0rc3 - vLLM main: vllm-project/vllm@17c540a Signed-off-by: Pr0Wh1teGivee <calvin_zhu0210@outlook.com> Signed-off-by: nsdie <yeyifan@huawei.com>
### What this PR does / why we need it? 1. Rename common_fused_moe.py to fused_moe.py. 2. Rename fused_moe_prepare_and_finalize.py / FusedMoEPrepareAndFinalize to prepare_finalize.py / PrepareAndFinalize. 3. Rename vllm_ascend/ops/moe to vllm_ascend/ops/fused_moe. 4. Move vllm_ascend/ops/fused_moe.py to vllm_ascend/ops/fused_moe/fused_moe.py ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? e2e & ut - vLLM version: v0.11.0rc3 - vLLM main: vllm-project/vllm@17c540a Signed-off-by: Pr0Wh1teGivee <calvin_zhu0210@outlook.com>
What this PR does / why we need it?
Does this PR introduce any user-facing change?
No
How was this patch tested?
e2e & ut