trinity.utils.distributed module#
For distributed training with multiple process groups.
- trinity.utils.distributed.init_process_group(host: str, port: int, group_name: str, backend: str | Backend = 'nccl', timeout: float | None = None, world_size: int = -1, rank: int = -1, pg_options: Any | None = None, device_id: device | None = None)[source]#
This function is used to initialize the process group. It requires torch >= 2.6.0
- class trinity.utils.distributed.VLLMWeightTransferEngine(master_address: str, master_port: int, world_size: int, group_name: str)[source]#
Bases:
WeightTransferEngineA helper class to manage weight synchronization using vLLMâs API.
Device-aware: uses HCCL engine on NPU and NCCL engine on GPU. Both engines expose the same
trainer_init/trainer_send_weightsAPI surface, so the only difference is the engine class and args dataclass used.- __init__(master_address: str, master_port: int, world_size: int, group_name: str)[source]#
Initialize the process group for weight sync with vLLMâs API.
- class trinity.utils.distributed.SGLangWeightTransferEngine(master_address: str, master_port: int, world_size: int, group_name: str)[source]#
Bases:
WeightTransferEngineA helper class to manage NCCL weight synchronization using SGLangâs API.