@@ -54,6 +54,7 @@ def __init__(self, *args, **kwargs):
5454 self .add_argument (
5555 "--disable_trust_remote_code" , action = "store_true" , help = "whether to disable trust_remote_code"
5656 )
57+ self .add_argument ("--seed" , default = 42 , type = int , help = "random seed" )
5758 self .add_argument ("--eval_bs" , "--bs" , "--batch_size" , default = None , type = int , help = "batch size in evaluation" )
5859 self .add_argument ("--eval_task_by_task" , action = "store_true" , help = "whether to eval task by task." )
5960 self .add_argument (
@@ -113,15 +114,9 @@ def _eval_init(tasks, model_path, device, disable_trust_remote_code=False, dtype
113114
114115def eval (args ):
115116 if args .eval_backend == "vllm" :
116- try :
117- assert isinstance (args .model , str ), "vllm evaluation only supports model name or path."
118- eval_with_vllm (args )
119- return
120- except Exception as e : # pragma: no cover
121- print (f"vllm evaluation failed: { e } , fallback to default hf backend evaluation." )
122- args .eval_backend = "hf"
123- clear_memory ()
124-
117+ assert isinstance (args .model , str ), "vllm evaluation only supports model name or path."
118+ eval_with_vllm (args )
119+ return
125120 tasks , model_args , device_str = _eval_init (
126121 args .tasks , args .model , args .device_map , args .disable_trust_remote_code , args .eval_model_dtype
127122 )
@@ -308,7 +303,7 @@ def eval_with_vllm(args):
308303
309304 st = time .time ()
310305 os .environ ["TOKENIZERS_PARALLELISM" ] = "false"
311- device_str , _ = get_device_and_parallelism (args .device )
306+ device_str , _ = get_device_and_parallelism (args .device_map )
312307 eval_model_dtype = get_model_dtype (args .eval_model_dtype , "auto" )
313308 if (batch_size := args .eval_bs ) is None :
314309 batch_size = "auto:8"
0 commit comments