Skip to content

Commit

Permalink
Setting the same value for num_iterations in .gin config files. This …
Browse files Browse the repository at this point in the history
…for Atari 100k. Adding support for flatboard on Atari_100k agents and BBF repository. Fixing the requirements.txt file for BBF repository.

PiperOrigin-RevId: 560035815
  • Loading branch information
Johan Obando Ceron authored and psc-g committed Nov 27, 2023
1 parent 016f4b3 commit f4c793d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 6 deletions.
27 changes: 27 additions & 0 deletions dopamine/labs/atari_100k/atari_100k_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
from dopamine.discrete_domains import iteration_statistics
from dopamine.discrete_domains import run_experiment
from dopamine.labs.atari_100k import normalization_utils
from dopamine.metrics import collector_dispatcher
from dopamine.metrics import statistics_instance

import gin
import jax
import numpy as np
Expand Down Expand Up @@ -101,6 +104,13 @@ def __init__(
self._agent.cache_train_state()

self.log_normalized_scores = log_normalized_scores
# Create a collector dispatcher for metrics reporting.
self._collector_dispatcher = collector_dispatcher.CollectorDispatcher(
self._base_dir)
set_collector_dispatcher_fn = getattr(
self._agent, 'set_collector_dispatcher', None)
if callable(set_collector_dispatcher_fn):
set_collector_dispatcher_fn(self._collector_dispatcher)

def _run_one_phase(self,
envs,
Expand Down Expand Up @@ -455,6 +465,23 @@ def _run_one_iteration(self, iteration):
num_episodes_eval, average_reward_eval, norm_score_eval = (
self._run_eval_phase(statistics)
)
self._collector_dispatcher.write([
statistics_instance.StatisticsInstance(
'Train/NumEpisodes', num_episodes_train, iteration
),
statistics_instance.StatisticsInstance(
'Train/AverageReturns', average_reward_train, iteration
),
statistics_instance.StatisticsInstance(
'Train/AverageStepsPerSecond', average_steps_per_second, iteration
),
statistics_instance.StatisticsInstance(
'Eval/NumEpisodes', num_episodes_eval, iteration
),
statistics_instance.StatisticsInstance(
'Eval/AverageReturns', average_reward_eval, iteration
),
])
self._save_tensorboard_summaries(
iteration,
num_episodes_train,
Expand Down
4 changes: 2 additions & 2 deletions dopamine/labs/atari_100k/configs/DrQ.gin
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ atari_lib.create_atari_environment.game_name = 'Pong'
# Atari 100K benchmark doesn't use sticky actions.
atari_lib.create_atari_environment.sticky_actions = False
AtariPreprocessing.terminal_on_life_loss = True
Runner.num_iterations = 1
Runner.training_steps = 100000 # agent steps
Runner.num_iterations = 10
Runner.training_steps = 10000 # agent steps
MaxEpisodeEvalRunner.num_eval_episodes = 100 # agent episodes
Runner.max_steps_per_episode = 27000 # agent steps

Expand Down
4 changes: 2 additions & 2 deletions dopamine/labs/atari_100k/configs/DrQ_eps.gin
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ atari_lib.create_atari_environment.game_name = 'Pong'
# Atari 100K benchmark doesn't use sticky actions.
atari_lib.create_atari_environment.sticky_actions = False
AtariPreprocessing.terminal_on_life_loss = True
Runner.num_iterations = 1
Runner.training_steps = 100000 # agent steps
Runner.num_iterations = 10
Runner.training_steps = 10000 # agent steps
MaxEpisodeEvalRunner.num_eval_episodes = 100 # agent episodes
Runner.max_steps_per_episode = 27000 # agent steps

Expand Down
4 changes: 2 additions & 2 deletions dopamine/labs/atari_100k/configs/OTRainbow.gin
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ atari_lib.create_atari_environment.game_name = 'Pong'
# Atari 100K benchmark doesn't use sticky actions.
atari_lib.create_atari_environment.sticky_actions = False
AtariPreprocessing.terminal_on_life_loss = True
Runner.num_iterations = 1
Runner.training_steps = 100000 # agent steps
Runner.num_iterations = 10
Runner.training_steps = 10000 # agent steps
MaxEpisodeEvalRunner.num_eval_episodes = 100 # agent episodes
Runner.max_steps_per_episode = 27000 # agent steps

Expand Down

0 comments on commit f4c793d

Please sign in to comment.