Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Add option to save ttyrec files every "M" episodes #260

Merged
merged 2 commits into from
Jan 25, 2022

Conversation

dmadeka
Copy link
Contributor

@dmadeka dmadeka commented Sep 21, 2021

@heiner Solves #256

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 21, 2021
@dmadeka dmadeka marked this pull request as draft September 21, 2021 20:45
@dmadeka
Copy link
Contributor Author

dmadeka commented Sep 21, 2021

@heiner so weird - this passed all the checks

@heiner
Copy link
Contributor

heiner commented Sep 22, 2021

@heiner so weird - this passed all the checks

Is this about the test failing in https://github.com/facebookresearch/nle/pull/259/checks?check_run_id=3667649209 ? That's a flake, showing up only in a small percentage of cases (due to the NetHack RNG and perhaps also the random actions supplied).

@heiner
Copy link
Contributor

heiner commented Sep 22, 2021

BTW it would be better for this PR to not contain the changes from #259. Some git-fu would make that possible.

@dmadeka
Copy link
Contributor Author

dmadeka commented Sep 22, 2021

Yeah - I remember you mentioning you squash commits, so I can rebase and drop the plot commits

@dmadeka
Copy link
Contributor Author

dmadeka commented Sep 22, 2021

@heiner Done! sorry - i forgot you guys squash commits

@dmadeka dmadeka changed the title [WIP] Add option to save ttyrec files every "M" episodes Add option to save ttyrec files every "M" episodes Sep 22, 2021
@dmadeka dmadeka marked this pull request as ready for review September 22, 2021 15:34
@@ -216,6 +216,7 @@ def __init__(
allow_all_modes=False,
space_dict=None,
spawn_monsters=True,
episode_save_cycle=1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I like this idea, I think this is also a good opportunity to rethink this API a bit.

We've not done some changes to this API that we wanted to do in the past (e.g., remove archivefile which doesn't do anything anymore) in order to not create undue churn during the NetHack competition.

After the competition, we have another chance getting some of the behaviors right. I could imagine:

  • Calling this save_episode_every, or even episodes_per_ttyrec (there might be something better).
  • Right now, savedir=None disables saving of episodes. savedir='' is a magic argument that creates a random temporal directory. Any other string is taken as a path. That is a bit too magical. With this new argument, we could turn 0 into "don't save at all", which would free savedir=None to mean what savedir='' does right now.

But we'll need a bit of time to discuss between @condnsdmatters, @tscmoo, @samvelyan and myself.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah - this is a lot faster, so internally we're working off this branch. If you guys have a slack channel (with public sub-channels) happy to weigh in or continue off our internal branch

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not saving any ttyrecs is even faster ;)

But I get that having some ttyrecs is useful, too.

We don't currently have slack channel, but you can reach us on the NetHack competition discord. Note though that the competition runs until mid October and we are probably not going to make API changes until then -- would you be okay with working on your own branch until then?

Copy link
Contributor Author

@dmadeka dmadeka Sep 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah - Im fine with that (CC: @deanpfoster)

@@ -460,7 +465,12 @@ def reset(self, wizkit_items=None):
"""
self._episode += 1
new_ttyrec = self._ttyrec_pattern % self._episode if self.savedir else None
self.last_observation = self.env.reset(new_ttyrec, wizkit_items=wizkit_items)
if self._episode % self._episode_save_cycle == 0:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can/should probably roll that into the logic of the line before.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i just commented on my own repo - we can do that too

@heiner heiner requested a review from cdmatters September 22, 2021 16:16
@heiner heiner added the breaking change Introduces a breaking change in API label Sep 24, 2021
@heiner heiner changed the base branch from main to ttyrecskip January 25, 2022 17:21
@heiner
Copy link
Contributor

heiner commented Jan 25, 2022

Merging this into a dev branch for further refinement of the API.

@heiner heiner merged commit febbc0d into facebookresearch:ttyrecskip Jan 25, 2022
@heiner
Copy link
Contributor

heiner commented Jan 25, 2022

@dmadeka please follow in #304 re: the exact API of your proposal here.

heiner pushed a commit that referenced this pull request Jan 26, 2022
Initial attempt to add Episode Save Cycle
heiner pushed a commit that referenced this pull request Jan 26, 2022
Initial attempt to add Episode Save Cycle
@dmadeka
Copy link
Contributor Author

dmadeka commented Feb 7, 2022

@heiner Will get back to this after the COLT deadline!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking change Introduces a breaking change in API CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants