infer.sh 965 字节
Newer Older
J
jiangbojian 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
#! /bin/sh

export LD_LIBRARY_PATH=/home/work/cuda-9.0/lib64:/home/work/cudnn/cudnn_v7/cuda/lib64:/home/work/cuda-9.0/extras/CUPTI/lib64:$LD_LIBRARY_PATH

wget https://baidu-nlp.bj.bcebos.com/EMNLP2019-MAL/checkpoint.best.tgz
tar -zxf checkpoint.best.tgz

infer(){
        CUDA_VISIBLE_DEVICES=$1 python -u src/infer.py \
          --val_file_pattern $3 \
          --vocab_size $4 \
          --special_token '<s>' '<e>' '<unk>' \
          --use_mem_opt True \
          --use_delay_load True \
          --infer_batch_size 16 \
          --decode_alpha 0.3 \
          d_model 1024 \
          d_inner_hid 4096 \
          n_head 16 \
          prepostprocess_dropout 0.0 \
          attention_dropout 0.0 \
          relu_dropout 0.0 \
          model_path $2 \
          beam_size 4 \
          max_out_len 306 \
          max_length 256
}

infer 0 checkpoint.best testset/testfile 37007

sh evaluate.sh trans/forward_checkpoint.best
grep "BLEU_cased" trans/*