env#

The MODELOPT_* environment-variable knobs of distributed HuggingFace model loading.

Each knob is a small accessor that reads os.environ at call time, not at import: a launcher sets them before it forks the distributed workers, and tests may override them, so the live value is what matters. Callers do from modelopt.torch.utils import env then env.ep_degree().

Distribution plan (see resolve_distribution_plan):

  • MODELOPT_EP_DEGREE: expert-parallel degree; ""/unset -> "auto".

  • MODELOPT_FSDP_SIZE: the dense layout. "1" replicates it; "world", or the world size as a number, FSDP2-shards it over every rank; ""/unset -> "auto".

Functions

ep_degree

Expert-parallel degree knob for resolve_distribution_plan; ""/unset -> "auto".

fsdp_size

Dense-sharding knob for resolve_distribution_plan; ""/unset -> "auto".

ep_degree()#

Expert-parallel degree knob for resolve_distribution_plan; ""/unset -> "auto".

Return type:

str

fsdp_size()#

Dense-sharding knob for resolve_distribution_plan; ""/unset -> "auto".

Return type:

str