rlightning.weights.utils

rlightning.weights.utils.build_weight_buffer(weight_buffer_cls: str, weight_buffer_cfg: WeightBufferConfig | None = None, node_id: str | None = None)[source]

Build an instance of WeightBuffer.

If the configuration for building indicates the buffer strategy is shared, then the returned instance would be an instance of ray.actor.ActorHandle.

Parameters:
  • weight_buffer_cls (str) – Registered name of a weight buffer class

  • weight_buffer_cfg (Optional[WeightBufferConfig], optional) – Configuration for building the weight buffer. Defaults to None.

  • node_id (Optional[str], optional) – Node id. Defaults to None.

Returns:

An instance of weightbuffer or an Actor.

Return type:

WeightBuffer | ActorHandle

rlightning.weights.utils.is_numpy_state_dict(state_dict)[source]
rlightning.weights.utils.numpy_state_dict_to_tensor(state_dict)[source]
rlightning.weights.utils.tensor_state_dict_to_numpy(state_dict)[source]