diff --git a/TensorFlow/built-in/nlp/Transformer_ID0004_for_TensorFlow/test/train_full_1p.sh b/TensorFlow/built-in/nlp/Transformer_ID0004_for_TensorFlow/test/train_full_1p.sh index a7ff6ecf74bc5020bd089c651a368d6b0cc76d27..b3a21a5cfea3241b94c1626c509e81300acd281e 100644 --- a/TensorFlow/built-in/nlp/Transformer_ID0004_for_TensorFlow/test/train_full_1p.sh +++ b/TensorFlow/built-in/nlp/Transformer_ID0004_for_TensorFlow/test/train_full_1p.sh @@ -195,12 +195,16 @@ e2e_time=$(( $end_time - $start_time )) #结果打印,不需要修改 echo "------------------ Final result ------------------" #输出性能FPS,需要模型审视修改 -FPS=`grep TimeHistory $cur_path/output/${ASCEND_DEVICE_ID}/train_${ASCEND_DEVICE_ID}.log|awk 'END {print $6}'` +FPS=`grep "INFO:tensorflow:" $cur_path/output/${ASCEND_DEVICE_ID}/train_${ASCEND_DEVICE_ID}.log|grep 'words/sec'|tr -d 'k'|awk 'END {print 8*1000*$NF}'` #打印,不需要修改 echo "Final Performance images/sec : $FPS" #输出训练精度,需要模型审视修改 -train_accuracy=`grep train_accuracy $cur_path/output/${ASCEND_DEVICE_ID}/train_${ASCEND_DEVICE_ID}.log|awk 'END {print $8}'|cut -c 1-5` +bash inference.sh +bash scripts/process_output.sh ${data_path}/newstest2014.tok.de ${data_path}/output-0603 ${data_path}/vocab.share +perl ${data_path}/multi-bleu.perl ${data_path}/newstest2014.tok.de.forbleu < ${data_path}/output-0603.forbleu > result_bleu.txt +cat result_bleu.txt >> $cur_path/output/${ASCEND_DEVICE_ID}/train_${ASCEND_DEVICE_ID}.log +train_accuracy=`grep "BLEU" $cur_path/output/${ASCEND_DEVICE_ID}/train_${ASCEND_DEVICE_ID}.log|awk 'END {print $3}'|tr -d ','` #打印,不需要修改 echo "Final Train Accuracy : ${train_accuracy}" echo "E2E Training Duration sec : $e2e_time" @@ -209,7 +213,7 @@ echo "E2E Training Duration sec : $e2e_time" #训练用例信息,不需要修改 BatchSize=${batch_size} DeviceType=`uname -m` -CaseName=${Network}_bs${BatchSize}_${RANK_SIZE}'p'_'acc' +CaseName=${Network}${name_bind}_bs${BatchSize}_${RANK_SIZE}'p'_'acc' ##获取性能数据 #吞吐量,不需要修改 @@ -218,7 +222,7 @@ ActualFPS=${FPS} TrainingTime=`awk 'BEGIN{printf "%.2f\n",'${BatchSize}'*'${RANK_SIZE}'*1000/'${FPS}'}'` #从train_$ASCEND_DEVICE_ID.log提取Loss到train_${CaseName}_loss.txt中,需要根据模型审视 -grep train_loss $cur_path/output/$ASCEND_DEVICE_ID/train_$ASCEND_DEVICE_ID.log|grep -v BatchTimestamp|awk '{print $10}'|sed 's/,//g'|sed '/^$/d' >> $cur_path/output/$ASCEND_DEVICE_ID/train_${CaseName}_loss.txt +grep "INFO:tensorflow:" $cur_path/output/$ASCEND_DEVICE_ID/train_$ASCEND_DEVICE_ID.log|grep 'loss'|awk '{print $3}'|sed 's/,//g'|sed '/^$/d' >> $cur_path/output/$ASCEND_DEVICE_ID/train_${CaseName}_loss.txt #最后一个迭代loss值,不需要修改 ActualLoss=`awk 'END {print}' $cur_path/output/$ASCEND_DEVICE_ID/train_${CaseName}_loss.txt`