trinity.buffer package#

Subpackages#

Submodules#

Module contents#

class trinity.buffer.BufferReader[源代码]#

基类:ABC

Interface of the buffer reader.

load_state_dict(state_dict: Dict) None[源代码]#
abstractmethod read(batch_size: int | None = None, **kwargs) List[源代码]#

Read from buffer.

abstractmethod async read_async(batch_size: int | None = None, **kwargs) List[源代码]#

Read from buffer asynchronously.

state_dict() Dict[源代码]#

Return the state of the reader as a dict. :returns: A dict containing the reader state. At minimum, it should contain

the current_index field.

class trinity.buffer.BufferWriter[源代码]#

基类:ABC

Interface of the buffer writer.

abstractmethod async acquire() int[源代码]#

Acquire the buffer writer.

返回:

The reference count of the buffer after acquiring.

返回类型:

int

abstractmethod async release() int[源代码]#

Release the buffer writer. After release, the buffer writer can not be used again.

返回:

The reference count of the buffer after releasing.

返回类型:

int

abstractmethod write(data: List) None[源代码]#

Write to buffer.

abstractmethod async write_async(data: List) None[源代码]#

Write to buffer asynchronously.

trinity.buffer.get_buffer_reader(config: TasksetConfig | ExperienceBufferConfig | StorageConfig) BufferReader[源代码]#

Get a buffer reader for the given dataset name.

trinity.buffer.get_buffer_writer(config: TasksetConfig | ExperienceBufferConfig | StorageConfig) BufferWriter[源代码]#

Get a buffer writer for the given dataset name.