From 363af904ff60798e4fe7c3c3a4eb522cf248a02f Mon Sep 17 00:00:00 2001 From: Mandlin Sarah Date: Tue, 3 Sep 2024 11:20:39 -0700 Subject: [PATCH] Enhanced readability and consistency by improving exception messages --- eval_mm/vqaeval/eval.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/eval_mm/vqaeval/eval.py b/eval_mm/vqaeval/eval.py index f5faf9f..b92902c 100644 --- a/eval_mm/vqaeval/eval.py +++ b/eval_mm/vqaeval/eval.py @@ -21,7 +21,7 @@ def get_model(args): if args.model_name == '': - raise Exception('Model name cannot be empty str!') + raise ValueError('Model name cannot be an empty string!') from models.MiniCPM.minicpmv import MiniCPM_V, MiniCPM_V_2_6 model_path = args.model_path ckpt = args.ckpt @@ -31,7 +31,7 @@ def get_model(args): elif args.model_name == 'minicpmv26': model = MiniCPM_V_2_6(model_path=model_path, ckpt=ckpt, device=args.device) else: - raise Exception(f"Unexpected Moedel Name {args.model_name}!") + raise ValueError(f"Unexpected Model Name: {args.model_name}!") return model @@ -100,4 +100,5 @@ def main(args): if __name__ == "__main__": args = parse_args() - main(args) \ No newline at end of file + main(args) +