eplb redundant expert bugfix (#4291)
### What this PR does / why we need it?
Redundant experts bugfix
### Does this PR introduce _any_ user-facing change?
After configuring the path for experts_map, users do not need to
configure iinit_redundancy_expert.
### How was this patch tested?
The accuracy of EPLB was tested with and without the use of redundant
experts.
- vLLM version: v0.11.0
- vLLM main:
2918c1b49c
---------
Signed-off-by: shenchuxiaofugui <1311027364@qq.com>
This commit is contained in:
@@ -9,39 +9,6 @@ from vllm_ascend.eplb.core import eplb_utils
|
||||
from vllm_ascend.eplb.core.eplb_utils import EPLBParamUtils
|
||||
|
||||
|
||||
def test_determine_default_expert_map_single_world():
|
||||
count, expert_map = eplb_utils.determine_default_expert_map(
|
||||
global_expert_num=4,
|
||||
world_size=1,
|
||||
rank_id=0,
|
||||
global_redundant_expert_num=0)
|
||||
assert count == 4
|
||||
assert torch.equal(expert_map, torch.arange(4, dtype=torch.int32))
|
||||
|
||||
|
||||
def test_determine_default_expert_map_multiple_worlds_no_redundant():
|
||||
count, expert_map = eplb_utils.determine_default_expert_map(
|
||||
global_expert_num=8,
|
||||
world_size=2,
|
||||
rank_id=0,
|
||||
global_redundant_expert_num=0)
|
||||
|
||||
assert count == 4
|
||||
assert torch.all(expert_map[:4] >= 0)
|
||||
assert torch.all(expert_map[4:] == -1)
|
||||
|
||||
|
||||
def test_determine_default_expert_map_multiple_worlds_with_redundant():
|
||||
count, expert_map = eplb_utils.determine_default_expert_map(
|
||||
global_expert_num=5,
|
||||
world_size=2,
|
||||
rank_id=0,
|
||||
global_redundant_expert_num=1)
|
||||
|
||||
assert count == 2
|
||||
assert torch.all(expert_map[0:2] >= 0)
|
||||
|
||||
|
||||
def test_generate_log2phy_map_single_rank_holding():
|
||||
|
||||
expert_map = torch.tensor([[0, -1], [-1, 0]], dtype=torch.int32)
|
||||
@@ -64,21 +31,17 @@ def test_generate_log2phy_map_multiple_rank_holding(monkeypatch):
|
||||
|
||||
|
||||
def test_determine_default_log2phy_map_world_size_1():
|
||||
log2phy = eplb_utils.determine_default_log2phy_map(
|
||||
global_expert_num=3,
|
||||
world_size=1,
|
||||
rank_id=0,
|
||||
global_redundant_expert_num=0)
|
||||
log2phy = eplb_utils.determine_default_log2phy_map(global_expert_num=3,
|
||||
world_size=1,
|
||||
rank_id=0)
|
||||
assert log2phy.shape == (3, )
|
||||
assert (log2phy >= 0).all()
|
||||
|
||||
|
||||
def test_determine_default_log2phy_map_world_size_multiple():
|
||||
log2phy = eplb_utils.determine_default_log2phy_map(
|
||||
global_expert_num=6,
|
||||
world_size=2,
|
||||
rank_id=1,
|
||||
global_redundant_expert_num=1)
|
||||
log2phy = eplb_utils.determine_default_log2phy_map(global_expert_num=6,
|
||||
world_size=2,
|
||||
rank_id=1)
|
||||
assert log2phy.shape == (6, )
|
||||
assert (log2phy >= 0).all()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user