From 9f6d452ca62d8fb1473129716b177b59c5c604bd Mon Sep 17 00:00:00 2001 From: Ivan Komarov Date: Sat, 25 Feb 2023 08:39:14 +0300 Subject: [PATCH] Fix `ValueError` when testing PyTorch performance (#14450) ### Description Fixed an exception that is thrown inside `transformers` when trying to test PyTorch performance: ``` > python convert_generation.py -m gpt2 --output gpt2_greedy_search.onnx --num_beams 1 --num_return_sequences 1 --torch_performance --- onnxruntime/python/tools/transformers/convert_generation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onnxruntime/python/tools/transformers/convert_generation.py b/onnxruntime/python/tools/transformers/convert_generation.py index a106d906d0..5e2a27d7fa 100644 --- a/onnxruntime/python/tools/transformers/convert_generation.py +++ b/onnxruntime/python/tools/transformers/convert_generation.py @@ -1850,7 +1850,7 @@ def test_torch_performance( num_return_sequences=args.num_return_sequences, length_penalty=args.length_penalty, repetition_penalty=args.repetition_penalty, - bad_words_ids=bad_words_ids, + bad_words_ids=bad_words_ids if bad_words_ids else None, return_dict_in_generate=True, output_scores=args.output_sequences_scores or args.output_token_scores, )