Datasets:
TianyuZhang
commited on
Commit
•
c19b65d
1
Parent(s):
a83ad57
Update README.md
Browse files
README.md
CHANGED
@@ -56,24 +56,64 @@ We found that OCR and text-based processing become ineffective in VCR as accurat
|
|
56 |
- **Paper:** [VCR: Visual Caption Restoration](https://arxiv.org/abs/2406.06462)
|
57 |
- **Point of Contact:** [Tianyu Zhang](mailto:tianyu.zhang@mila.quebec)
|
58 |
|
59 |
-
|
60 |
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
-
```
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
```
|
78 |
|
79 |
`lmms-eval` supports the following VCR `--tasks` settings:
|
|
|
56 |
- **Paper:** [VCR: Visual Caption Restoration](https://arxiv.org/abs/2406.06462)
|
57 |
- **Point of Contact:** [Tianyu Zhang](mailto:tianyu.zhang@mila.quebec)
|
58 |
|
59 |
+
# Model Evaluation
|
60 |
|
61 |
+
## Method 1 (recommended): use the evaluation script
|
62 |
+
```bash
|
63 |
+
git clone https://github.com/tianyu-z/VCR.git
|
64 |
+
```
|
65 |
+
### Open-source evaluation
|
66 |
+
We support open-source model_id:
|
67 |
+
```python
|
68 |
+
["openbmb/MiniCPM-Llama3-V-2_5",
|
69 |
+
"OpenGVLab/InternVL-Chat-V1-5",
|
70 |
+
"internlm/internlm-xcomposer2-vl-7b",
|
71 |
+
"HuggingFaceM4/idefics2-8b",
|
72 |
+
"Qwen/Qwen-VL-Chat",
|
73 |
+
"THUDM/cogvlm2-llama3-chinese-chat-19B",
|
74 |
+
"THUDM/cogvlm2-llama3-chat-19B",
|
75 |
+
"echo840/Monkey-Chat",]
|
76 |
+
```
|
77 |
+
For the models not on list, they are not intergated with huggingface, please refer to their github repo to create the evaluation pipeline.
|
78 |
|
79 |
+
```bash
|
80 |
+
# We use HuggingFaceM4/idefics2-8b and vcr_wiki_en_easy as an example
|
81 |
+
# Inference from the VLMs and save the results to {model_id}_{difficulty}_{language}.json
|
82 |
+
cd src/evaluation
|
83 |
+
python3 inference.py --dataset_handler "vcr-org/VCR-wiki-en-easy-test" --model_id "HuggingFaceM4/idefics2-8b" --device "cuda" --dtype "bf16" --save_interval 50 --resume True
|
84 |
+
|
85 |
+
# Evaluate the results and save the evaluation metrics to {model_id}_{difficulty}_{language}_evaluation_result.json
|
86 |
+
python3 evaluation_metrics.py --model_id HuggingFaceM4/idefics2-8b --output_path . --json_filename "HuggingFaceM4_idefics2-8b_en_easy.json" --dataset_handler "vcr-org/VCR-wiki-en-easy-test"
|
87 |
+
|
88 |
+
# To get the mean score of all the `{model_id}_{difficulty}_{language}_evaluation_result.json` in `jsons_path` (and the std, confidence interval if `--bootstrap`) of the evaluation metrics
|
89 |
+
python3 gather_results.py --jsons_path .
|
90 |
+
```
|
91 |
+
|
92 |
+
### Close-source evaluation
|
93 |
+
We provide the evaluation script for the close-source model: `GPT-4o`, `GPT-4-Turbo`, `Claude-3-Opus` in the `evaluation` folder.
|
94 |
|
95 |
+
You need an API Key, a pre-saved testing dataset and specify the path of the data saving the paper
|
96 |
+
```bash
|
97 |
+
cd src/evaluation
|
98 |
+
# save the testing dataset to the path
|
99 |
+
python3 save_image_from_dataset.py --output_path .
|
100 |
+
|
101 |
+
# Inference Put your API key and Image Path in the evaluation script (e.g. gpt-4o.py)
|
102 |
+
python3 gpt-4o.py
|
103 |
+
|
104 |
+
# Evaluate the results and save the evaluation metrics to {model_id}_{difficulty}_{language}_evaluation_result.json
|
105 |
+
python3 evaluation_metrics.py --model_id gpt4o --output_path . --json_filename "gpt4o_en_easy.json" --dataset_handler "vcr-org/VCR-wiki-en-easy-test"
|
106 |
+
|
107 |
+
# To get the mean score of all the `{model_id}_{difficulty}_{language}_evaluation_result.json` in `jsons_path` (and the std, confidence interval if `--bootstrap`) of the evaluation metrics
|
108 |
+
python3 gather_results.py --jsons_path .
|
109 |
+
```
|
110 |
+
|
111 |
+
## Method 2: use lmms-eval framework
|
112 |
+
You may need to incorporate the inference method of your model if the lmms-eval framework does not support it. For details, please refer to [here](https://github.com/EvolvingLMMs-Lab/lmms-eval/blob/main/docs/model_guide.md)
|
113 |
+
```bash
|
114 |
+
pip install git+https://github.com/EvolvingLMMs-Lab/lmms-eval.git
|
115 |
+
# We use HuggingFaceM4/idefics2-8b and vcr_wiki_en_easy as an example
|
116 |
+
python3 -m accelerate.commands.launch --num_processes=8 -m lmms_eval --model idefics2 --model_args pretrained="HuggingFaceM4/idefics2-8b" --tasks vcr_wiki_en_easy --batch_size 1 --log_samples --log_samples_suffix HuggingFaceM4_idefics2-8b_vcr_wiki_en_easy --output_path ./logs/
|
117 |
```
|
118 |
|
119 |
`lmms-eval` supports the following VCR `--tasks` settings:
|