rlightning.weights.weight_buffer¶
- class rlightning.weights.weight_buffer.CPUWeightBuffer(config: WeightBufferConfig)[source]¶
Bases:
WeightBufferImplements a CPU buffer strategy. Weights are transferred to and stored in CPU memory on the evaluator nodes and moved to the GPU just-in-time for model updates.
- class rlightning.weights.weight_buffer.ShardedWeightBuffer(config: WeightBufferConfig)[source]¶
Bases:
WeightBufferImplements a sharded buffer strategy for memory efficiency. Each GPU holds only a fraction of the total weights. Weights are gathered across GPUs on the same node just-in-time for model updates.
- add_shard(dtype: MockModule('torch.dtype'), flat_tensor_shard: MockModule('torch.Tensor'), metadata_list: List[Dict], numel_total: int, is_last: bool)[source]¶
Adds a weight shard for a specific dtype to the buffer.