Skip to content

TypeError: __init__() got an unexpected keyword argument 'new_step_api' #2077

Open
@ddharshan

Description

@ddharshan

Hi
when i run the following Pytorch code in Jupyter notebook, i am getting the error as TypeError: init() got an unexpected keyword argument 'new_step_api'

Could you please help me on finding the solution for this problem ?

import gym
import math
import random
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from collections import namedtuple, deque
from itertools import count
from PIL import Image

import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torchvision.transforms as T

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()
if is_ipython:
from IPython import display

plt.ion()

if gpu is to be used

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

cc @vmoens @nairbv

Metadata

Metadata

Assignees

No one assigned

    Labels

    Reinforcement LearningIssues relating to reinforcement learning tutorialsrlIssues related to reinforcement learning tutorial, DQN, and so on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions