Add header and fix command (#5082)

This commit is contained in:
Sylvain Gugger
2020-06-17 11:45:05 -04:00
committed by GitHub
parent 70bc3ead4f
commit cd40f6564e
2 changed files with 2 additions and 1 deletions

View File

@@ -11,7 +11,7 @@ export HANS_DIR=path-to-hans
export MODEL_TYPE=type-of-the-model-e.g.-bert-roberta-xlnet-etc
export MODEL_PATH=path-to-the-model-directory-that-is-trained-on-NLI-e.g.-by-using-run_glue.py
python examples/adversarial/test_hans.py \
python run_hans.py \
--task_name hans \
--model_type $MODEL_TYPE \
--do_eval \

View File

@@ -216,6 +216,7 @@ def main():
output_eval_file = os.path.join(training_args.output_dir, "hans_predictions.txt")
if trainer.is_world_master():
with open(output_eval_file, "w") as writer:
writer.write("pairID,gold_label\n")
for pid, pred in zip(pair_ids, preds):
writer.write("ex" + str(pid) + "," + label_list[int(pred)] + "\n")