[rl] Stateful Trainer Send: IPC [2/N] (#48981)
Signed-off-by: haoaaron <ahao@anyscale.com>
This commit is contained in:
@@ -18,9 +18,9 @@ if TYPE_CHECKING:
|
||||
from vllm.config import VllmConfig
|
||||
from vllm.config.weight_transfer import WeightTransferConfig
|
||||
from vllm.distributed.weight_transfer.base import (
|
||||
TrainerInitInfo,
|
||||
VLLMWeightSyncClient,
|
||||
WeightSource,
|
||||
WeightTransferInitInfo,
|
||||
)
|
||||
|
||||
logger = init_logger(__name__)
|
||||
@@ -164,9 +164,7 @@ class WeightTransferTrainerFactory:
|
||||
@classmethod
|
||||
def trainer_init(
|
||||
cls,
|
||||
backend: str,
|
||||
config: "WeightTransferConfig",
|
||||
init_info: "WeightTransferInitInfo",
|
||||
init_info: "TrainerInitInfo",
|
||||
*,
|
||||
client: "VLLMWeightSyncClient",
|
||||
source: "WeightSource",
|
||||
@@ -176,16 +174,22 @@ class WeightTransferTrainerFactory:
|
||||
Called on every trainer rank (multi-rank trainers construct on all
|
||||
ranks; the sender is resolved inside the engine's ``trainer_init``).
|
||||
|
||||
The trainer side takes no `WeightTransferConfig` and no separate
|
||||
`backend` argument: the backend is read from ``init_info.backend`` (a
|
||||
`ClassVar` on each `TrainerInitInfo` subclass), and the static wire
|
||||
params ride `init_info`.
|
||||
|
||||
Args:
|
||||
backend: Backend name (must be registered).
|
||||
config: Backend-specific weight transfer config.
|
||||
init_info: Backend-specific trainer init info.
|
||||
init_info: Backend-specific trainer init info. Its `backend`
|
||||
selects the engine; it also carries the wire params (e.g.
|
||||
`packed`).
|
||||
client: Inference-side control-plane client.
|
||||
source: `WeightSource` of `(name, tensor)` pairs to send each round.
|
||||
|
||||
Raises:
|
||||
ValueError: If the backend is not registered.
|
||||
ValueError: If `init_info.backend` is not registered.
|
||||
"""
|
||||
backend = init_info.backend
|
||||
if backend not in cls._registry:
|
||||
available = list(cls._registry.keys())
|
||||
raise ValueError(
|
||||
@@ -200,7 +204,6 @@ class WeightTransferTrainerFactory:
|
||||
)
|
||||
|
||||
return engine_cls.trainer_init(
|
||||
config=config,
|
||||
init_info=init_info,
|
||||
client=client,
|
||||
source=source,
|
||||
@@ -228,3 +231,12 @@ WeightTransferEngineFactory.register_engine(
|
||||
"vllm.distributed.weight_transfer.sparse_nccl_engine",
|
||||
"SparseNCCLWeightTransferEngine",
|
||||
)
|
||||
|
||||
|
||||
# Trainer-side engines. Backends register here as they migrate to the stateful
|
||||
# trainer engine; NCCL / sparse NCCL keep their static trainer path until then.
|
||||
WeightTransferTrainerFactory.register_engine(
|
||||
"ipc",
|
||||
"vllm.distributed.weight_transfer.ipc_engine",
|
||||
"IPCTrainerWeightTransferEngine",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user