Support updating expert locations dynamically (#6388)
This commit is contained in:
@@ -22,6 +22,7 @@ import torch.distributed
|
||||
import torch.nn.functional as F
|
||||
|
||||
from sglang.srt.configs.model_config import ModelConfig
|
||||
from sglang.srt.managers import deepseek_eplb
|
||||
from sglang.srt.model_loader import get_model_architecture
|
||||
from sglang.srt.server_args import ServerArgs
|
||||
|
||||
@@ -207,6 +208,26 @@ class ExpertLocationMetadata:
|
||||
),
|
||||
)
|
||||
|
||||
# -------------------------------- mutation ------------------------------------
|
||||
|
||||
def update(
|
||||
self,
|
||||
other: "ExpertLocationMetadata",
|
||||
):
|
||||
for field in [
|
||||
"ep_size",
|
||||
]:
|
||||
assert getattr(self, field) == getattr(other, field)
|
||||
|
||||
for field in [
|
||||
"physical_to_logical_map",
|
||||
"logical_to_all_physical_map",
|
||||
"logical_to_all_physical_map_num_valid",
|
||||
"logical_to_rank_dispatch_physical_map",
|
||||
]:
|
||||
dst = getattr(self, field)
|
||||
dst[...] = getattr(other, field)
|
||||
|
||||
# -------------------------------- usage ------------------------------------
|
||||
|
||||
def logical_to_all_physical(
|
||||
|
||||
Reference in New Issue
Block a user