openai-gym

How can I register a custom environment in OpenAI's gym?

。_饼干妹妹 提交于 2019-12-18 17:53:06
问题 I have created a custom environment, as per the OpenAI Gym framework; containing step , reset , action , and reward functions. I aim to run OpenAI baselines on this custom environment. But prior to this, the environment has to be registered on OpenAI gym. I would like to know how the custom environment could be registered on OpenAI gym? Also, Should I be modifying the OpenAI baseline codes to incorporate this? 回答1: You do not need to modify baselines repo. Here is a minimal example. Say you

How to create a new gym environment in OpenAI?

不问归期 提交于 2019-12-17 08:02:46
问题 I have an assignment to make an AI Agent that will learn play a video game using ML. I want to create a new environment using OpenAI Gym because I don't want to use an existing environment. How can I create a new, custom, Environment? Also, is there any other way that I can start to develop making AI Agent to play an specific video game without the help of OpenAI Gym? 回答1: See my banana-gym for an extremely small environment. Create new environments See the main page of the repository: https:

Cartpole-v0 loss increasing using DQN

拈花ヽ惹草 提交于 2019-12-13 03:47:44
问题 Hi I'm trying to train a DQN to solve gym's Cartpole problem. For some reason the Loss looks like this (orange line). Can y'all take a look at my code and help with this? I've played around with the hyperparameters a decent bit so I don't think they're the issue here. class DQN(nn.Module): def __init__(self, input_dim, output_dim): super(DQN, self).__init__() self.linear1 = nn.Linear(input_dim, 16) self.linear2 = nn.Linear(16, 32) self.linear3 = nn.Linear(32, 32) self.linear4 = nn.Linear(32,

AttributeError: 'Timer' object has no attribute '_seed'

强颜欢笑 提交于 2019-12-11 15:18:41
问题 This is the code I used. I found this code on https://github.com/openai/universe#breaking-down-the-example . As I'm getting error on remote manager so I have to copy this code to run it. But it still giving me error as below import gym import universe # register the universe environments env = gym.make('flashgames.DuskDrive-v0') env.configure(remotes=1) # automatically creates a local docker container observation_n = env.reset() while True: action_n = [[('KeyEvent', 'ArrowUp', True)] for ob

OSerror [Winerror 126] the specified module could not be found

假装没事ソ 提交于 2019-12-11 08:55:57
问题 I am doing reinforcement learning. Running the Atari example causes an OSerror. I use Win 10 and tensorflow 1.3, keras 2.2.2 import gym import numpy as np from keras.models import Sequential from keras.layers import Dense, Reshape, Flatten from keras.optimizers import Adam from keras.layers.convolutional import Convolution2D File "C:\Users\Lim\Anaconda3\lib\ctypes\__init__.py", line 348, in __init__ self._handle = _dlopen(self._name, mode) Why is this a problem? Where is the problem? OSerror

Why does OpenAI Gym Atari give a wrong observation while rendering?

Deadly 提交于 2019-12-11 06:34:17
问题 Screenshot This is what env.render() outputs on the screen, the environment is SpaceInvader-v0. Am I doing something wrong here? My code is literally right off the OpenAI Gym website, only changed the environment. 回答1: Your gym and atari_py versions are incompatible ( atari_py >= 0.1.1 requires gym >= 0.9.5 ). The openai devs introduced getScreenRGB2 API call and changed gym to use it after my call that getScreenRGB is actually returns data not in RGB but in BGRX format and latter channel

openai gym env.P, AttributeError 'TimeLimit' object has no attribute 'P'

我只是一个虾纸丫 提交于 2019-12-11 03:25:57
问题 I'm currently reading Hands-On Reinforcement Learning with Python by Sudharsan Ravichandiran and on one of the first examples I run into this AttributeError: AttributeError 'TimeLimit' object has no attribute 'P' raised by the following line: for next_sr in env.P[state][action]: I can't find any documentation regarding env.P , but I found a similar example written in python2 here: https://gym.openai.com/evaluations/eval_48sirBRSRAapMjotYzjb6w/ I suppose env.P is part of an outdated library

OpenAI baselines: Why simultaneously use `tf.stop_gradient` and specify `var_list`?

天大地大妈咪最大 提交于 2019-12-11 02:51:00
问题 In OpenAI baselines code on DQN, tf.stop_gradient is used on the q values of the target network during building the operation graph to prevent the contributions of the target q values to the minimization of the loss. (line 213) However, when calling minimize , the var_list is specified as only the tf.Variable with scope that falls under the q network being optimized, excluding the variables with scope under the target q network. (line 223) I'm not sure why they do both. The two approaches

pip install -e successful, import fails: ModuleNotFoundError

北城以北 提交于 2019-12-11 02:35:13
问题 I'm trying to install a module I'm developing. When I use 'pip install -e .', it outputs 'Successfully installed gym-mabifish' but when I try to import the module using 'import gym_mabifish' I'm getting 'ModuleNotFoundError: No module named "gym_mabifish"'. Here's the structure of the package: gym-mabifish/ setup.py ( https://pastebin.com/1wNykyKw ) gym_mabifish/ __init__.py ( https://pastebin.com/GtQid3Nk ) envs/ __init__.py ( https://pastebin.com/Txfk0ezE ) mabifish_env.py ( https:/

How to render OpenAI gym in google Colab?

给你一囗甜甜゛ 提交于 2019-12-09 10:58:58
问题 I'm trying to use OpenAI gym in google colab. As the Notebook is running on a remote server I can not render gym's environment. I found some solution for Jupyter notebook, however, these solutions do not work with colab as I don't have access to the remote server. I wonder if someone knows a workaround for this that works with google Colab? 回答1: Korakot's answer is not correct. You can indeed render OpenAi Gym in colaboratory, albiet kind of slowly using none other than matplotlib. Heres how: