Skip to content

Commit 7c01f7a

Browse files
committedFeb 28, 2025
Add sim agent tutorial
1 parent 78e1522 commit 7c01f7a

File tree

9 files changed

+388
-29
lines changed

9 files changed

+388
-29
lines changed
 

‎baselines/ppo/config/ppo_base_puffer.yaml

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ mode: "train"
22
use_rnn: false
33
eval_model_path: null
44
baseline: false
5-
data_dir: /scratch/kj2676/gpudrive/data/processed/training
5+
data_dir: data/processed/training
66
continue_training: false
77
model_cpt: null
88

@@ -17,7 +17,7 @@ environment: # Overrides default environment configs (see pygpudrive/env/config.
1717
norm_obs: true
1818
remove_non_vehicles: true # If false, all agents are included (vehicles, pedestrians, cyclists)
1919
lidar_obs: false # NOTE: Setting this to true currently turns of the other observation types
20-
reward_type: "weighted_combination" #"distance_to_logs"
20+
reward_type: "weighted_combination"
2121
collision_weight: -0.75
2222
off_road_weight: -0.75
2323
goal_achieved_weight: 1.0
@@ -67,7 +67,7 @@ train:
6767
clip_vloss: false
6868
vf_clip_coef: 0.2
6969
ent_coef: 0.0001
70-
vf_coef: 0.5
70+
vf_coef: 0.3
7171
max_grad_norm: 0.5
7272
target_kl: null
7373
log_window: 1000
@@ -85,11 +85,11 @@ train:
8585
checkpoint_path: "./runs"
8686

8787
# # # Rendering # # #
88-
render: True # Determines whether to render the environment (note: will slow down training)
89-
render_interval: 10 # Render every k iterations
90-
render_k_scenarios: 15 # Number of scenarios to render
91-
render_3d: True
92-
render_format: "gif" # Options: gif, mp4
88+
render: false # Determines whether to render the environment (note: will slow down training)
89+
render_3d: true # Render simulator state in 3d or 2d
90+
render_interval: 1 # Render every k iterations
91+
render_k_scenarios: 10 # Number of scenarios to render
92+
render_format: "mp4" # Options: gif, mp4
9393
render_fps: 15 # Frames per second
9494
zoom_radius: 50
9595

‎data/processed/examples/tfrecord-00000-of-01000_222.json

-1
This file was deleted.

‎data/processed/examples/tfrecord-00000-of-01000_4.json

+1
Large diffs are not rendered by default.

‎examples/experimental/eval/config/eval_config.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ res_path: examples/experimental/eval/dataframes # Store dataframes here
22
test_dataset_size: 10_000 # Number of test scenarios to evaluate on
33

44
# Environment settings
5-
train_dir: /scratch/kj2676/gpudrive/data/processed/training
6-
test_dir: /scratch/kj2676/gpudrive/data/processed/validation
5+
train_dir: data/processed/training
6+
test_dir: data/processed/validation
77

8-
num_worlds: 2 # Number of parallel environments for evaluation
8+
num_worlds: 50 # Number of parallel environments for evaluation
99
max_controlled_agents: 64 # Maximum number of agents controlled by the model.
1010
ego_state: true
1111
road_map_obs: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Overrides default environment configs (see pygpudrive/env/config.py)
2+
max_controlled_agents: 64 # Maximum number of agents controlled by the model. Make sure this aligns with the variable kMaxAgentCount in src/consts.hpp
3+
ego_state: true
4+
road_map_obs: true
5+
partner_obs: true
6+
norm_obs: true
7+
remove_non_vehicles: true # If false, all agents are included (vehicles, pedestrians, cyclists)
8+
lidar_obs: false # NOTE: Setting this to true currently turns of the other observation types
9+
reward_type: "weighted_combination"
10+
collision_weight: -0.75
11+
off_road_weight: -0.75
12+
goal_achieved_weight: 1.0
13+
dynamics_model: "classic"
14+
collision_behavior: "ignore" # Options: "remove", "stop", "ignore"
15+
dist_to_goal_threshold: 2.0
16+
polyline_reduction_threshold: 0.1 # Rate at which to sample points from the polyline (0 is use all closest points, 1 maximum sparsity), needs to be balanced with kMaxAgentMapObservationsCount
17+
sampling_seed: 42 # If given, the set of scenes to sample from will be deterministic, if None, the set of scenes will be random
18+
obs_radius: 50.0 # Visibility radius of the agents
19+
action_space_steer_disc: 13
20+
action_space_accel_disc: 7
21+
init_mode: all_non_trivial

‎examples/experimental/eval/eval_utils.py

-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
from box import Box
66
import numpy as np
77
import dataclasses
8-
import os
9-
from pathlib import Path
108

119
from gpudrive.env.config import EnvConfig, RenderConfig
1210
from gpudrive.env.env_torch import GPUDriveTorchEnv
@@ -18,7 +16,6 @@
1816

1917
import logging
2018
import torch
21-
import random
2219

2320
logging.basicConfig(level=logging.INFO)
2421

0 commit comments

Comments
 (0)