mirror of
https://github.com/gryf/coach.git
synced 2026-01-07 14:24:16 +01:00
ISSUE: When we restore checkpoints, we create new nodes in the Tensorflow graph. This happens when we assign new value (op node) to RefVariable in GlobalVariableSaver. With every restore the size of TF graph increases as new nodes are created and old unused nodes are not removed from the graph. This causes the memory leak in restore_checkpoint codepath. FIX: We reset the Tensorflow graph and recreate the Global, Online and Target networks on every restore. This ensures that the old unused nodes in TF graph is dropped.
Block Factory
The block factory is a class which creates a block that fits into a specific RL scheme. Example RL schemes are: self play, multi agent, HRL, basic RL, etc. The block factory should create all the components of the block and return the block scheduler. The block factory will then be used to create different combinations of components. For example, an HRL factory can be later instantiated with:
- env = Atari Breakout
- master (top hierarchy level) agent = DDPG
- slave (bottom hierarchy level) agent = DQN
A custom block factory implementation should look as follows:
class CustomFactory(BlockFactory):
def __init__(self, custom_params):
super().__init__()
def _create_block(self, task_index: int, device=None) -> BlockScheduler:
"""
Create all the block modules and the block scheduler
:param task_index: the index of the process on which the worker will be run
:return: the initialized block scheduler
"""
# Create env
# Create composite agents
# Create level managers
# Create block scheduler
return block_scheduler