[Misc] enhance type hint for rearrange return value (#23519)
Signed-off-by: Andy Xie <andy.xning@gmail.com>
This commit is contained in:
@ -409,12 +409,14 @@ class EplbState:
|
|||||||
self.expert_rearrangement_step = 0
|
self.expert_rearrangement_step = 0
|
||||||
self.rearrange(model)
|
self.rearrange(model)
|
||||||
|
|
||||||
def rearrange(self,
|
def rearrange(
|
||||||
|
self,
|
||||||
model: MixtureOfExperts,
|
model: MixtureOfExperts,
|
||||||
is_profile: bool = False,
|
is_profile: bool = False,
|
||||||
execute_shuffle: bool = True,
|
execute_shuffle: bool = True,
|
||||||
global_expert_load: Optional[torch.Tensor] = None,
|
global_expert_load: Optional[torch.Tensor] = None,
|
||||||
rank_mapping: Optional[dict[int, int]] = None) -> None:
|
rank_mapping: Optional[dict[int,
|
||||||
|
int]] = None) -> Optional[torch.Tensor]:
|
||||||
"""
|
"""
|
||||||
Rearrange the experts according to the current load.
|
Rearrange the experts according to the current load.
|
||||||
"""
|
"""
|
||||||
@ -548,6 +550,7 @@ class EplbState:
|
|||||||
" (profile) " if is_profile else " ",
|
" (profile) " if is_profile else " ",
|
||||||
time_end - time_start,
|
time_end - time_start,
|
||||||
)
|
)
|
||||||
|
return None
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def recv_state() -> tuple[torch.Tensor, torch.Tensor]:
|
def recv_state() -> tuple[torch.Tensor, torch.Tensor]:
|
||||||
|
Reference in New Issue
Block a user