π Homepage | π arXiv | π€ Models
This repo includes codes and examples for paper Browse and Concentrate: Comprehending Multimodal Content via prior-LLM Context Fusion.
We propose a paradigm Browse and Concentrate (Brote) for incorporating multimodal context before feeding features into the LLM, together with two approaches to implement our paradigm, Brote-EX and Brote-IM. The model structures are shown in the following figure.
(Please jump to the inference section if you want to use our model for inference only.)
Please refer to the data format described in MIC.
We create a dataset of 56k fewshot data samples (each data sample contains one or multiple images), resulting in 191k training instances (one image per instance). These instances are supposed to contain question-aware and cross-image information. The data construction pipeline is illustrated in the following figure.
Please download our pretraining dataset from the ModelScope link, or HuggingFace link.
We sampled about 500k data from MIC for model finetuning.
pip install -r requirements.txt
The full training scripts will be available soon.
β οΈ Please follow the instructions for training:
Preparing for training data
bash run_script/gen_condition/get_conditions_gpt.sh 0 stage1_gpt_v0.parquet.gzip ./pretrain_data stage1_gpt_v0_condion.parquet.gzip
Unfreeze the parameters for query token and Q-Former (the others remain frozen), and conduct training targeting at the 'gpt_caption' field in the pretraining dataset.
Command to run:
bash run_script/pretrain/train_stage1.sh
Brote-EX
Brote-IM
To run the test script (ensure the required libraries are properly installed):
export CUDAID='please set you cuda id here'
export TASKID='please set the case id (from 1 to 5), or use the string 'all'(lowercase)'
CUDA_VISIBLE_DEVICES=$CUDAID python test.py $TASKID
Please note that the input data format matters. If you cannot obtain similar results as mentioned in our paper, please try to modify the instruction template, especially for those aligning image tokens to the image representation.
(π± in this figure is a 6-year-old cat, his name is Alan.)
Please download our model from π€ Models.
π If you find our project helpful to your research, please consider citing:
@inproceedings{
wang2024browse,
title={Browse and Concentrate: Comprehending Multimodal Content via Prior-{LLM} Context Fusion},
author={Wang, Ziyue and Chen, Chi and Zhu, Yiqi and Luo, Fuwen and Li, Peng and Yan, Ming and Zhang, Ji and Huang, Fei and Sun, Maosong and Liu, Yang},
booktitle={The 62nd Annual Meeting of the Association for Computational Linguistics},
year={2024},
}
Our models are build upon MMICL and InstructBLIP.
19 commits
9 commits
Python
99.6%
π Homepage | π arXiv | π€ Models
This repo includes codes and examples for paper Browse and Concentrate: Comprehending Multimodal Content via prior-LLM Context Fusion.
We propose a paradigm Browse and Concentrate (Brote) for incorporating multimodal context before feeding features into the LLM, together with two approaches to implement our paradigm, Brote-EX and Brote-IM. The model structures are shown in the following figure.
(Please jump to the inference section if you want to use our model for inference only.)
Please refer to the data format described in MIC.
We create a dataset of 56k fewshot data samples (each data sample contains one or multiple images), resulting in 191k training instances (one image per instance). These instances are supposed to contain question-aware and cross-image information. The data construction pipeline is illustrated in the following figure.
Please download our pretraining dataset from the ModelScope link, or HuggingFace link.
We sampled about 500k data from MIC for model finetuning.
pip install -r requirements.txt
The full training scripts will be available soon.
β οΈ Please follow the instructions for training:
Preparing for training data
bash run_script/gen_condition/get_conditions_gpt.sh 0 stage1_gpt_v0.parquet.gzip ./pretrain_data stage1_gpt_v0_condion.parquet.gzip
Unfreeze the parameters for query token and Q-Former (the others remain frozen), and conduct training targeting at the 'gpt_caption' field in the pretraining dataset.
Command to run:
bash run_script/pretrain/train_stage1.sh
Brote-EX
Brote-IM
To run the test script (ensure the required libraries are properly installed):
export CUDAID='please set you cuda id here'
export TASKID='please set the case id (from 1 to 5), or use the string 'all'(lowercase)'
CUDA_VISIBLE_DEVICES=$CUDAID python test.py $TASKID
Please note that the input data format matters. If you cannot obtain similar results as mentioned in our paper, please try to modify the instruction template, especially for those aligning image tokens to the image representation.
(π± in this figure is a 6-year-old cat, his name is Alan.)
Please download our model from π€ Models.
π If you find our project helpful to your research, please consider citing:
@inproceedings{
wang2024browse,
title={Browse and Concentrate: Comprehending Multimodal Content via Prior-{LLM} Context Fusion},
author={Wang, Ziyue and Chen, Chi and Zhu, Yiqi and Luo, Fuwen and Li, Peng and Yan, Ming and Zhang, Ji and Huang, Fei and Sun, Maosong and Liu, Yang},
booktitle={The 62nd Annual Meeting of the Association for Computational Linguistics},
year={2024},
}
Our models are build upon MMICL and InstructBLIP.
19 commits
9 commits
Python
99.6%