Browse Source

Merge pull request #313 from maybeluo/main

writing generated result with utf-8
pull/328/head
Zhengxiao Du 2 years ago committed by GitHub
parent
commit
88be23b74a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      ptuning/main.py

5
ptuning/main.py

@ -374,9 +374,10 @@ def main():
)
labels = [label.strip() for label in labels]
output_prediction_file = os.path.join(training_args.output_dir, "generated_predictions.txt")
with open(output_prediction_file, "w") as writer:
with open(output_prediction_file, "w", encoding="utf-8") as writer:
for p, l in zip(predictions, labels):
writer.write(json.dumps({"labels": l, "predict": p}, ensure_ascii=False))
res = json.dumps({"labels": l, "predict": p}, ensure_ascii=False)
writer.write(f"{res}\n")
return results

Loading…
Cancel
Save