Fix result saving errors of pytorch examples (#20276)
This commit is contained in:
@@ -747,16 +747,10 @@ def main():
|
||||
tokenizer.save_pretrained(args.output_dir)
|
||||
if args.push_to_hub:
|
||||
repo.push_to_hub(commit_message="End of training", auto_lfs_prune=True)
|
||||
with open(os.path.join(args.output_dir, "all_results.json"), "w") as f:
|
||||
json.dump(
|
||||
{
|
||||
"eval_rouge1": result["rouge1"],
|
||||
"eval_rouge2": result["rouge2"],
|
||||
"eval_rougeL": result["rougeL"],
|
||||
"eval_rougeLsum": result["rougeLsum"],
|
||||
},
|
||||
f,
|
||||
)
|
||||
|
||||
all_results = {f"eval_{k}": v for k, v in result.items()}
|
||||
with open(os.path.join(args.output_dir, "all_results.json"), "w") as f:
|
||||
json.dump(all_results, f)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user