From 6f4345a8a79ec84151f803e700eb82d8f2a35a57 Mon Sep 17 00:00:00 2001 From: Nikita Shulga Date: Wed, 5 Oct 2022 09:37:24 -0700 Subject: [PATCH 1/4] Re-enable reinforced_q_learnings tutorial Lets see if it will pass CI --- .jenkins/validate_tutorials_built.py | 1 - 1 file changed, 1 deletion(-) diff --git a/.jenkins/validate_tutorials_built.py b/.jenkins/validate_tutorials_built.py index ef4b41a6bcc..bf42e0845ff 100644 --- a/.jenkins/validate_tutorials_built.py +++ b/.jenkins/validate_tutorials_built.py @@ -24,7 +24,6 @@ "examples_autograd/polynomial_custom_function", "forward_ad_usage", "parametrizations", - "reinforcement_q_learning", "mnist_train_nas", # used by ax_multiobjective_nas_tutorial.py "fx_conv_bn_fuser", "super_resolution_with_onnxruntime", From ed5b87ba791ba072fec88865b4763a31ae0e5f34 Mon Sep 17 00:00:00 2001 From: Nikita Shulga Date: Wed, 5 Oct 2022 09:40:36 -0700 Subject: [PATCH 2/4] Update requirements.txt --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 1e70f8c4268..94cbf27274a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -46,3 +46,4 @@ wget gym==0.24.0 gym-super-mario-bros==7.3.0 timm +pygame==2.1.2 From 258befdfaa70238f86383b922da11ead8a0de1d2 Mon Sep 17 00:00:00 2001 From: Nikita Shulga Date: Wed, 5 Oct 2022 10:07:03 -0700 Subject: [PATCH 3/4] More updates --- intermediate_source/reinforcement_q_learning.py | 4 ++-- requirements.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/intermediate_source/reinforcement_q_learning.py b/intermediate_source/reinforcement_q_learning.py index cb9abc229c9..b32c6c9746f 100644 --- a/intermediate_source/reinforcement_q_learning.py +++ b/intermediate_source/reinforcement_q_learning.py @@ -6,7 +6,7 @@ This tutorial shows how to use PyTorch to train a Deep Q Learning (DQN) agent -on the CartPole-v0 task from the `OpenAI Gym `__. +on the CartPole-v1 task from the `OpenAI Gym `__. **Task** @@ -74,7 +74,7 @@ import torchvision.transforms as T -env = gym.make('CartPole-v0', new_step_api=True, render_mode='single_rgb_array').unwrapped +env = gym.make('CartPole-v1', new_step_api=True, render_mode='single_rgb_array').unwrapped # set up matplotlib is_ipython = 'inline' in matplotlib.get_backend() diff --git a/requirements.txt b/requirements.txt index 94cbf27274a..74e2da5fad3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -43,7 +43,7 @@ scikit-image scipy pillow==9.0.1 wget -gym==0.24.0 -gym-super-mario-bros==7.3.0 +gym==0.25.1 +gym-super-mario-bros==7.4.0 timm pygame==2.1.2 From a2112504f339c858e8977791705daa14886c9270 Mon Sep 17 00:00:00 2001 From: Nikita Shulga Date: Wed, 5 Oct 2022 10:52:27 -0700 Subject: [PATCH 4/4] Add block for installing gym with pygame --- intermediate_source/reinforcement_q_learning.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/intermediate_source/reinforcement_q_learning.py b/intermediate_source/reinforcement_q_learning.py index b32c6c9746f..6a03d61f79e 100644 --- a/intermediate_source/reinforcement_q_learning.py +++ b/intermediate_source/reinforcement_q_learning.py @@ -6,7 +6,7 @@ This tutorial shows how to use PyTorch to train a Deep Q Learning (DQN) agent -on the CartPole-v1 task from the `OpenAI Gym `__. +on the CartPole-v0 task from the `OpenAI Gym `__. **Task** @@ -46,7 +46,12 @@ First, let's import needed packages. Firstly, we need `gym `__ for the environment -(Install using `pip install gym`). + +.. code-block:: bash + + %%bash + pip3 install gym[classic_control] + We'll also use the following from PyTorch: - neural networks (``torch.nn``) @@ -74,7 +79,7 @@ import torchvision.transforms as T -env = gym.make('CartPole-v1', new_step_api=True, render_mode='single_rgb_array').unwrapped +env = gym.make('CartPole-v0', new_step_api=True, render_mode='single_rgb_array').unwrapped # set up matplotlib is_ipython = 'inline' in matplotlib.get_backend()