get_default_hybrid_sharders
Function
Obtains a table sharder.
Prototype
1 | def get_default_hybrid_sharders(host_env: ShardingEnv) -> List[ModuleSharder[nn.Module]]: |
Parameters
Parameter |
Data Type |
Mandatory/Optional |
Description |
|---|---|---|---|
host_env |
ShardingEnv |
Mandatory |
Communication domain required for connecting to the host. For details, see the creation method of 3. Only "gloo" is supported. |
Return Value
Success: The default sharder is returned.
Failure: An exception is thrown.
Sample
from hybrid_torchrec.distributed.sharding_plan import get_default_hybrid_sharders from torchrec.distributed.types import ShardingEnv import torch.distributed as dist host_gp = dist.new_group(backend="gloo") world_size = dist.get_world_size() rank = dist.get_rank() host_env = ShardingEnv(world_size=world_size, rank=rank, pg=host_gp) hybrid_sharder = get_default_hybrid_sharders(host_env=host_env)
Parent topic: Table Splitting APIs