run_sighan_predict.sh 782 B

1234567891011121314151617181920212223242526
  1. export CUDA_VISIBLE_DEVICES=0
  2. model_name_or_path=ernie-1.0
  3. checkpoints_path=checkpoints
  4. model_file=best_model.pdparams
  5. # Download SIGHAN test dataset
  6. if [ ! -d "./sighan_test" ]; then
  7. python download.py
  8. fi
  9. # Predict the test input from sighan13, sighan14, sighan15
  10. for version in 13 14 15
  11. do
  12. python predict_sighan.py --model_name_or_path $model_name_or_path \
  13. --test_file sighan_test/sighan$version/input.txt --batch_size 32 \
  14. --ckpt_path $checkpoints_path/$model_file \
  15. --predict_file predict_sighan$version.txt
  16. done
  17. # Evaluate the prediction result of the model
  18. for version in 13 14 15
  19. do
  20. echo -e "Sighan$version Performace\n"
  21. python sighan_evaluate.py -p predict_sighan$version.txt -t sighan_test/sighan$version/truth.txt
  22. done