Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion swift/megatron/arguments/megatron_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,8 @@ class MegatronArguments(RLHFMegatronArgumentsMixin, MegatronTunerMixin):
accumulate_allreduce_grads_in_fp32: bool = False

# moe
moe_router_load_balancing_type: Optional[List[str]] = None
moe_router_load_balancing_type: Optional[Literal['aux_loss', 'seq_aux_loss', 'global_aux_loss', 'sinkhorn',
'none']] = None
Comment on lines +589 to +590

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better readability and adherence to PEP 8 style guidelines for long lines, consider formatting this long Literal type hint across multiple lines. This makes it easier to read and maintain.

Suggested change
moe_router_load_balancing_type: Optional[Literal['aux_loss', 'seq_aux_loss', 'global_aux_loss', 'sinkhorn',
'none']] = None
moe_router_load_balancing_type: Optional[Literal[
'aux_loss',
'seq_aux_loss',
'global_aux_loss',
'sinkhorn',
'none',
]] = None
References
  1. PEP 8 suggests limiting all lines to a maximum of 79 characters (or 99 for some projects) for better readability. Long lines can be broken over multiple lines by wrapping expressions in parentheses, brackets, or braces. (link)

moe_router_dtype: Literal['none', 'fp32', 'fp64'] = 'fp32'
moe_token_dispatcher_type: Literal['allgather', 'alltoall', 'flex'] = 'alltoall'
moe_enable_deepep: bool = False
Expand Down
Loading