Questions tagged [openai-gym]

OpenAI Gym is a platform for reinforcement learning research that aims to provide a general-intelligence benchmark with a wide variety of environments.

Filter by
Sorted by
Tagged with
0 votes
1 answer
30 views

How did `Open AI Gym` keep track of steps exceeding 500 in the CartPole environment?

I am looking at the CartPole environment over here and I don't see how the step function (or any other function) takes care to ensure the agent doesn't cross 500 steps - def step(self, action): ...
desert_ranger's user avatar
0 votes
0 answers
14 views

Custom Reinforcement Environment and Building Agent H

I'm trying to build a RL environment and an agent, and I'm having some difficulties to understand things. First of all, my problem is to fit 2 curves by some rules. I think I managed to create a ...
Metalel's user avatar
0 votes
0 answers
21 views

how do i fixed this reinforcement learning for luna lander game with TD3_BC

I want to use the replay buffer to save the training experience before the lunar_landing mission, but I am currently encountering this problem and I don’t know how to change it. The following is the ...
yangziyee's user avatar
0 votes
0 answers
29 views

(TypeError: tuple indices must be integers or slices, not tuple) Stable-baselines3 gym

Hi I am trying to make Trading Agent using an old YouTube video but when testing the Agent I get a TypeError. Building the Environment works state = env.reset() try: while True: action = ...
MP9909's user avatar
  • 1
0 votes
0 answers
11 views

Representing values in Observation and Action space for multiple objects

I'm just wondering how I'd set up the observation and action spaces for representing 5 people who can sit at 5 different tables. They start at the first table and I want them to learn how to find ...
Christian's user avatar
0 votes
1 answer
33 views

Render() doesn't work for gym environment

I hope you're doing well. I'm working on a reinforcement learning project for the Breakout game, and my environment (env) is set to ALE/Breakout-v5. I've previously trained a model, saved it, and now ...
Gamigj's user avatar
  • 13
0 votes
0 answers
8 views

How to downgrade Mujoco version?

I installed mujoco using pip install gymnasium[mujoco], how can i downgrade it to mujoco==2.3.0? I tried to uninstall it then pip install gymnasium[mujoco]==2.3.0 but it seems to have some error in ...
A Random Guy's user avatar
0 votes
0 answers
35 views

get a video/gif from gym environment

I hope you're doing well. I'm currently working on writing a code using Python and reinforcement learning to play the Breakout game in the Atari environment. The environment I'm using is Gym, and I've ...
Reza Ghiasvand Mohammadkhani's user avatar
0 votes
0 answers
14 views

IndexError while making predictions with model.predict using PPO and custom OpenAI Gym

I created a custom OpenAI Gym environment that has the following observation_space: self.observation_space = spaces.Dict({ 'msecFromStart': spaces.Box(low=1, high=np.inf, shape=(1,), dtype=np....
william_dev's user avatar
0 votes
0 answers
19 views

Gymnasium environment consisting of multiple environments

I'm using reinforcement learning to train an agent to estimate the stepsize in gradient descent. I want to train the agent on different objective functions of the form x'Qx. I'm currently using the ...
CodeGuy's user avatar
  • 19
1 vote
0 answers
37 views

When the action is to move right in CartPole, it moves to the left side. Why it is like that? How can this be resolved?

In my experiments, I'm using OpenAI's CartPole-v1 environment. I need to set a state and then perform an action on that state. When I perform a specific action, it does not behave as expected. For ...
Möbius's user avatar
  • 27
-1 votes
1 answer
26 views

PPO Boid agent not learning

I have a custom Boid flocking environment in OpenAI Gym using PPO from StableBaselines3. I wanted it to achieve flocking similar to Reynold's model (Video) or close enough, but it ISN'T learning. ...
Hamza's user avatar
  • 1
0 votes
1 answer
29 views

n_state, reward, done, info = env.step(action) returns value error

episodes = 10 for episode in range(1, episodes+1): state = env.reset() done = False score = 0 while not done: env.render() action = random.choice([0,1]) ...
RFM's user avatar
  • 11
0 votes
1 answer
296 views

'mujoco._structs.MjData' object has no attribute 'solver_iter'

I'm following this tutorial from Jonny Codes and copied it exactly as shown: https://www.youtube.com/watch?v=OqvXHi_QtT0 My code is : import gymnasium as gym from stable_baselines3 import SAC, TD3, ...
Elijah Kurien's user avatar
0 votes
0 answers
18 views

Import error Testing code Open AI Gym Custom Environment

I have made a Open AI Gym Custom Environment for flocking Boids implementing PPO from StableBaselines3. Training Code: https://github.com/Hamza-101/Flocking-RL/blob/main/TempSolution.py Testing Code: ...
Hamza's user avatar
  • 1
0 votes
0 answers
27 views

Recording of multiple Breakout games from a Gymnasium Vectorized Environment

I want to record the interaction with a vectorized environment of two games of Atari's Breakout using Gymnasium. Unfortunately, when executed, my code only records the last game of the vector during ...
Sebastian Dine's user avatar
-1 votes
0 answers
15 views

CNN erorr input shape

I use framestack for 4 for images. And I want them to be input for the CNN. ... nv = AtariPreprocessing(env, frame_skip=1, grayscale_obs=True) env = ResizeObservation(env, shape=84) env = FrameStack(...
EpicaSjH's user avatar
0 votes
0 answers
32 views

Can someone help me to understand, why this code does not converge?

I'm studying RL from the following book, which is very well written but the code written along the book does not work as expected. In my case I'm trying to implement an Actor-Critic RL algorithm to &...
Dave's user avatar
  • 349
-2 votes
0 answers
21 views

issue in installing go-vncdriver

ERROR: Command errored out with exit status 1: command: /home/home/anaconda3/envs/universe/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-...
Dr.Ej's user avatar
  • 41
0 votes
1 answer
48 views

NaN value tensor, custom open ai gym environment

I am developing a custom environment for Boid (https://en.wikipedia.org/wiki/Boids)) flocking, and using PPO from StableBaselines3. Initial boid positions are read from a JSON format file Action ...
Hamza's user avatar
  • 1
-1 votes
1 answer
76 views

Issue with Multi-Agent Environment Observation Space in RLlib

I'm working on a multi-agent environment with two agents (nodes), where each agent has to decide whether to transmit or not based on their observations of their own capacity and the capacity of the ...
Laura's user avatar
  • 1
1 vote
0 answers
57 views

Why can't my custom OpenAI gym environment be found?

I am trying to create my custom gym environment. To do that, I took the following steps - I went over the documentation given over here. I cloned this repository. In the folder gym-examples/gym-...
desert_ranger's user avatar
0 votes
0 answers
23 views

I'm trying to use gym_super_mario_bros and it's giving me this error: ValueError: not enough values to unpack (expected 5, got 4)

I'm trying to use gym_super_mario_bros and I'm still in the first steps of the code in python but I don't understand why is it giving me this error ValueError: not enough values to unpack (expected 5, ...
Abdallah ehab's user avatar
0 votes
1 answer
60 views

Open AI Gym: Ant not rendering

I have been unable to render the ant using the OpenAI gym framework. Here is my code: import gymnasium as gym env = gym.make("Ant-v4") # Reset the environment to start a new episode ...
Rebecca Ansell's user avatar
0 votes
1 answer
40 views

Rendering example for deep learning

I am trying to get the window to render showing me the game running but it never pops up and just finishes running printing out the 5 scores. I am not sure if there is a problem in vs code (I m ...
logan1111111's user avatar
0 votes
0 answers
40 views

Unable to Use Monitor Wrapper with Atari Environments in Stable Baselines 3

I've been using stable_baselines3 for recently and successfully applied the Monitor wrapper for the classic control problems, like so: from stable_baselines3.common.monitor import Monitor env = gym....
Gribesh Dhakal's user avatar
0 votes
0 answers
37 views

Difficulty with Stablebaselines VecFrameStack function for observation space pre-processing

I am very new to reinforcement learning. I have been following a couple of tutorials but have hit a snag which I cannot resolve a couple of hours in. I have: Imported the game and set-up the ...
Henry Bergman's user avatar
0 votes
0 answers
66 views

Unable to see SuperMarioBros env being rendered on the screen

I am following this [Reinforcement Learning] (https://www.youtube.com/watch?v=2eeYqJ0uBKE) tutorial and facing a very odd issue; In the last section of the tutorial, when the env is being rendered ...
Abhishek Rathore's user avatar
0 votes
0 answers
10 views

How to create a Discrete space with actions as 1 and 3 and skip some in between?

I am trying to create a subset of the action space. I want it to have actions 1 and 3. How do I do it with Discrete space? I want something like: gym.spaces.Discrete(2, start=1, skip=1)
Prabhjot Singh Rai's user avatar
0 votes
1 answer
129 views

Deep Reinforcement Learning on Raspberry Pi

I am trying to run a deep reinforcement problem on a Raspberry Pi 4. The code successfully runs on Colab but shows the following error on my Pi. /home/pi/.local/lib/python3.9/site-packages/...
Sk D's user avatar
  • 1
0 votes
0 answers
23 views

Can reinforcement learning models learn to rank?

I have a very simple observation: a list of random value state = [random.uniform(-0.2, 0.2) for _ in range(200)] reward = state * actions The reward is not using the next state, it's using the ...
Min's user avatar
  • 1
0 votes
0 answers
22 views

How to extract separated observation spaces from Vectorized Environments in gymnasium

How can we separate observation space of multiple environment returned by env.reset or env.step functions for Vectorized Environments? Or is there a way to get individual environment from Vectorized ...
user150518's user avatar
0 votes
0 answers
47 views

Gymnasium. Actions in continuous spaces

I am introduced to Gymnasium (gym) and RL and there is a point that I do not understand, relative to how gym manages actions. I've read that actions in a gym environment are integer numbers, meaning ...
user12717490's user avatar
0 votes
0 answers
14 views

SyntaxError in CartPole Game when importing Keras and TensorFlow in Python 3.11.6

import gym import numpy as np from keras.models import Sequential from keras.layers import Dense from keras.optimizers import Adam # Create the CartPole environment env = gym.make('CartPole-v1') # ...
CodeCracker's user avatar
0 votes
0 answers
45 views

Why does my installation of box2d fail even though I already have swig installed

Requirement already satisfied: gymnasium[box2d] in c:\python\lib\site-packages (0.29.1) Requirement already satisfied: numpy>=1.21.0 in c:\python\lib\site-packages (from gymnasium[box2d]) (1.25.1) ...
Tommy Zhao's user avatar
0 votes
1 answer
54 views

Error running code taking from Gymnasium tutorial

I would like to run the following code using PyCharm IDE import gymnasium as gym env = gym.make("LunarLander-v2", render_mode="human") observation, info = env.reset(seed=42) for _ ...
Encipher's user avatar
  • 1,384
0 votes
0 answers
22 views

ValueError: Setting an array element with a sequence in Python OpenAI Gym

I'm working on implementing a Q-learning algorithm using OpenAI Gym's MountainCar-v0 environment. However, I'm encountering the following error: discrete_state = (state - env.observation_space.low) / ...
Julian_Morrow's user avatar
0 votes
1 answer
231 views

Mujoco environment to gymnasium environment

The problem I am facing is that when I am training my agent using PPO, the environment doesn't render using Pygame, but when I manually step through the environment using random actions, the rendering ...
James123's user avatar
0 votes
0 answers
73 views

How to modify the MuJoCo environment (InvertedPendulum)?

I am working on a project that involves modifying Mujoco environments for reinforcement learning. I want to create a new environment that is similar to the InvertedPendulum environment, but with a ...
Charles Sosmeña's user avatar
0 votes
0 answers
24 views

My NEAT algorithm crashes while training model

I am trying to build the NEAT agent for gym super mario bros project but it keep crashing after like a minute after I start training model. For NEAT, I have 4 inputs of mario_x, mario_y, object_x, and ...
Edward Le's user avatar
0 votes
0 answers
15 views

Max retries exceeded with url Selenium webdriver When integrating Gym and stable-baselines

I am using Selenium Webdriver using python in orther to do several actions over a web page using a RL model. I have successfully trained the said model, but when trying to actually used the already ...
pepito's user avatar
  • 463
1 vote
1 answer
611 views

pip: 'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers

I tried running pip install gym==0.21.0 but got the cryptic error: Collecting gym==0.21.0 Using cached gym-0.21.0.tar.gz (1.5 MB) Preparing metadata (setup.py) ... error error: subprocess-exited-...
user118967's user avatar
  • 5,053
0 votes
0 answers
34 views

OpenAI Gymnasium vectorized approach works slower than non-vectorized

I'm getting started with OpenAI Gymnasium. My task is to speed-up trajectory generation. So to create N trajectories, I want to use a single parallel multi-env instead of running the same env N times ...
Ilya Fedorov's user avatar
0 votes
0 answers
35 views

Error when converting CartPole Numpy arrays for PyTorch Tensors

Reposting this since I think my previous post rambled and did not get to the point right away. I am studying Deep Q-Learning algorithms and I am following along with a Udemy instructor who is showing ...
CMBel's user avatar
  • 7
0 votes
0 answers
32 views

Atari Game OpenAI Gym - VS studio crashes when closing the env (ie: env.close() )

I am trying to set up the Atari game environment and it's been a few hours that I am trying to understand why my render won't close after calling env.close(). When I call env.close(), the render ...
Alexandre's user avatar
0 votes
0 answers
26 views

Implementing DFS in Open AI taxi env

I am new to the Open AI Gym environment and I want to implement Depth First Search to solve the taxi puzzle and I am having trouble getting the search working. I dont understand how I can get the ...
Abhijeet Singh's user avatar
0 votes
1 answer
409 views

JoypadSpace.reset() modification to solve "unexpected keyword argument 'seed'" leads to error: "too many values to unpack (expected 2)"

I'm getting the same error as described here: TypeError: JoypadSpace.reset() got an unexpected keyword argument 'seed', when I run the following code, what should I do to fix this? . In the ...
Gustavo Mirapalheta's user avatar
0 votes
1 answer
97 views

Stop Stable baselines learn method when execution is terminated

I am using the satble-baselines3's "learn" method to train a model. The thing is that the rewards in my agent are negative and I want the agent to have the urge of stoping as soon as ...
Makt's user avatar
  • 1
0 votes
1 answer
244 views

How to record and save video of Gym environment

I have trained a DQN agent and I want to record and save a video of a single episode using gym.wrappers.RecordVideo. Here's my code so far: from gym.wrappers import RecordVideo env = gym.make("...
Eva K.'s user avatar
  • 187
0 votes
0 answers
19 views

keras-gym library has assertion issue

I have posted already two question about frameworks for reinforcement learning and did not get an answer. This indicates two things: either on this website there are few people who knows materials ...
data science's user avatar

1
2 3 4 5
22