Skip to content

Commit

Permalink
Update agents colab to work with latest Dopamine version.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 692944575
  • Loading branch information
psc-g committed Nov 4, 2024
1 parent d6a6fb0 commit bec5f4e
Showing 1 changed file with 9 additions and 19 deletions.
28 changes: 9 additions & 19 deletions dopamine/colab/agents.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
"source": [
"# @title Install necessary packages.\n",
"!pip install -U dopamine-rl\n",
"!pip install pandas==0.24.2 # Needed to be able to load the pickle files.\n",
"!pip install --upgrade gym\n",
"!pip install gym[atari,accept-rom-license]"
"!pip install -U gymnasium\n",
"!pip install -U baselines\n",
"!pip install -U ale_py\n"
]
},
{
Expand All @@ -77,20 +77,6 @@
"GAME = 'Asterix' # @param"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"id": "EFY3tTITHugq"
},
"outputs": [],
"source": [
"# @title Load baseline data\n",
"!gsutil -q -m cp -R gs://download-dopamine-rl/preprocessed-benchmarks/* /content/\n",
"experimental_data = colab_utils.load_baselines('/content')"
]
},
{
"cell_type": "markdown",
"metadata": {
Expand Down Expand Up @@ -140,6 +126,8 @@
"run_experiment.Runner.num_iterations = 200\n",
"run_experiment.Runner.training_steps = 10\n",
"run_experiment.Runner.max_steps_per_episode = 100\n",
"ReplayBuffer.max_capacity = 1_000\n",
"ReplayBuffer.batch_size = 32\n",
"\"\"\".format(GAME)\n",
"gin.parse_config(random_dqn_config, skip_unknown=False)\n",
"\n",
Expand Down Expand Up @@ -178,8 +166,7 @@
" LOG_PATH, verbose=True, summary_keys=['train_episode_returns'])\n",
"random_dqn_data['agent'] = 'MyRandomDQN'\n",
"random_dqn_data['run_number'] = 1\n",
"experimental_data[GAME] = experimental_data[GAME].merge(random_dqn_data,\n",
" how='outer')"
"experimental_data = {GAME: random_dqn_data}\n"
]
},
{
Expand Down Expand Up @@ -234,6 +221,7 @@
" actions with probability switch_prob.\"\"\"\n",
" def __init__(self, sess, num_actions, switch_prob=0.1):\n",
" self._sess = sess\n",
" self.summary_writer = None\n",
" self._num_actions = num_actions\n",
" self._switch_prob = switch_prob\n",
" self._last_action = np.random.randint(num_actions)\n",
Expand Down Expand Up @@ -273,6 +261,8 @@
"run_experiment.Runner.num_iterations = 200\n",
"run_experiment.Runner.training_steps = 10\n",
"run_experiment.Runner.max_steps_per_episode = 100\n",
"ReplayBuffer.max_capacity = 1_000\n",
"ReplayBuffer.batch_size = 32\n",
"\"\"\".format(GAME)\n",
"gin.parse_config(sticky_config, skip_unknown=False)\n",
"\n",
Expand Down

0 comments on commit bec5f4e

Please sign in to comment.