class_docstr: Episodic version of :py:class:`PersistentReplayBuffer`
  
  Args:
      dirname (str): Directory name where the buffer data is saved.
          This cannot be used with `ancestor`
      capacity (int): Capacity in terms of number of transitions
      ancestor (str): Path to pre-generated replay buffer. The `ancestor`
          directory is used to load/save, instead of `dirname`.
      logger: logger object
      distributed (bool): Use a distributed version for the underlying
          persistent queue class. You need the private package `pfrlmn`
          to use this option.
      group: `torch.distributed` group object. Only used when
          `distributed=True` and pfrlmn package is available
  
  .. note:: Current implementation is inefficient, as episodic
         memory and memory data shares the almost same data in
         :py:class:`EpisodicReplayBuffer` by reference but shows different
         data structure. Otherwise, persistent version of them does
         not share the data between them but backing file structure
         is separated.
class_docstr_tok: ["Episodic","version","of",":","py",":","class",":","`","PersistentReplayBuffer","`","Args",":","dirname","(","str",")",":","Directory","name","where","the","buffer","data","is","saved",".","This","can","not","be","used","with","`","ancestor","`","capacity","(","int",")",":","Capacity","in","terms","of","number","of","transitions","ancestor","(","str",")",":","Path","to","pre-generated","replay","buffer",".","The","`","ancestor","`","directory","is","used","to","load\/save",",","instead","of","`","dirname","`",".","logger",":","logger","object","distributed","(","bool",")",":","Use","a","distributed","version","for","the","underlying","persistent","queue","class",".","You","need","the","private","package","`","pfrlmn","`","to","use","this","option",".","group",":","`","torch.distributed","`","group","object",".","Only","used","when","`","distributed=True","`","and","pfrlmn","package","is","available","..","note",":",":","Current","implementation","is","inefficient",",","as","episodic","memory","and","memory","data","shares","the","almost","same","data","in",":","py",":","class",":","`","EpisodicReplayBuffer","`","by","reference","but","shows","different","data","structure",".","Otherwise",",","persistent","version","of","them","does","not","share","the","data","between","them","but","backing","file","structure","is","separated","."]
code: def __init__(
      self,
      dirname,
      capacity,
      *,
      ancestor=None,
      logger=None,
      distributed=False,
      group=None,
  ):
      super().__init__(capacity)
  
      self.memory_dir = os.path.join(dirname, "memory")
      self.episodic_memory_dir = os.path.join(
          dirname, "episodic_memory"
      )
  
      if not distributed:
          self.memory = PersistentRandomAccessQueue(
              self.memory_dir,
              capacity,
              ancestor=ancestor,
              logger=logger,
          )
          self.episodic_memory = PersistentRandomAccessQueue(
              self.episodic_memory_dir,
              capacity,
              ancestor=ancestor,
              logger=logger,
          )
      else:
          try:
              # Use distributed versions of PersistentRandomAccessQueue
              import pfrlmn.collections.persistent_collections as mn_coll
  
              self.memory = mn_coll.PersistentRandomAccessQueue(
                  self.memory_dir,
                  capacity,
                  ancestor=ancestor,
                  logger=logger,
                  group=group,
              )
              self.episodic_memory = (
                  mn_coll.PersistentRandomAccessQueue(
                      self.episodic_memory_dir,
                      capacity,
                      ancestor=ancestor,
                      logger=logger,
                      group=group,
                  )
              )
  
          except ImportError:
              # "pfrlmn" package is not publicly available as of pfrl release.
              raise RuntimeError(
                  "`pfrlmn` private package is required "
                  "to enable distributed execution support "
                  "of PersistentEpisodicReplayBuffer."
              )
  
file_path: pfrl/pfrl/replay_buffers/persistent.py
imports: import os
  import warnings
  from pfrl.collections.persistent_collections import PersistentRandomAccessQueue
  from .episodic import EpisodicReplayBuffer
  from .replay_buffer import ReplayBuffer
label_desc: Use image node_id 1 to create a new PersistentEpisodicReplayBuffer object from inherited base classes: EpisodicReplayBuffer with example: obj = PersistentEpisodicReplayBuffer(dirname, capacity)