33import gc
44import json
55import os
6+ import sys
67import time
78
89import torch
910import torch .distributed as dist
1011import yaml
1112from easydict import EasyDict
13+ from lmms_eval .utils import make_table
1214from loguru import logger
1315from torch .distributed import destroy_process_group , init_process_group
1416
1517from llmc .compression .quantization import *
1618from llmc .compression .sparsification import *
1719from llmc .data import BaseDataset
1820from llmc .eval import (AccuracyEval , HumanEval , PerplexityEval ,
19- TokenConsistencyEval , VLMEval )
21+ TokenConsistencyEval , VQAEval )
2022from llmc .models import *
2123from llmc .utils import (check_config , mkdirs , print_important_package_version ,
2224 seed_all , update_autoawq_quant_config ,
@@ -46,9 +48,9 @@ def main(config):
4648 if config .eval .type == 'acc' :
4749 acc_eval = AccuracyEval (config_for_eval )
4850 eval_list .append (acc_eval )
49- elif config .eval .type == 'img_txt ' :
50- acc_eval = VLMEval (config_for_eval )
51- eval_list .append (acc_eval )
51+ elif config .eval .type == 'vqa ' :
52+ vqa_eval = VQAEval (config_for_eval )
53+ eval_list .append (vqa_eval )
5254 elif config .eval .type == 'code' and config .eval .name == 'human_eval' :
5355 human_eval = HumanEval (model .get_tokenizer (), config_for_eval )
5456 eval_list .append (human_eval )
@@ -61,10 +63,11 @@ def main(config):
6163 for acc_eval in eval_list :
6264 acc = acc_eval .eval (model )
6365 logger .info (f'{ config .eval .name } acc : { acc } ' )
64- elif config .eval .type == 'img_txt' :
65- for vlm_eval in eval_list :
66- results = vlm_eval .eval (model )
67- logger .info (f'{ config .eval .name } results : { results } ' )
66+ elif config .eval .type == 'vqa' :
67+ for vqa_eval in eval_list :
68+ results = vqa_eval .eval (model )
69+ logger .info (f'{ config .eval .name } results :' )
70+ print (make_table (results ))
6871 elif config .eval .type == 'code' and config .eval .name == 'human_eval' :
6972 for human_eval in eval_list :
7073 results = human_eval .eval (model , eval_pos = 'pretrain' )
@@ -125,10 +128,6 @@ def main(config):
125128 for acc_eval in eval_list :
126129 acc = acc_eval .eval (model )
127130 logger .info (f'{ config .eval .name } acc : { acc } ' )
128- elif config .eval .type == 'img_txt' :
129- for vlm_eval in eval_list :
130- results = vlm_eval .eval (model )
131- logger .info (f'{ config .eval .name } results : { results } ' )
132131 elif config .eval .type == 'code' and config .eval .name == 'human_eval' :
133132 for human_eval in eval_list :
134133 results = human_eval .eval (model , eval_pos = 'transformed' )
@@ -157,10 +156,12 @@ def main(config):
157156 for acc_eval in eval_list :
158157 acc = acc_eval .eval (model )
159158 logger .info (f'{ config .eval .name } acc : { acc } ' )
160- elif config .eval .type == 'img_txt' :
161- for vlm_eval in eval_list :
162- results = vlm_eval .eval (model )
163- logger .info (f'{ config .eval .name } results : { results } ' )
159+
160+ elif config .eval .type == 'vqa' :
161+ for vqa_eval in eval_list :
162+ results = vqa_eval .eval (model )
163+ logger .info (f'{ config .eval .name } results :' )
164+ print (make_table (results ))
164165 elif config .eval .type == 'code' and config .eval .name == 'human_eval' :
165166 for human_eval in eval_list :
166167 results = human_eval .eval (model , eval_pos = 'fake_quant' )
@@ -251,6 +252,7 @@ def main(config):
251252
252253
253254if __name__ == '__main__' :
255+ logger .add (sys .stdout , level = 'INFO' )
254256 llmc_start_time = time .time ()
255257 parser = argparse .ArgumentParser ()
256258 parser .add_argument ('--config' , type = str , required = True )
0 commit comments