Comments (10)
This may be a problem with the gym version.You try to change the gym version to 0.10.5 and see if it works.
from multiagent-particle-envs.
remove
from gym.spaces import prng
and replace
random_array = prng.np_random.rand(self.num_discrete_space)
with
random_array = np.random.RandomState().rand(self.num_discrete_space)
@christopherhesse
please close
from multiagent-particle-envs.
This repo should probably have the correct gym version required in https://github.com/openai/multiagent-particle-envs/blob/master/setup.py#L12 instead of just choosing the latest.
from multiagent-particle-envs.
@christopherhesse
thanks for quick reply
can u help me out with the following codeOBSERVATION SPACE IS GIVING ERROR
import numpy as np
import gymfrom keras.models import Sequential
from keras.layers import Dense, Activation, Flatten
from keras.optimizers import Adamfrom rl.agents.dqn import DQNAgent
from rl.policy import EpsGreedyQPolicy
from rl.memory import SequentialMemoryBuilding the environment
env = make_env('simple_adversary')
np.random.seed(0)
env.seed(0)Extracting the number of possible actions
num_actions = env.action_space[0].n # first agent actions changing this vaue will be another agent
print(num_actions)Layers
agent = Sequential()
print(env.observation_space[0].shape,type(env.observation_space[0]))
agent.add(Flatten(input_shape =(1, ) + (env.observation_space[0]).shape))
agent.add(Dense(16))
agent.add(Activation('relu'))
agent.add(Dense(num_actions))
agent.add(Activation('linear'))
agent.summary()Building model
strategy = EpsGreedyQPolicy()
memory = SequentialMemory(limit = 10000, window_length = 1)
dqn = DQNAgent(model = agent, nb_actions = num_actions,
memory = memory, nb_steps_warmup = 10, target_model_update = 1e-2, policy = strategy)
dqn.compile(Adam(lr = 1e-3), metrics =['mae'])Visualizing the training
dqn.fit(env, nb_steps = 5000, visualize = False, verbose = 2)
testing
dqn.test(env, nb_episodes = 5, visualize = False)
Please use the below for loading env
import multiagent.scenarios as scenarios
scenario = scenarios.load('simple_adversary.py').Scenario()
world = scenario.make_world()
env = MultiAgentEnv(world, scenario.reset_world, scenario.reward, scenario.observation, info_callback=None, shared_viewer = False)
Now, you can proceed with the code for adding neural networks.
Hope this helps
from multiagent-particle-envs.
From README of gym:
2019-02-06 (v0.11.0)
remove gym.spaces.np_random common PRNG; use per-instance PRNG instead.
from multiagent-particle-envs.
Have you solved it yet?
I'm also working on the same problem. My gym version is v0.14.0 , my python version is 3.6.x. Are those versions over high that will forbid running it ?
from multiagent-particle-envs.
Have you solved it yet?
I'm also working on the same problem. My gym version is v0.14.0 , my python version is 3.6.x. Are those versions over high that will forbid running it ?
i can run it with the gym version at 0.10.5.
from multiagent-particle-envs.
change to an old version (0.10.5) is ok, you'd better change like this #53
from multiagent-particle-envs.
@christopherhesse
thanks for quick reply
can u help me out with the following code
OBSERVATION SPACE IS GIVING ERROR
import numpy as np
import gym
from keras.models import Sequential
from keras.layers import Dense, Activation, Flatten
from keras.optimizers import Adam
from rl.agents.dqn import DQNAgent
from rl.policy import EpsGreedyQPolicy
from rl.memory import SequentialMemory
Building the environment
env = make_env('simple_adversary')
np.random.seed(0)
env.seed(0)
Extracting the number of possible actions
num_actions = env.action_space[0].n # first agent actions changing this vaue will be another agent
print(num_actions)
Layers
agent = Sequential()
print(env.observation_space[0].shape,type(env.observation_space[0]))
agent.add(Flatten(input_shape =(1, ) + (env.observation_space[0]).shape))
agent.add(Dense(16))
agent.add(Activation('relu'))
agent.add(Dense(num_actions))
agent.add(Activation('linear'))
agent.summary()
Building model
strategy = EpsGreedyQPolicy()
memory = SequentialMemory(limit = 10000, window_length = 1)
dqn = DQNAgent(model = agent, nb_actions = num_actions,
memory = memory, nb_steps_warmup = 10, target_model_update = 1e-2, policy = strategy)
dqn.compile(Adam(lr = 1e-3), metrics =['mae'])
Visualizing the training
dqn.fit(env, nb_steps = 5000, visualize = False, verbose = 2)
testing
dqn.test(env, nb_episodes = 5, visualize = False)
from multiagent-particle-envs.
Have you solved it yet?
I'm also working on the same problem. My gym version is v0.14.0 , my python version is 3.6.x. Are those versions over high that will forbid running it ?
I am using same versions gym==0.14.0 and python3.6. It is working fine for me.
from multiagent-particle-envs.
Related Issues (20)
- raise NotImplementedError
- FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Jarvis\\Desktop\\r-maac-main\\multiagent\\scenarios\\spread_collect.py'
- This code base is no longer maintained HOT 3
- the code about good_agents & adversaries at simple_tag.py
- What is the input form of the action in the‘simple_reference’? HOT 2
- If want to change the scenario from simple to other, how should I do? HOT 1
- Centralized learning-decentralized execution clarification (engineering perspective)
- how to restore the game process after so many times of episodes?
- Turn the environment into 3D HOT 2
- Questions about agent`s state information in MADDPG
- Running timeout!
- cant run different scenarios except simply.py HOT 1
- NN code
- Use the checkpoint file to continue training
- How to delete a landmark when training HOT 1
- Index error: list index out of range
- Questions about simple_spread agent actions
- Add image as background
- RuntimeWarning: invalid value encountered in logaddexp
- Wrong reward in simple speaker listener HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from multiagent-particle-envs.