-
Notifications
You must be signed in to change notification settings - Fork 6k
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] Fix small memory leak in OfflineSingleAgentEnvRunner
.
#48309
[RLlib; Offline RL] Fix small memory leak in OfflineSingleAgentEnvRunner
.
#48309
Conversation
…entEnvRunner'. Signed-off-by: simonsays1980 <simon.zehnder@gmail.com>
OfflineSingleAgentEnvRunner
.OfflineSingleAgentEnvRunner
.
rllib/offline/offline_env_runner.py
Outdated
@@ -164,6 +164,8 @@ def sample( | |||
# TODO (simon): Find a better way to write these data. | |||
self._samples = self._samples[self.output_max_rows_per_file :] | |||
samples_ds = ray.data.from_items(samples_to_write) | |||
# Delete reference to free memory. | |||
del samples_to_write |
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.
Why do we need to do this? Python's GC should take care of it when the variable goes out of scope, no?
It also keeps all the data anyways b/c it's just a slice from the self._samples
ndarray.
…ric. Furthermore, added another user configuration 'output_write_remaining_data' to decide, if remaining data from the recording buffers of EnvRunners should be written to disk. Finally, updated the recording example to show a more realistic recording use case. Signed-off-by: simonsays1980 <simon.zehnder@gmail.com>
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.
Very nice PR!!
While we are at this, can we convert this into an actual example and add it to the CI? This will bolsert our offline RL documentation efforts.
Signed-off-by: simonsays1980 <simon.zehnder@gmail.com>
…Implemented some changes suggested in @sven1977's review. Signed-off-by: simonsays1980 <simon.zehnder@gmail.com>
…ming out in CI tests. Signed-off-by: simonsays1980 <simon.zehnder@gmail.com>
…toscaler tells in CI test errors that resources can not be fulfilled. Signed-off-by: simonsays1980 <simon.zehnder@gmail.com>
… of the corresponding 'EnvRunner'. Signed-off-by: simonsays1980 <simon.zehnder@gmail.com>
…antly due to resource requests. Signed-off-by: simonsays1980 <simon.zehnder@gmail.com>
…but still runs on local and cloud tests. Signed-off-by: simonsays1980 <simon.zehnder@gmail.com>
Signed-off-by: simonsays1980 <simon.zehnder@gmail.com>
…nner`. (ray-project#48309) Signed-off-by: Connor Sanders <connor@elastiflow.com>
…nner`. (ray-project#48309) Signed-off-by: hjiang <dentinyhao@gmail.com>
…nner`. (ray-project#48309) Signed-off-by: ujjawal-khare <ujjawal.khare@dream11.com>
Why are these changes needed?
There was a small memory leak that became apparent when recording for a longer time. This leak was mainly due to
output_max_rows_per_file
too small for the sample size. This PRoutput_write_remaining_data
that defines if the recording buffers in anOfflineSingleAgentEnvRunner
should be cleared to disk when stopping recording.Related issue number
Closes #48025
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.