How drivevla/opendrivevla works
Purpose and entry points
OpenDriveVLA is a research inference/evaluation repository for end-to-end autonomous driving using a vision-language-action model. The operational entry points are drivevla/inference_drivevla.py for prediction and drivevla/eval_drivevla.py for benchmark execution; scripts/eval_drivevla.sh wraps evaluation. Training support exists in the vendored LLaVA and UniAD-derived code but is not presented as released workflow.
Data preparation and sample boundary
nuScenes driving records, multi-camera imagery, map/trajectory context, and driving annotations are transformed into LLaVA-style conversational examples and model-ready batches. drivevla/data_utils/nuscenes_llava_datacollector.py collects/serializes samples; drivevla/data_utils/build_llava_conversation.py defines the language-facing representation; drivevla/data_utils/nuscenes_llava_dataset.py loads it for distributed inference/evaluation. This is the main boundary between autonomous-driving data conventions and multimodal LLM inputs.
Driving perception/planning substrate
A customized UniAD/MMDetection3D plugin supplies the structured driving stack and nuScenes integration. The end-to-end detector coordinates tracking, motion, occupancy, segmentation, and planning through projects/mmdet3d_plugin/uniad/detectors/uniad_e2e.py; task heads include projects/mmdet3d_plugin/uniad/dense_heads/track_head.py, projects/mmdet3d_plugin/uniad/dense_heads/motion_head.py, and projects/mmdet3d_plugin/uniad/dense_heads/planning_head.py. nuScenes-specific scene loading, map/vector processing, and labels reside in projects/mmdet3d_plugin/datasets/nuscenes_e2e_dataset.py and its pipeline package.
Vision-language-action model
The local llava package is the multimodal model layer. It builds a language model plus vision encoder/projector via llava/model/builder.py, llava/model/llava_arch.py, and llava/model/multimodal_encoder/builder.py. Multiple LLM backends are supported, including Qwen implementations in llava/model/language_model/llava_qwen.py; visual tokens are adapted into the LLM embedding space by llava/model/multimodal_projector/builder.py and optional resamplers. This is the boundary from camera features and driving prompts to generated action/trajectory-oriented outputs.
Inference control flow
Inference loads checkpoint/model/tokenizer components, obtains distributed nuScenes batches, forms multimodal conversations, then runs LLaVA generation and converts results to driving outputs. drivevla/inference_drivevla.py orchestrates this path, while drivevla/utils/trajectory_utils.py and drivevla/utils/remove_mmlab_datacontainer.py bridge generated/model tensors with the MMDetection-style data structures. Checkpoint compatibility and model reconstruction are handled by the LLaVA builder rather than an online serving layer.
Evaluation and outputs
drivevla/eval_drivevla.py runs predictions against driving references. General result aggregation and metrics live in drivevla/eval_share/evaluation.py and drivevla/eval_share/metric.py; the UniAD plugin also contains nuScenes motion/planning evaluation adapters under projects/mmdet3d_plugin/datasets/eval_utils/. Evaluation is offline and dataset-backed, not a real-time vehicle-control runtime.
Runtime and infrastructure
The stack is Python/PyTorch, Hugging Face Transformers, DeepSpeed-compatible, and GPU-oriented. It vendors patched MMDetection3D and MMCV specifically for PyTorch 2.1.2 compatibility: third_party/mmdetection3d_1_0_0rc6/ and third_party/mmcv_1_7_2/, including compiled CUDA operators. External dependencies/material sources are nuScenes data, Hugging Face-hosted OpenDriveVLA checkpoints, and pretrained LLaVA/Qwen/vision-model artifacts. Configuration for the UniAD stage is rooted at projects/configs/stage1_track_map/base_track_map.py.
Main entry points: uniad_e2e.py UniAD E2E detector · builder.py LLaVA model builder · inference_drivevla.py Prediction runner · nuscenes_llava_dataset.py Distributed dataset
Components 20
Data preparation
nuScenes records are converted to conversational, distributed model batches.
- nuScenes data · Images, scenes, maps, trajectories, and driving annotations.
- Sample collector · Collects and serializes nuScenes LLaVA samples.
drivevla/data_utils/nuscenes_llava_datacollector.py - Conversation builder · Defines LLaVA-style driving conversations.
drivevla/data_utils/build_llava_conversation.py - Distributed dataset · Loads serialized examples for inference and evaluation.
drivevla/data_utils/nuscenes_llava_dataset.py
Driving substrate
Customized UniAD/MMDetection3D stack provides structured driving tasks.
- nuScenes E2E adapter · Loads scenes, maps, vectors, and labels for UniAD.
projects/mmdet3d_plugin/datasets/nuscenes_e2e_dataset.py - UniAD E2E detector · Coordinates perception, prediction, and planning tasks.
projects/mmdet3d_plugin/uniad/detectors/uniad_e2e.py - Tracking head
projects/mmdet3d_plugin/uniad/dense_heads/track_head.py - Motion head
projects/mmdet3d_plugin/uniad/dense_heads/motion_head.py - Planning head
projects/mmdet3d_plugin/uniad/dense_heads/planning_head.py - Track/map config
projects/configs/stage1_track_map/base_track_map.py
VLA model
Local LLaVA converts visual context and prompts into action-oriented outputs.
- Model artifacts · OpenDriveVLA and pretrained LLaVA, Qwen, and vision weights.
- LLaVA model builder · Loads checkpoints, tokenizer, language model, and vision components.
llava/model/builder.py - Vision encoder · Produces visual tokens from camera imagery.
llava/model/multimodal_encoder/builder.py - Visual projector · Maps visual tokens into LLM embedding space.
llava/model/multimodal_projector/builder.py - Qwen backend · One supported LLM implementation for generation.
llava/model/language_model/llava_qwen.py
Inference and evaluation
Offline GPU prediction and benchmark workflow.
- Prediction runner · Orchestrates batches, generation, and driving-output conversion.
drivevla/inference_drivevla.py - Trajectory bridge · Bridges generated tensors and MMDetection-style driving outputs.
drivevla/utils/trajectory_utils.py - Benchmark runner · Runs offline predictions against driving references.
drivevla/eval_drivevla.py - Metrics and aggregation · Aggregates benchmark results and driving metrics.
drivevla/eval_share/evaluation.py - Patched MMDetection3D · PyTorch 2.1.2-compatible framework with CUDA operators.
third_party/mmdetection3d_1_0_0rc6
Connections 22
- nuScenes data → Sample collector: source records
- Sample collector → Conversation builder: serialized samples
- Conversation builder → Distributed dataset: conversational examples
- nuScenes data → nuScenes E2E adapter: scenes and labels
- Track/map config → UniAD E2E detector: configures
- nuScenes E2E adapter → UniAD E2E detector: driving context
- Tracking head → UniAD E2E detector: tracking task
- Motion head → UniAD E2E detector: motion task
- Planning head → UniAD E2E detector: planning task
- Patched MMDetection3D → UniAD E2E detector: framework runtime
- Model artifacts → LLaVA model builder: weights
- Vision encoder → Visual projector: visual tokens
- Visual projector → Qwen backend: visual embeddings
- LLaVA model builder → Vision encoder: builds
- LLaVA model builder → Qwen backend: builds
- Distributed dataset → Prediction runner: distributed batches
- UniAD E2E detector → Prediction runner: structured driving context
- LLaVA model builder → Prediction runner: loaded multimodal model
- Prediction runner → Trajectory bridge: generated tensors
- Trajectory bridge → Benchmark runner: driving predictions
- Distributed dataset → Benchmark runner: reference batches
- Benchmark runner → Metrics and aggregation: results