Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
zehuichen123 committed Feb 20, 2024
1 parent 6fa1c40 commit 93c5272
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ def infer(dataset, llm, out_dir, tmp_folder_name='tmp', test_num = -1):
test_num -= 1
prompt = dataset[idx]['origin_prompt']
prediction = llm.chat(prompt)
if not isinstance(prediction, str):
print("Warning: the output of llm is not a string, force to convert it into str")
prediction = str(prediction)
prediction = split_special_tokens(prediction)
dataset[idx]['prediction'] = prediction
mmengine.dump(dataset[idx], os.path.join(out_dir, tmp_folder_name, f'{idx}.json'))
Expand Down

0 comments on commit 93c5272

Please sign in to comment.