luhua-rain/MRC_Competition_Dureader

metrics.py中compute_predictions_logits函数无法找到指定文件夹或文件

LAnselet opened this issue · 1 comments

  • INFO - metrics - Writing predictions to: ./predictions_test_./du2021/384_bert/.json
    Traceback (most recent call last):
    File "main_bert.py", line 1036, in
    main()
    File "main_bert.py", line 1030, in main
    evaluate(args, model, tokenizer, prefix='test', step=global_step)
    File "main_bert.py", line 509, in evaluate
    tokenizer
    File "/nfs/users/sunyichen/data/MRC_Competition_Dureader/main/metrics.py", line 730, in compute_predictions_logits
    with open(output_prediction_file, "w", encoding='utf-8') as writer:
    FileNotFoundError: [Errno 2] No such file or directory: './du2021/384_bert/predictions_test_./du2021/384_bert/.json'1 - INFO - metrics - Writing nbest to: ./du2021/384_bert/nbest_predictions_test_./du2021/384_bert/.json

把test_bert.sh里面的model_name_or_path参数最后的/去掉即可,这里是在取step的时候把后面的符号/也取进去了,所以在字符串拼接的时候拼成了....st_./du2021/384_bert/.json的形式