Adv-BMT: Bidirectional Motion Transformer for Safety-Critical Traffic Scenario Generation (NeurIPS 2025)
Yuxin Liu1*, Zhenghao Peng1*, Xuanhao Cui1, Bolei Zhou1
1UCLA
*Equal contribution
note: Please refer to FAQ section for any issues.
# Create virtual environment
conda create -n adv-bmt "python=3.10" -y
conda activate adv-bmt
# Install Metadrive
git clone https://github.com/metadriverse/metadrive.git
cd ~/metadrive
pip install -e .
cd ~/
# Install ScenarioNet
git clone https://github.com/metadriverse/scenarionet.git
cd ~/scenarionet
pip install -e .
cd ~/
# Clone the code to local and Install basic dependency for this project
git clone https://github.com/Yuxin45/Adv-BMT.git
pip install -e .
# Install Waymo Open Dataset
pip uninstall -y waymo-open-dataset-tf-2-11-0
pip uninstall -y waymo-open-dataset-tf-2-12-0
pip install waymo-open-dataset-tf-2-12-0==1.6.4
# Verify pytorch, expect True.
python -c "import torch;print(torch.cuda.is_available())"
# (Optional) If your torch is not installed properly.
# That is, torch.cuda.is_available() is False, then:
# Install pytorch by yourself to make them compatible with your GPU: https://pytorch.org/
# Note: First checkout which cuda you have at your
ls /usr/local
# For cuda 11.7:
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
# For cuda 11.8:
pip install torch==2.0.1+cu118 torchvision==0.15.2+cu118 torchaudio==2.0.2 --index-url https://download.pytorch.org/whl/cu118
# For cuda 12.1:
conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia -y
We provide a user interface for testing our method. Running the following command starts the demo.
python bmt/gradio_ui/new_ui.py --shareWe provide a script for running Adv-BMT.
bash scripts/ADV-BMT_dataset_generate.shWe provide 500 WOMD scenarios and our BMT checkpoint reference purposes. Link Please put your checkpoint under ./bmt/ckpt
We provide scripts for running scenario evaluations.
python bmt/eval/evaluate_scenario_metrics.py eval_mode={your_eval_mode}Argument:
| eval_mode | meaning |
|---|---|
SCGEN |
Adv-BMT generation |
GPTmodel |
BMT with forward prediction |
Backward |
BMT with reverse prediction |
Backward_Forward |
BMT with bidirectional prediction |
CAT or STRIVE or SEAL |
baseline generated scenario |
We provide scripts for running open-loop and closed-loop reinforcement learning.
bash bmt/rl_train/scripts/0511_CLRL_SCGEN.shQ: ImportError: cannot import name 'COMMON_SAFE_ASCII_CHARACTERS' from 'charset_normalizer.constant
A:
pip install chardetQ: AttributeError: partially initialized module 'charset_normalizer' has no attribute 'md__mypyc' (most likely due to a circular import)
A:
pip install -U --force-reinstall charset-normalizerQ: RuntimeError: The detected CUDA version (10.1) mismatches the version that was used to compile PyTorch (11.7). Please make sure to use the same CUDA versions.
A: Try:
export CUDA_HOME=/usr/local/cuda-11.7
python setup.py developQ: When compiling MTR's CUDA code (e.g. python setup.py) locally: RuntimeError: The detected CUDA version (11.7) mismatches the version that was used to compile PyTorch (12.1). Please make sure to use the same CUDA versions.
A: Try:
# Download CUDA first: https://developer.nvidia.com/cuda-12-1-0-download-archive
export CUDA_HOME=/usr/local/cuda-12.1
python setup.py developIf you use our code in your research, please cite the following work.
@misc{liu2025advbmtbidirectionalmotiontransformer,
title={Adv-BMT: Bidirectional Motion Transformer for Safety-Critical Traffic Scenario Generation},
author={Yuxin Liu and Zhenghao Peng and Xuanhao Cui and Bolei Zhou},
year={2025},
eprint={2506.09485},
archivePrefix={arXiv},
primaryClass={cs.RO},
url={https://arxiv.org/abs/2506.09485},
}You can find our paper in the NeurIPS 2025 Proceedings with the full BibTex citation here.
