collective_rpc#

async DPServer.collective_rpc(method: str, timeout: float | None = None, args: tuple = (), kwargs: dict | None = None) list#

Execute a collective RPC call on all workers.

This is used for RLHF workflows where a trainer needs to execute methods on all TP/PP workers (e.g., for weight synchronization).

Parameters:
  • method (str) – Name of the worker method to execute.

  • timeout (float | None) – Maximum time in seconds to wait for execution.

  • args (tuple) – Positional arguments to pass to the worker method.

  • kwargs (dict | None) – Keyword arguments to pass to the worker method.

Returns:

A list containing the results from each worker.

Return type:

list