Skip to content

PTQ-Level Efficiency, QAT-Level Accuracy | 训练后量化的效率,量化感知训练的精度

mllm eval bug fix (#297)

n1ck-guo0bb70a64f684
diff --git a/auto_round/mllm/eval.py b/auto_round/mllm/eval.py
index 8506b089f..ec1b2b118 100644
--- a/auto_round/mllm/eval.py
+++ b/auto_round/mllm/eval.py
@@ -39,7 +39,7 @@ MODEL_TYPE_TO_VLMEVAL_MODEL = {
#model_name
"Qwen-VL": dict(cls="QwenVL"),
"Qwen-VL-Chat": dict(cls="QwenVLChat"),
- "Qwen2-VL": dict(cls="Qwen2VLChat", min_pixels=1280*28*28, max_pixels=16384*28*28),
+ "Qwen2-VL": dict(cls="Qwen2VLChat", min_pixels=1280*28*28, max_pixels=16384*28*28, verbose=False),
"Llama-3.2": dict(cls="llama_vision"),
"Phi-3-vision": dict(cls="Phi3Vision"),
"Phi-3.5-vision": dict(cls="Phi3_5Vision"),
@@ -112,7 +112,9 @@ def mllm_eval(
kwargs["model_path"] = pretrained_model_name_or_path
model_cls = kwargs.pop("cls")
model_cls = getattr(vlmeval.vlm, model_cls)
- vlmeval.config.supported_VLM[model_name] = partial(model_cls, verbose=verbose, **kwargs)
+ if "verbose" in kwargs:
+ kwargs["verbose"] = verbose
+ vlmeval.config.supported_VLM[model_name] = partial(model_cls, **kwargs)
pred_root = os.path.join(work_dir, model_name)
os.makedirs(pred_root, exist_ok=True)
diff --git a/auto_round/script/mllm.py b/auto_round/script/mllm.py
index 6a79adcd3..3631d867e 100644
--- a/auto_round/script/mllm.py
+++ b/auto_round/script/mllm.py
@@ -47,7 +47,7 @@ class BasicArgumentParser(argparse.ArgumentParser):
self.add_argument("--asym", action='store_true',
help=" asym quantization")
- self.add_argument("--dataset", required=True, type=str,
+ self.add_argument("--dataset", type=str, default=None,
help="The dataset for quantization training. It can be a custom one.")
self.add_argument("--lr", default=None, type=float,
@@ -201,6 +201,7 @@ def tune(args):
model_name = model_name[:-1]
logger.info(f"start to quantize {model_name}")
+ assert args.dataset is not None, "dataset should not be None."
device_str = detect_device(args.device)
torch_dtype = "auto"