diff --git a/fastchat/llm_judge/gen_model_answer.py b/fastchat/llm_judge/gen_model_answer.py index 9d6995227..c2f73029d 100644 --- a/fastchat/llm_judge/gen_model_answer.py +++ b/fastchat/llm_judge/gen_model_answer.py @@ -125,7 +125,7 @@ def get_model_answers( output_ids, spaces_between_special_tokens=False, ) - if conv.stop_str: + if conv.stop_str and output.find(conv.stop_str) > 0: output = output[: output.find(conv.stop_str)] for special_token in tokenizer.special_tokens_map.values(): if isinstance(special_token, list):