angelomorgado / CARLA-GymDrive

Autonomous driving episode generation for the Carla simulator in a gym environment. This framework makes it easy to create driving scenarios to train/test the agent.
MIT License
15 stars 5 forks source link

Error! When Run train_agent_stablebaselines3.py and train_dqn_agent.py #2

Closed song-hl closed 4 months ago

song-hl commented 4 months ago

when I run train_agent_stablebaselines3.py, first raise this error RuntimeError: mat1 and mat2 shapes cannot be multiplied (2x2 and 768x64) I find this error is from the wrong output of CustomExtractor_PPO Then I change the output of the CustomExtractor_PPO(custom_feature_extractor.py), return combined_features instead of policy_output Then raise this error ValueError: Expected parameter loc (Tensor of shape (1, 2)) of distribution Normal(loc: torch.Size([1, 2]), scale: torch.Size([1, 2])) to satisfy the constraint Real(), but found invalid values: tensor([[nan, nan]], device='cuda:0')

I have no idea why i got this error, please help me~

song-hl commented 4 months ago

when I run train_dqn_agent.py, raise error _segmentation fault (core dumped) python train_dqnagent.py

angelomorgado commented 4 months ago

Hey there! What was happening is that I was still developing that particular script but it still had some errors. It should be working now. Just do a "git pull" or clone the repo again.

song-hl commented 4 months ago

Hey there! What was happening is that I was still developing that particular script but it still had some errors. It should be working now. Just do a "git pull" or clone the repo again.

I still got the error when run train_dqn_agent.py image

angelomorgado commented 4 months ago

That's odd. What are the specs of your machine and and which OS are you using? Does the server also crash? And if it does which error message does it display?

Also check if your CUDA is working: " python import torch torch.cuda.is_available() " Tell me if that is true or false

I'm curious because I have tried that script on 3 different machines with 3 different OS and it works. So I'm guessing the problem lies somewhere else

song-hl commented 4 months ago

That's odd. What are the specs of your machine and and which OS are you using? Does the server also crash? And if it does which error message does it display?

Also check if your CUDA is working: " python import torch torch.cuda.is_available() " Tell me if that is true or false

I'm curious because I have tried that script on 3 different machines with 3 different OS and it works. So I'm guessing the problem lies somewhere else

Thanks for your advice. I tried on another machines with same env,then it works! By the way, There still some bugs when I run train_agent_stablebaselines3.py.

angelomorgado commented 4 months ago

About the ppo stable baselines agent, it's not complete, that's what I'm doing at the moment. Since I changed the agent's architecture for a combination of MLPs, it's way harder to make this architecture compatible with the stable baselines, because I haven't figured out the processing that is does to the data. But rest assured, once I sort it out, i'll let you know

song-hl commented 4 months ago

About the ppo stable baselines agent, it's not complete, that's what I'm doing at the moment. Since I changed the agent's architecture for a combination of MLPs, it's way harder to make this architecture compatible with the stable baselines, because I haven't figured out the processing that is does to the data. But rest assured, once I sort it out, i'll let you know

https://github.com/song-hl/CARLA-GymDrive/tree/dev I update some moudle in CustomExtractor_PPO. It works well with sb3 ppo. I hope it helps

angelomorgado commented 4 months ago

About the ppo stable baselines agent, it's not complete, that's what I'm doing at the moment. Since I changed the agent's architecture for a combination of MLPs, it's way harder to make this architecture compatible with the stable baselines, because I haven't figured out the processing that is does to the data. But rest assured, once I sort it out, i'll let you know

https://github.com/song-hl/CARLA-GymDrive/tree/dev I update some moudle in CustomExtractor_PPO. It works well with sb3 ppo. I hope it helps

Hey there! For the past few weeks I was working on another part of this project, and only in the past couple of days I worked on this particular script. Thank you so much for the help, I already pushed the new CustomExtractor with your fixed but I changed the overall architecture for a more robust one (i.e., changed the feature extractor for a better one and removed the situation variable which was only making the data more confusing for the agent. Check it out if you're interested. I added a thank you message in the Acknowledgements section of the README file crediting you for the help.