Skip to content

Commit 2047596

Browse files
younikmalfet
andauthored
update rl tutorial to last gym version (#2073)
* update rl tutorial to last gym version * Make it compatible with 0.26 and 0.25 gym versions Co-authored-by: Nikita Shulga <[email protected]>
1 parent bb6024e commit 2047596

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

intermediate_source/reinforcement_q_learning.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@
7979
import torchvision.transforms as T
8080

8181

82-
env = gym.make('CartPole-v0', new_step_api=True, render_mode='single_rgb_array').unwrapped
82+
if gym.__version__ < '0.26':
83+
env = gym.make('CartPole-v0', new_step_api=True, render_mode='single_rgb_array').unwrapped
84+
else:
85+
env = gym.make('CartPole-v0', render_mode='rgb_array').unwrapped
8386

8487
# set up matplotlib
8588
is_ipython = 'inline' in matplotlib.get_backend()

0 commit comments

Comments
 (0)