-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RLlib; Offline RL] Added stop
method to OfflineEnvRunner
.
#47155
[RLlib; Offline RL] Added stop
method to OfflineEnvRunner
.
#47155
Conversation
…ces in the buffer to disk. Signed-off-by: simonsays1980 <simon.zehnder@gmail.com>
Signed-off-by: simonsays1980 <simon.zehnder@gmail.com>
…'max_rows_per_file' is defining now the maximum number of episodes to store into a file/folder. Furthermore, unified buffer for episodes and column data. Signed-off-by: simonsays1980 <simon.zehnder@gmail.com>
number of rows for the remaining samples could be | ||
less than the defined maximum row number by the user. | ||
""" | ||
# If there are samples left over we have to write htem to disk. them |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parent method doesn't do anything, but I think we should still call it, what do you think?
super().stop()
@@ -229,7 +239,7 @@ def _map_episodes_to_data(self, samples: List[EpisodeType]) -> None: | |||
Columns.ACTIONS: pack_if_needed( | |||
to_jsonable_if_needed(sample.get_actions(i), action_space) | |||
) | |||
if Columns.OBS in self.output_compress_columns | |||
if Columns.ACTIONS in self.output_compress_columns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch! :)
self._samples = [] | ||
else: | ||
self._samples_data = [] | ||
# Define the buffer for experiences stored until written to disk. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was a little confusing :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it. So much more elegant to put this in stop
.
Just the nit about the parent stop
method call.
Thanks @simonsays1980 !!
stop
method to 'OfflineEnvRunner'
stop
method to 'OfflineEnvRunner'stop
method to OfflineEnvRunner
.
stop
method to OfflineEnvRunner
.stop
method to OfflineEnvRunner
.
Why are these changes needed?
The
max_rows_per_file
gives a user control over the number of writing processes during a run when recording the experiences. It does so by buffering episodes or row data untilmax_rows_per_file
is reached.If the run stops, this buffer could be still non-empty. This PR proposes to override the
EnvRunner.stop
method to write remaining episodes or step data onto disk.Related issue number
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.