u-LLaVA is a multimodal multi-task large language model framework designed to uniformly handle multiple vision-language tasks through LLMs. The project is developed by OPPOMKLab and has been accepted to the main track of ECAI 2024.
Purpose
The main purpose of u-LLaVA is to unify multimodal tasks, including visual understanding, visual segmentation, and visual grounding. Specific tasks include:
- Visual understanding: image captioning, video captioning, visual question answering (VQA)
- Visual segmentation: referring expression segmentation (RES), salient object segmentation, semantic segmentation, instance segmentation
- Visual grounding: referring expression comprehension (REC)
Main Capabilities
- Multimodal multi-task unification: handling multiple vision-language tasks through LLMs.
- Support for multiple datasets: including mixed datasets of text, image-text, video-text, etc.
- Training pipeline: divided into Stage I pre-training and Stage II fine-tuning, supporting multi-GPU and single-GPU training.
- Evaluation: provides batch evaluation and qualitative inference capabilities.
- Released resources: code, segmentation weights, Salient-15k dataset.
Usage
- Install dependencies:
pip install -r requirements.txt - Build GroundingDINO's CUDA kernel:
cd ./models/GroundingDINO && ./install.sh && cd ../.. - Download annotations and image data: download the ullava-modified annotations, LLaVA pre-training and fine-tuning annotations, and image storage according to the provided links.
- Prepare the open-source LLaMA model: note that LLaMA2 uses bf16 training, and using fp16 in Stage I may cause convergence errors; Llama-2's tokenizer.legacy defaults to False, which may cause tokenization mismatch errors. The base LLM used in the paper is Vicuna-v1.1, not LLaMA2.
- Train Stage I: use multi-GPU or single-GPU commands, for example
python train_ullava_core.py --cfg_path './configs/train/ullava_core_stage1.yaml'. Stage I uses 4 A100 80G and bf16 training for 1 epoch takes about 6 hours. - Train Stage II: use multi-GPU or single-GPU commands, for example
python train_ullava.py --cfg_path './configs/train/ullava_stage2_lora.yaml'. - Evaluation: modify the parsers in
evaluation/inference_ullava_core.pyandevaluation/inference_ullava.pyfor batch evaluation and qualitative inference.
Applicable Scenarios
u-LLaVA is suitable for research and development of multimodal tasks, such as visual question answering, image/video captioning, image segmentation, and visual grounding, etc. It can help researchers and developers explore multimodal tasks within a unified framework.
Limitations
- Training requires relatively high computational resources (such as A100 80G).
- Some weights and features (such as grounding&segmentation weights, ViT-336 support, etc.) have not yet been released and are expected to be released before July or August 2024.
- The license requirements of the original datasets must be followed.
- The project uses the Apache License.