Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is the continuous_a3c code valid? #20

Closed
Morphlng opened this issue Oct 13, 2022 · 4 comments
Closed

is the continuous_a3c code valid? #20

Morphlng opened this issue Oct 13, 2022 · 4 comments

Comments

@Morphlng
Copy link

I've tried the continuous_A3C.py, there exists some problems.

Problem

1. Incorrect dictionary update

env_config = DEFAULT_MULTIENV_CONFIG
config_update = update_scenarios_parameter(
json.load(open("macad_agents/a3c/env_config.json")))
env_config.update(config_update)

Use dict.update to update a dictionary will override pre-exists keys in the dict, such as:

(d1,d2) = ({"Country":{}},{"Country":{}})
d1['Country']['area'] = 960
d2['Country']['population'] = 14

d1.update(d2) # The 'area' key will be replaced by 'population'

This will cause the "fixed_delta_seconds" key to be lost, as a result macad-gym can't initialize.

2. Serialization Problem

class Worker(mp.Process):
def __init__(self, gnet, opt, global_ep, global_ep_r, res_queue, name):
super(Worker, self).__init__()
self.name = 'w%i' % name
self.g_ep, self.g_ep_r, self.res_queue = (global_ep, global_ep_r,
res_queue)
self.gnet, self.opt = gnet, opt
self.lnet = Net(N_S.spaces[vehicle_name],
N_A.spaces[vehicle_name]) # local network
self.env = MultiCarlaEnv(env_config)

Putting environment inside Net is not a good idea, when mp.Process serialize this object, it will try to serialize the environment as well, resulting in "can't pickle pygame.Font object" error.

Training

Even though I fixed those problems, it still doesn't seem to work. The "Mean Reward Curve" doesn't tend to go up (nor the distance curve to go down), and I haven't achieved one success episode yet (3M steps, maybe it's not enough to draw a conclusion?).

pic1

I know that PPO and IMPALA are the recommended algorithms, but since A3C is available in the repo, I want to know if it actually works.

@SExpert12
Copy link

Hi,
are you able to solve the problem in A3C algorithm?

@Morphlng
Copy link
Author

Hi, are you able to solve the problem in A3C algorithm?

No, the algorithm provided in this repo does not work out of the box. You can try to combine MACAD-Gym with MARLlib (or RLlib), we have successfully trained cooperative agent with MAPPO.

@SExpert12
Copy link

Okay. Thanks

@SExpert12
Copy link

Hi, @Morphlng
I have seen you have worked so much on this repo. I am using this repo for multi-agent training. I don't understand how to visualize the training process in carla simulator.
Can you please guide me regarding this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants