Datasets:

Modalities:
Image
Text
Formats:
parquet
Languages:
Chinese
ArXiv:
DOI:
Libraries:
Datasets
Dask
License:
TianyuZhang commited on
Commit
b53b2cc
1 Parent(s): a86a925

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +55 -15
README.md CHANGED
@@ -64,24 +64,64 @@ We found that OCR and text-based processing become ineffective in VCR as accurat
64
  - **Paper:** [VCR: Visual Caption Restoration](https://arxiv.org/abs/2406.06462)
65
  - **Point of Contact:** [Tianyu Zhang](mailto:tianyu.zhang@mila.quebec)
66
 
67
- ## Evaluation
68
 
69
- We recommend you to evaluate your model with [lmms-eval](https://github.com/EvolvingLMMs-Lab/lmms-eval). Before evaluating, please refer to the doc of `lmms-eval`.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
- ```console
72
- pip install git+https://github.com/EvolvingLMMs-Lab/lmms-eval.git
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
- # We use MiniCPM-Llama3-V-2_5 and vcr_wiki_en_easy as an example
75
- python3 -m accelerate.commands.launch \
76
- --num_processes=8 \
77
- -m lmms_eval \
78
- --model minicpm_v \
79
- --model_args pretrained="openbmb/MiniCPM-Llama3-V-2_5" \
80
- --tasks vcr_wiki_en_easy \
81
- --batch_size 1 \
82
- --log_samples \
83
- --log_samples_suffix MiniCPM-Llama3-V-2_5_vcr_wiki_en_easy \
84
- --output_path ./logs/
 
 
 
 
 
 
 
 
 
 
 
85
  ```
86
 
87
  `lmms-eval` supports the following VCR `--tasks` settings:
 
64
  - **Paper:** [VCR: Visual Caption Restoration](https://arxiv.org/abs/2406.06462)
65
  - **Point of Contact:** [Tianyu Zhang](mailto:tianyu.zhang@mila.quebec)
66
 
67
+ # Model Evaluation
68
 
69
+ ## Method 1 (recommended): use the evaluation script
70
+ ```bash
71
+ git clone https://github.com/tianyu-z/VCR.git
72
+ ```
73
+ ### Open-source evaluation
74
+ We support open-source model_id:
75
+ ```python
76
+ ["openbmb/MiniCPM-Llama3-V-2_5",
77
+ "OpenGVLab/InternVL-Chat-V1-5",
78
+ "internlm/internlm-xcomposer2-vl-7b",
79
+ "HuggingFaceM4/idefics2-8b",
80
+ "Qwen/Qwen-VL-Chat",
81
+ "THUDM/cogvlm2-llama3-chinese-chat-19B",
82
+ "THUDM/cogvlm2-llama3-chat-19B",
83
+ "echo840/Monkey-Chat",]
84
+ ```
85
+ For the models not on list, they are not intergated with huggingface, please refer to their github repo to create the evaluation pipeline.
86
 
87
+ ```bash
88
+ # We use HuggingFaceM4/idefics2-8b and vcr_wiki_en_easy as an example
89
+ # Inference from the VLMs and save the results to {model_id}_{difficulty}_{language}.json
90
+ cd src/evaluation
91
+ 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
92
+
93
+ # Evaluate the results and save the evaluation metrics to {model_id}_{difficulty}_{language}_evaluation_result.json
94
+ 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"
95
+
96
+ # 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
97
+ python3 gather_results.py --jsons_path .
98
+ ```
99
+
100
+ ### Close-source evaluation
101
+ We provide the evaluation script for the close-source model: `GPT-4o`, `GPT-4-Turbo`, `Claude-3-Opus` in the `evaluation` folder.
102
 
103
+ You need an API Key, a pre-saved testing dataset and specify the path of the data saving the paper
104
+ ```bash
105
+ cd src/evaluation
106
+ # save the testing dataset to the path
107
+ python3 save_image_from_dataset.py --output_path .
108
+
109
+ # Inference Put your API key and Image Path in the evaluation script (e.g. gpt-4o.py)
110
+ python3 gpt-4o.py
111
+
112
+ # Evaluate the results and save the evaluation metrics to {model_id}_{difficulty}_{language}_evaluation_result.json
113
+ python3 evaluation_metrics.py --model_id gpt4o --output_path . --json_filename "gpt4o_en_easy.json" --dataset_handler "vcr-org/VCR-wiki-en-easy-test"
114
+
115
+ # 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
116
+ python3 gather_results.py --jsons_path .
117
+ ```
118
+
119
+ ## Method 2: use lmms-eval framework
120
+ 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)
121
+ ```bash
122
+ pip install git+https://github.com/EvolvingLMMs-Lab/lmms-eval.git
123
+ # We use HuggingFaceM4/idefics2-8b and vcr_wiki_en_easy as an example
124
+ 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/
125
  ```
126
 
127
  `lmms-eval` supports the following VCR `--tasks` settings: