|
Download docs/CONSDRIVE_DESIGN.md from ZenoNing/ConsDrive: direct link, hf CLI and curl.
- Browser
- Download file 6.44 kB
-
https://huggingface.co/ZenoNing/ConsDrive/resolve/main/docs/CONSDRIVE_DESIGN.md
- Command line
-
hf download hf://ZenoNing/ConsDrive/docs/CONSDRIVE_DESIGN.md
-
curl -L -o CONSDRIVE_DESIGN.md https://huggingface.co/ZenoNing/ConsDrive/resolve/main/docs/CONSDRIVE_DESIGN.md
6.44 kB
| # ConsDrive: Plan-Conditioned Consequence Model | |
| ## Scope | |
| ConsDrive adds a small auxiliary head to the `qwen3vl_video_dream` training | |
| path. It does not add an action latent, JEPA cache, or world predictor. The | |
| head consumes the actual metric plans produced by the driving adaptor: | |
| - route: `[B, 20, 2]` | |
| - speed trajectory: `[B, 10, 2]` | |
| - compact scene/context feature: masked mean of LM outputs before the adaptor | |
| query tokens | |
| It predicts per-speed-waypoint collision/occupancy logits and signed clearance | |
| in metres, both `[B, 10]`. Explicit route/speed coordinates are encoded and | |
| fused at every waypoint; same-scene candidate ranking supplies direct pressure | |
| against ignoring the plan. | |
| ## Labels and validity | |
| For ordinary CARLA samples, the loader looks for ten future `boxes/*.json.gz` | |
| files aligned with the ten speed waypoints. Actor positions saved in each | |
| future ego frame are transformed through the future world pose into the | |
| current ego frame. Camera-shift translation/rotation is then applied with the | |
| same transform used for waypoint labels. | |
| Physical `car`, `walker`, `static`, and `static_car` boxes are retained. The | |
| collision proxy is signed point-to-oriented-box distance minus a conservative | |
| ego radius. A non-positive value is the occupancy/collision target. Loaded | |
| empty box frames are valid free-space observations; missing or malformed box | |
| files are invalid, not empty. | |
| When boxes are absent, explicit future `vehicle_hazard`/`walker_hazard` | |
| measurement fields provide a binary risk target for the GT plan only. | |
| Clearance, predicted-plan geometry labels, and geometry-derived ranking remain | |
| masked. No clearance or actor future is synthesized from hazard flags. | |
| The collated labels include: | |
| - GT risk/clearance targets and waypoint validity masks | |
| - padded future oriented boxes, actor masks, and per-frame file-valid masks | |
| - Action Dreaming `safe_to_execute`, validity, and sample-type flags | |
| ## Losses | |
| The configured global consequence weight has a linear warmup. Components are: | |
| 1. BCE risk and Smooth-L1 clearance on the predicted plan when future box | |
| geometry is valid. | |
| 2. GT-plan risk/clearance anchors, including hazard-only fallback risk. | |
| 3. Same-scene ranking for speed-scaled and left/right-offset candidates built | |
| from both predicted and GT plans. Ranking is enabled only if every future | |
| box frame is valid, the base plan is geometrically collision-free, and the | |
| candidate is geometrically proven to collide. | |
| 4. Action Dreaming safety classification from aggregate plan risk when | |
| `safe_to_execute` labels the trajectory that is actually returned. | |
| 5. Action Dreaming same-scene pairwise ranking. When one safe and one unsafe | |
| option coexist in the same dreamer file, the head must score the unsafe | |
| plan higher while reusing exactly the same scene/context feature. This | |
| remains active without future boxes and prevents a scene-only shortcut. | |
| Dream samples retain the original route/speed waypoint losses. They do not | |
| receive occupancy or clearance regression because counterfactual actor futures | |
| are unavailable. If safety mode replaces an unsafe dreamed action with the | |
| original trajectory, its instruction safety flag is masked for the consequence | |
| head because it no longer describes the returned plan. | |
| All terms use the repository's `(per_sample_loss, per_sample_count)` convention | |
| and flow through `summarise_losses`. | |
| ## Training and inference paths | |
| `DrivingModel.forward_loss` asks `forward_model` for both adaptor outputs and a | |
| pooled context vector, then calls the consequence head. Candidate plans reuse | |
| that vector and only run the small auxiliary head. | |
| `DrivingModel.forward` keeps its existing API and calls `forward_model` without | |
| requesting context. It never invokes the consequence head. Deployment | |
| therefore has the same backbone/adaptor forward count and outputs as the Dream | |
| baseline. | |
| An optional deployment experiment reuses the trained head as a speed gate: | |
| `forward(..., return_context=True)` additionally returns the pooled scene | |
| feature, and `score_plan_risk` scores candidate plans with the head. The | |
| Bench2Drive agent enables this with `--consequence-gating` on | |
| `eval_bench2drive.py`: each step, the predicted speed trajectory is scaled by | |
| a configurable candidate set (default `1.0, 0.85, 0.7, 0.5`), all candidates | |
| are scored against the same scene context and route, and the fastest | |
| candidate whose aggregated collision probability stays under | |
| `--gating-risk-threshold` (default 0.5, `max` over waypoints) is executed. | |
| The backbone still runs once per step; only the small MLP head is evaluated | |
| per candidate. Gating decisions are counted and printed on agent destroy. | |
| Use: | |
| ```text | |
| experiment=qwen3vl_video_dream_consdrive | |
| ``` | |
| or: | |
| ```bash | |
| cd /public/ZLCODE/ConsDrive | |
| scripts/run_train_qwen3vl_video_dream_consdrive.sh | |
| ``` | |
| The configuration keeps `hist_len: 3`, Dream ratio `0.35`, and | |
| `use_jepa_cache: false`. | |
| ## Current limitations | |
| - The inspected shared SimLingo route export contains measurements and images | |
| but no `boxes/` directory. On such data, only explicit GT-plan hazard risk | |
| supervision, Dream safety classification, and same-scene Dream plan-pair | |
| ranking are active; clearance and geometry-derived ranking are masked. | |
| - `consequence_use_future_boxes: false` skips missing box probes in this | |
| dataset. Enable it only for an export that actually contains `boxes/`. | |
| - To obtain geometry supervision on the shared export: | |
| `scripts/download_future_boxes.sh` streams the official HuggingFace archives | |
| (`RenzKa/simlingo`, ~1.16 TB transferred) and extracts only `boxes/` files; | |
| `scripts/build_consequence_box_cache.py` then bakes per-route world-frame | |
| box arrays into an mmap cache. Setting | |
| `data_module.consequence_box_cache_root` makes the loader use the cache and | |
| removes all per-sample gzip probing (`tests/test_consequence_box_cache.py` | |
| verifies cache and direct loading produce identical labels). | |
| - The clearance target is a 2D footprint proxy, not a calibrated TTC. It does | |
| not model actor velocity uncertainty or ego yaw along the candidate path. | |
| - Hazard fallback labels describe the demonstrated GT path and cannot prove | |
| counterfactual predicted-plan safety. | |
| - Actor padding keeps the nearest configured number of physical boxes per | |
| future frame. The default is 32. | |