mirror of
https://github.com/gryf/coach.git
synced 2026-01-08 06:44:16 +01:00
Avoid Memory Leak in Rollout worker
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.
This commit is contained in:
@@ -56,10 +56,6 @@ def test_basic_rl_graph_manager_with_cartpole_dqn_and_repeated_checkpoint_restor
|
||||
# graph_manager.save_checkpoint()
|
||||
#
|
||||
# graph_manager.task_parameters.checkpoint_restore_dir = "./experiments/test/checkpoint"
|
||||
# graph_manager.agent_params.memory.register_var('memory_backend_params',
|
||||
# MemoryBackendParameters(store_type=None,
|
||||
# orchestrator_type=None,
|
||||
# run_type=str(RunType.ROLLOUT_WORKER)))
|
||||
# while True:
|
||||
# graph_manager.restore_checkpoint()
|
||||
# gc.collect()
|
||||
|
||||
Reference in New Issue
Block a user