#Error on Cart Pole project V1
1 messages · Page 1 of 1 (latest)
Heyy, could you please give a minimal snippet of code to run and have this issue occur?
Hello there here's the full code:
env = gym.make("CartPole-v1", render_mode="human")
states = env.observation_space.shape[0]
actions = env.action_space.n
episodes = 10
for episode in range(1, episodes+1):
states = env.reset()
done = False
score = 0
while not done:
env.render()
action = random.choice([0, 1])
n_state, reward, done, info, _ = env.step(action)
score+=reward
print("Episode:{} Score:{}".format(episode,score))
def build_model(states, actions):
model = Sequential()
model.add(Flatten(input_shape=(states,)))
model.add(Dense(24, activation="relu"))
model.add(Dense(24, activation="relu"))
model.add(Dense(actions, activation="linear"))
return model
model = build_model(states, actions)
Here when I run the model, it prints out that specific error
Heyy, are you sure this is related to the openai api?
oh sorry my bad if it's not related, because I thought the gym documentation has some correlation with openai
Of yourse it is, just this channel is generally for help witht he openai api. I think you will finde more help opening an issue in the gymnasium github repo
Okay, thank you, I understand. And sorry again for the inconvenience that I perhaps may cause, have a good one!