Comments (3)
I've run into the same problem and now I'm halfway through. It is possible to introduce a custom environment by doing the following steps:
-
You have to manually wrap your gym-like environment with
MultiAgentEnv
. You can refer to any other existing env under pathenvs/base_env/xxx.py
. Aside from the standardreset
,step
,close
method, you have to implement a method calledget_env_info
to return information like obs_space, action_space, etc. Also, the env class needs to include two memberself.num_agents
andself.agents
. A globalpolicy_mapping_dict
should also be created and exposed, this will affect how Ray manage all those policies. -
You have to define a default env config file under
envs/base_env/config
, it should be something like:env: your_env env_args: map_name: "default" # other options any_other_config_needed_by_your_env: ... mask_flag: True global_state_flag: True opp_action_in_cc: False
-
Register your env in
envs/base_env/__init__.py
:try: from envs.base_env.your_env import CustomEnv ENV_REGISTRY["your_env"] = CustomEnv except Exception as e: ENV_REGISTRY["your_env"] = str(e)
-
[Optional] You can customize algorithm configuration that fit your environment by putting it under
marl/algos/hyperparams/finetuned/your_env
-
Run your custom env by
python marl/main.py --algo_config=mappo [--finetuned] --env_config=your_env [with env_args.map_name=custom]
By doing these steps above, I've successfully registered a Carla Environment to MARLlib. However, I said I was halfway through because the training is no good. I can't find a document explaining the exact meaning of "state", "obs" in observation space, and all the other configurations. It would be great to have complete documentation about customization.
from marllib.
Guys, have a quick glance of our new api design and instance of customize new environments.
from marllib.
Thank you very much!
from marllib.
Related Issues (20)
- Unable to install globally using setup.py HOT 1
- Does this framework support asynchronous execution of the step function for different agents? HOT 1
- AircraftSimulator use of bloods?
- There is a bug in def central_value_function(self, state, opponent_actions=None) in cc_mlp.py and needs to be modified. HOT 1
- Configuration of custom environment HOT 2
- trainning stopped because of OOM HOT 3
- Marllib seems never uses gpu devices HOT 2
- cannot train ma-gym environment with IQL HOT 6
- TypeError in ray HOT 3
- Working with my own customized env HOT 3
- Help with questions about custom environments HOT 3
- AttributeError: 'MAPPOTrainer' object has no attribute '_local_ip' HOT 3
- Evaluating agents after training HOT 2
- Continue my Training process HOT 1
- Where is numpy.object_ from? HOT 3
- Can not save video HOT 3
- Backpropagation through time for PPO HOT 1
- The problems about Modify the network structure. HOT 2
- reslink in model
- Access Value Function After algo.Fit HOT 2
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 marllib.