ReplayBuffer#

class hybrid_aif.train.ReplayBuffer[source]#

Bases: Dataset

Ring-storage replay buffer with whole-episode FIFO eviction. Host-side.

Both a Dataset and a Writer. Storage is one numpy ring per column of max_steps rows, allocated from the first episode’s schema; clips never cross episode boundaries. dump(path, format) persists through any registered format.

Arguments:

  • max_steps: capacity budget in raw steps.

  • num_steps: observation frames per clip (Dataset windowing).

  • frameskip: stride between observation frames within a clip.

  • sampler: pluggable Sampler used by sample(); uniform over valid clips by default.

  • seed: seed for the default rng handed to the sampler.

__init__(max_steps, num_steps=1, frameskip=1, sampler=None, seed=None)[source]#
sample(batch_size, rng=None)[source]#

Draw a batch of clips via the sampler; arrays are stacked to (batch_size, num_steps, ...).

iter_episodes()[source]#

Yield stored episodes oldest-first as contiguous column dicts.

dump(path, format, mode='overwrite', **kwargs)[source]#

Persist current contents through the registered writer for format.