Right now monitor video callable takes only a single parameter, which is episode count, but, in general, it makes more sense to record video during test periods only and not record it otherwise.
In general, it would make sense to have conditional recording and start/stop video recording when it is explicitly requested and don't record otherwise.
Hence the question. Is there a way to do it now, and if not, can we expect such feature in the nearest future.
Thank you in advance.
Sure, the video_callable function you provide can look at any variables it needs to make its decision. For instance, an agent could do something like this to record every 10th episode only in test mode:
class MyAgent:
def __init__(self):
env = gym.make(...)
self.env = gym.wrappers.Monitor(env, '/tmp/mylog', video_callable=self.video_callable)
...
def video_callable(self, episode_id):
return episode_id%10 == 0 and self.test_mode
it could be a method of the agent and can look at self.test_mode or whatever.
Oh, I see. Somehow I thought they should only have access to local variables and provided id only.
Thanks a lot ! I believe it would make sense to add this answer to the tutorial page :)
Most helpful comment
Sure, the video_callable function you provide can look at any variables it needs to make its decision. For instance, an agent could do something like this to record every 10th episode only in test mode:
it could be a method of the agent and can look at
self.test_modeor whatever.