Skip to content
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] Docs do-over (new API stack): New MetricsLogger API rst page. #49538

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
wip
Signed-off-by: sven1977 <svenmika1977@gmail.com>
  • Loading branch information
sven1977 committed Jan 2, 2025
commit 5598bba9ced12c51ce2b9e0b2545b78678afd8dd
16 changes: 16 additions & 0 deletions rllib/examples/algorithms/classes/vpg.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,22 @@ def training_step(self) -> None:
# Merge results from n parallel sample calls into self's metrics logger.
self.metrics.merge_and_log_n_dicts(env_runner_results, key=ENV_RUNNER_RESULTS)

# Just for demonstration purposes, log the number of time steps sampled in this
# `training_step` round.
# Mean over a window of 100:
self.metrics.log_value(
"episode_timesteps_sampled_mean_win100",
sum(map(len, episodes)),
reduce="mean",
window=100,
)
# Exponential Moving Average (EMA) with coeff=0.1:
self.metrics.log_value(
"episode_timesteps_sampled_ema",
sum(map(len, episodes)),
ema_coeff=0.1, # <- weight of new value; weight of old avg=1.0-ema_coeff
)

# Update model.
with self.metrics.log_time((TIMERS, LEARNER_UPDATE_TIMER)):
learner_results = self.learner_group.update_from_episodes(
Expand Down
Loading