mirror of
https://github.com/gryf/coach.git
synced 2026-02-23 02:25:50 +01:00
Adding initial interface for backend and redis pubsub (#19)
* Adding initial interface for backend and redis pubsub * Addressing comments, adding super in all memories * Removing distributed experience replay
This commit is contained in:
committed by
zach dwiel
parent
a54ef2757f
commit
6b2de6ba6d
@@ -18,6 +18,7 @@ from enum import Enum
|
||||
from typing import Tuple
|
||||
|
||||
from rl_coach.base_parameters import Parameters
|
||||
from rl_coach.memories.backend.memory import MemoryBackend
|
||||
|
||||
|
||||
class MemoryGranularity(Enum):
|
||||
@@ -32,7 +33,6 @@ class MemoryParameters(Parameters):
|
||||
self.shared_memory = False
|
||||
self.load_memory_from_file_path = None
|
||||
|
||||
|
||||
@property
|
||||
def path(self):
|
||||
return 'rl_coach.memories.memory:Memory'
|
||||
@@ -45,9 +45,16 @@ class Memory(object):
|
||||
"""
|
||||
self.max_size = max_size
|
||||
self._length = 0
|
||||
self.memory_backend = None
|
||||
|
||||
def store(self, obj):
|
||||
raise NotImplementedError("")
|
||||
if self.memory_backend:
|
||||
self.memory_backend.store(obj)
|
||||
|
||||
def store_episode(self, episode):
|
||||
if self.memory_backend:
|
||||
for transition in episode:
|
||||
self.memory_backend.store(transition)
|
||||
|
||||
def get(self, index):
|
||||
raise NotImplementedError("")
|
||||
@@ -64,4 +71,5 @@ class Memory(object):
|
||||
def clean(self):
|
||||
raise NotImplementedError("")
|
||||
|
||||
|
||||
def set_memory_backend(self, memory_backend: MemoryBackend):
|
||||
self.memory_backend = memory_backend
|
||||
|
||||
Reference in New Issue
Block a user