integration.gymnasium
CometLogger¶
class comet_ml.integration.gymnasium.CometLogger(self, env: gym.Env, experiment: comet_ml.Experiment)
Gymnasium Wrapper that logs the step length and cumulative reward for an episode to Comet
Args:
- env: gymnasium.Env (required), gymnasium environment to wrap
- experiment: Experiment (required), the Comet Experiment object to use for experiment management
comet_ml.integration.gymnasium.CometLogger.reset¶
reset(**kwargs)
Resets length and reward counters and increments episode counter. Any arguments specified in kwargs
are passed to Gymnasium enviroment as usual.
comet_ml.integration.gymnasium.CometLogger.step¶
step(action)
Steps through the environment using given action. Episode reward, length and step counter are tracked.
Args:
- action:
'ActType'
(required), an action provided by the agent to update the environment state.
comet_ml.integration.gymnasium.CometLogger.episode_counter¶
episode_counter()
Returns the number of episodes that have passed. Incremented when .reset()
is called
comet_ml.integration.gymnasium.CometLogger.step_counter¶
step_counter()
Returns the number of times .step()
has been called
comet_ml.integration.gymnasium.CometLogger.close¶
close()
Cleans up the environment after the user has finished using it.
If the original environment wrapped by this object was also wrapped by a RecordVideo
wrapper, this method will log the video files to Comet.
Jul. 9, 2024