dqn_crasher uses RL controlled NPC agents to cause collisions in the highway-env gymnaisum environment.
We recommend using Conda or Mamba for environment management.
git clone https://github.com/amarkoolk/dqn_crasher.git
cd dqn_crasher
pip install -e .This will install all dependencies and make the dqn_crasher package (and its console scripts) available.
You can run the main experiment either as a Python module or via the installed console script:
# Using the Python module interface
python -m dqn_crasher.main --config configs/default.yaml
# Or using the console script
dqn-crasher --config configs/default.yamlAll experiments are configured via YAML files in the src/dqn_crasher/configs/ directory. Example:
env: "crash-v0"
seed: 42
episodes: 1000
dqn:
learning_rate: 0.0005
batch_size: 64
epsilon_decay: 0.995
...You can override config values via command-line flags:
python -m dqn_crasher.main --config configs/default.yaml dqn.learning_rate=0.001To launch a hyperparameter sweep with Weights & Biases:
wandb sweep configs/sweep.yaml
wandb agent <SWEEP_ID>See the configs/ folder for ready-to-use sweep configs.
Train a DQN agent and analyze crash scenarios:
python -m dqn_crasher.maindqn_crasher/
├── src/dqn_crasher/ # core package
│ ├── agents/ # DQN agent
│ ├── buffers/ # replay buffer, sum-tree
│ ├── configs/ # env + model configs (packaged)
│ ├── scenarios/ # scenarios & policies
│ ├── training/ # runner
│ ├── utils/ # helpers, logging
│ └── visualization/ # plotting
├── sweep_configs/ # WandB sweep configs (not packaged)
├── examples/ # experiment & plotting scripts
├── slurm_scripts/ # Slurm job scripts
├── models/ # trained models (git-ignored)
├── environment.yml # Conda/Mamba env
└── pyproject.toml # pip install entry
Contributions are welcome! Please open an issue or submit a pull request. See CONTRIBUTING.md for guidelines.
MIT License. See the LICENSE file for details.
For questions or suggestions, please open an issue or contact the maintainer at amar@example.com.