-
Notifications
You must be signed in to change notification settings - Fork 113
Save ttyrecs every "M" episode #256
Comments
Hey! This is a good idea but should probably not be done on the python side. The reason is that even when writing every 1000th episode only, we'd want to keep the existing ttyrec output file open. (This issue does not apply if you are looking to write different ttyrec files anyway.) |
@deanpfoster and I were thinking of something like this here: if self._episode % self._episode_save_cycle == 0:
self.last_observation = self.env.reset(new_ttyrec, wizkit_items=wizkit_items)
else:
self.last_observation = self.env.reset('/dev/null', wizkit_items=wizkit_items) |
So if one is changing the I would suggest not using the Instead, we have a code path for |
I first thought of replacing “/dev/null” with ‘None’ - but then realized it might be the open file stream issue you were mentioning? |
I might have been a bit unclear regarding what the "file stream issue" is. If you look at https://github.com/facebookresearch/nle/blob/main/win/rl/pynethack.cc#L108 and https://github.com/facebookresearch/nle/blob/main/src/nle.c#L125 you see that the C++ layer in pynethack.cc opens However, that's not what the higher-level gym interface in base.py does. As you point out, it seems to ask for a new file for each episode anyway. In which case rate-limiting it is a great idea and can easily be implemented on that level. |
Okay - that was my understanding initially and then I got confused! The if self._episode % self._episode_save_cycle == 0:
self.last_observation = self.env.reset(new_ttyrec, wizkit_items=wizkit_items)
else:
self.last_observation = self.env.reset(None, wizkit_items=wizkit_items) |
Currently the base environment seems to write a ttyrec at every call of reset (if
savedir is not None
). This creates a lot of ttyrec files.It may be useful to add a parameter (say
save_episode_cycle
) to determine when to save a ttyrec - the ttyrec in that line can be set to None for every other episode in the cycleWould this be a PR you alls would be interested in?
The text was updated successfully, but these errors were encountered: