How severe does this issue affect your experience of using Ray?
- Low: It annoys or frustrates me for a moment.
I have a logger that inherits from
DefaultCallbacks and overwrites the
on_episode_end and a class that extends the
TBXLoggerCallback. I need to inherit from
DefaultCallbacks because I need the environment to get the render (and gif but this example is only the render).
Now the problem is that the variable
log_trial_result contains duplicates. And even after I tried for example
result['episode_media']['images'] =  after I wrote all the images it still kept some old images from result dicts from previous episodes. In the end I fixed it by keeping a variable that keeps track of all the images logged so far and if it is in this list I don’t log them anymore but ideally Ray will reset the result dict after
log_trial_result or something like that. So I am wondering what causes this behavior. It is also not the case that everything gets kept by the way. At some point old images get removed from the result dict but not on every result.
What causes this behavior?
class RenderCallback(DefaultCallbacks): def on_episode_end(...): environment = base_env.get_sub_environments() if environment.episode_counter % 10 == 0: image_to_save_to_TB = environment.get_render(...) episode.media['images'] = image_to_save_to_TB class TBXLoggerExtended(TBXLoggerCallback): def log_trial_result(self, iteration: int, trial: "Trial", result: dict): super().log_trial_result(iteration, trial, result) images = result['episode_media']['images'] for image in images: self._trial_writer[trial].add_image(trial.logdir, image) # result['episode_media']['images'] =  # Even if this is uncommented it still has old images.