Skip to content

Commit

Permalink
fix(benchmarks) Fix an empty output issue for finance evaluation pipe…
Browse files Browse the repository at this point in the history
…line (#4436)
  • Loading branch information
yan-gao-GY authored Nov 5, 2024
1 parent 87bea16 commit a079987
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion benchmarks/flowertune-llm/evaluation/finance/benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ def inference(dataset, model, tokenizer, batch_size):
**tokens, max_length=512, eos_token_id=tokenizer.eos_token_id
)
res_sentences = [tokenizer.decode(i, skip_special_tokens=True) for i in res]
out_text = [o.split("Answer: ")[1] for o in res_sentences]
out_text = [
o.split("Answer: ")[1] if len(o.split("Answer: ")) > 1 else "None"
for o in res_sentences
]
out_text_list += out_text
torch.cuda.empty_cache()

Expand Down

0 comments on commit a079987

Please sign in to comment.