mirror of
https://github.com/gryf/coach.git
synced 2025-12-17 19:20:19 +01:00
Adding nfs pv, pvc, waiting for memory to be full
This commit is contained in:
committed by
zach dwiel
parent
13d81f65b9
commit
98850464cc
@@ -1,22 +1,19 @@
|
||||
"""
|
||||
"""
|
||||
import argparse
|
||||
import time
|
||||
|
||||
from rl_coach.base_parameters import TaskParameters
|
||||
from rl_coach.coach import expand_preset
|
||||
from rl_coach import core_types
|
||||
from rl_coach.utils import short_dynamic_import
|
||||
from rl_coach.memories.non_episodic.distributed_experience_replay import DistributedExperienceReplay
|
||||
from rl_coach.memories.memory import MemoryGranularity
|
||||
|
||||
# Q: specify alternative distributed memory, or should this go in the preset?
|
||||
# A: preset must define distributed memory to be used. we aren't going to take a non-distributed preset and automatically distribute it.
|
||||
|
||||
|
||||
def heatup(graph_manager):
|
||||
num_steps = graph_manager.schedule_params.heatup_steps.num_steps
|
||||
while len(graph_manager.agent_params.memory) < num_steps:
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
def training_worker(graph_manager, checkpoint_dir):
|
||||
"""
|
||||
restore a checkpoint then perform rollouts using the restored model
|
||||
@@ -29,10 +26,20 @@ def training_worker(graph_manager, checkpoint_dir):
|
||||
# save randomly initialized graph
|
||||
graph_manager.save_checkpoint()
|
||||
|
||||
heatup(graph_manager)
|
||||
memory = DistributedExperienceReplay(max_size=(MemoryGranularity.Transitions, 1000000),
|
||||
redis_ip=graph_manager.agent_params.memory.redis_ip,
|
||||
redis_port=graph_manager.agent_params.memory.redis_port)
|
||||
|
||||
while(memory.num_transitions() < 100):
|
||||
time.sleep(10)
|
||||
# TODO: critical: wait for minimum number of rollouts in memory before training
|
||||
# TODO: Q: training steps passed into graph_manager.train ignored?
|
||||
# TODO: specify training steps between checkpoints (in preset?)
|
||||
# TODO: replace while true with what? number of steps, convergence, time, ...
|
||||
# TODO: low: move evaluate out of this process
|
||||
|
||||
# training loop
|
||||
for _ in range(10):
|
||||
for _ in range(40):
|
||||
graph_manager.phase = core_types.RunPhase.TRAIN
|
||||
graph_manager.train(core_types.TrainingSteps(1))
|
||||
graph_manager.phase = core_types.RunPhase.UNDEFINED
|
||||
@@ -72,5 +79,6 @@ def main():
|
||||
checkpoint_dir=args.checkpoint_dir,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user