ml-agents icon indicating copy to clipboard operation
ml-agents copied to clipboard

How can i limit training time using relative training time?

Open oseq opened this issue 7 years ago • 10 comments

Hello guys i am doing some study on my agent i need to compare some training sesions. I know i can limit my trainig time using max_setps parameter in config file. But is it possible to limit training not by setps but with training time duration. For example if i want to train model only 30 minutes.

oseq avatar May 09 '19 10:05 oseq

You can do basic math by measuring how many seconds are in 100 steps and do the math from there.

roboserg avatar May 09 '19 13:05 roboserg

Yeah, but time of 1 step is not constant and it depend on many configuration aspects. However o already came up with solution that is maybe not the best but it works, i measure the time on Unity side using unscaled time and call: UnityEditor.EditorApplication.ExecuteMenuItem("Edit/Play");

... when it extends maximum time.

oseq avatar May 09 '19 13:05 oseq

wait, how are steps not constant? They should be constant. An agent takes action every X steps (set in Decision Interval of an agent). You can set max_steps = 100 and calculate how long an episode takes at maximum.

roboserg avatar May 09 '19 13:05 roboserg

I mean that time of one step can vary between different training sessions due to different parameters of training i.e. decision interval.

oseq avatar May 09 '19 13:05 oseq

how do we know that for certain? I'd think the steps would be constant.

roboserg avatar May 09 '19 14:05 roboserg

@roboserg i used to think same as you. I am analiysing training summaries for different training sessions using tensorboard. Changing some paramterers usualy makes relative small difference, but if you f.e. swtich between PPO and BC the difference is huge.

oseq avatar May 09 '19 15:05 oseq

Hi @oseq, you are right, training time could be vastly different depending on how fast samples are gathered from the Unity executable. BC is an entirely different beast as well, since it trains purely from .demo files and doesn't really use the Unity game for training.

Since we now keep track of the time elapsed, you could add a check for time as well as max steps in trainer.py (here). If you get it to work, we'd definitely welcome a PR!

ervteng avatar May 09 '19 17:05 ervteng

@ervteng Arent steps itself, constantly in time? The ones we are setting with "max_steps" and "decision interval" etc? Environment steps of the simulation.

roboserg avatar May 09 '19 17:05 roboserg

Thanks for submitting this request. I’ve shared it with the team, so I’m going to close this issue for now.

harperj avatar Oct 01 '19 23:10 harperj

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Jan 29 '21 14:01 github-actions[bot]