Train and evaluate vision-language models on CausalScene and BDD100K. The custom PEFT package in peft_egg/ implements task-routed LoRA.
Download the CausalScene dataset from Quark Drive.
Use Python 3.10–3.12. From the repository root, install the dependencies.
python -m pip install -r requirements.txtUse matching PyTorch and torchvision builds for your CUDA environment. For 4-bit training, install bitsandbytes on a supported GPU environment. For the optional DeepSeek backend, follow the DeepSeek-VL2 installation instructions in a separate Python environment and select --model deepseek.
Each CausalScene branch uses images/ and label/ subdirectories. The loader supports SEP, DHO/bdd, DHO/Corner_Cases, RCE, ADR, and MTA.
python causalscene_experiments.py inspect --dataset-root data/CAUSALSCENE
python causalscene_experiments.py train --dataset-root data/CAUSALSCENE --method task-routed --output-dir outputs/task_routed
python causalscene_experiments.py compare --dataset-root data/CAUSALSCENE --adapter-task-routed outputs/task_routed
python causalscene_experiments.py compare-models --dataset-root data/CAUSALSCENE --model qwen2-vl-2bUse --help on each command for options. --base-model accepts a Hugging Face repository ID or a model directory. The compare-models command also accepts a model registry via --models-config.
run.py --image IMAGE --qa-file QA_JSON --model qwenscores one image provided by the caller. The JSON contains parallelquestionsandlabelsarrays. Model choices areqwen,phi,llava, anddeepseek.download_model.py MODEL_ID --output-dir models/MODELdownloads weights on demand. The Hugging Face Hub uses its standard authentication and cache settings.train.py,qwen2.py,phi3.5.py, andeval_qwen2vl_dynamic_lora.pytake BDD100K image and label directories fromTRAFFIC_IMAGE_DIRandTRAFFIC_LABEL_DIR.train_qwen2vl_dynamic_lora.pyuses the same variables for flat CausalDrive image and label directories.eval_qwen.pyreads the branched dataset fromTRAFFIC_CAUSALSCENE_ROOT. SetTRAFFIC_USE_LORA=1to evaluate with the trained adapter.TRAFFIC_SAVE_DIRcontrols where the standalone trainers save adapters.TRAFFIC_LORA_DIRidentifies an adapter checkpoint for the standalone evaluators.- Override the model references with
TRAFFIC_QWEN_MODEL,TRAFFIC_PHI_MODEL,TRAFFIC_LLAVA_MODEL, orTRAFFIC_DEEPSEEK_MODEL.