TianyuZhang commited on
Commit
c50be42
1 Parent(s): 9ac96a6

Update README.md

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