Skip to content

Commit a211250

Browse files
committed
Add block for installing gym with pygame
1 parent 258befd commit a211250

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

intermediate_source/reinforcement_q_learning.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
77
88
This tutorial shows how to use PyTorch to train a Deep Q Learning (DQN) agent
9-
on the CartPole-v1 task from the `OpenAI Gym <https://www.gymlibrary.dev/>`__.
9+
on the CartPole-v0 task from the `OpenAI Gym <https://www.gymlibrary.dev/>`__.
1010
1111
**Task**
1212
@@ -46,7 +46,12 @@
4646
4747
First, let's import needed packages. Firstly, we need
4848
`gym <https://github.com/openai/gym>`__ for the environment
49-
(Install using `pip install gym`).
49+
50+
.. code-block:: bash
51+
52+
%%bash
53+
pip3 install gym[classic_control]
54+
5055
We'll also use the following from PyTorch:
5156
5257
- neural networks (``torch.nn``)
@@ -74,7 +79,7 @@
7479
import torchvision.transforms as T
7580

7681

77-
env = gym.make('CartPole-v1', new_step_api=True, render_mode='single_rgb_array').unwrapped
82+
env = gym.make('CartPole-v0', new_step_api=True, render_mode='single_rgb_array').unwrapped
7883

7984
# set up matplotlib
8085
is_ipython = 'inline' in matplotlib.get_backend()

0 commit comments

Comments
 (0)