From c83dfde3cd0c5b5b2c472e432859613284d7020f Mon Sep 17 00:00:00 2001 From: tianshuo78520a <707759223@qq.com> Date: Tue, 30 May 2023 20:16:54 +0800 Subject: [PATCH 01/11] Test print --- python/paddle/hapi/callbacks.py | 1 + tools/check_api_approvals.sh | 21 +++++++++++++++++++++ tools/check_file_diff_approvals.sh | 6 ------ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/python/paddle/hapi/callbacks.py b/python/paddle/hapi/callbacks.py index 9619c65aa189ca..085381f99d8078 100644 --- a/python/paddle/hapi/callbacks.py +++ b/python/paddle/hapi/callbacks.py @@ -339,6 +339,7 @@ class ProgBarLogger(Callback): callback = paddle.callbacks.ProgBarLogger(log_freq=10) model.fit(train_dataset, batch_size=64, callbacks=callback) + print(1111) """ def __init__(self, log_freq=1, verbose=2): diff --git a/tools/check_api_approvals.sh b/tools/check_api_approvals.sh index 36449fd1444a59..4f6764bb9bdc42 100644 --- a/tools/check_api_approvals.sh +++ b/tools/check_api_approvals.sh @@ -116,6 +116,27 @@ if [ "${ADDED_OP_USE_DEFAULT_GRAD_MAKER}" != "" ]; then check_approval 1 6888866 7913861 fi +OUTPUT_LOG=`git diff -U0 upstream/$BRANCH |grep "^+" | grep -Ew "print|printf|fprintf|std::cout" || true` +if [ "$OUTPUT_LOG" != "" ];then + git diff -U0 upstream/$BRANCH |grep "^+" | grep -Ew "print|printf|fprintf|std::cout"|sed 's#[ ][ ]##g'|sed 's#+##g' >/tmp/print.txt + samplecode=`find samplecode_temp -type f || true` + sample_status=0 + if [ "$samplecode" != "" ];then + cat `find samplecode_temp -type f` >/tmp/samplecode.txt + sed -i s#\"#\'#g /tmp/samplecode.txt + while read line + do + code_in=`grep "$line" /tmp/samplecode.txt || true` + if [ "$code_in" == "" ];then + sample_status=1 + fi + done Date: Tue, 30 May 2023 20:18:02 +0800 Subject: [PATCH 02/11] test=document_fix --- tools/check_api_approvals.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/check_api_approvals.sh b/tools/check_api_approvals.sh index 4f6764bb9bdc42..85990e7d8154ff 100644 --- a/tools/check_api_approvals.sh +++ b/tools/check_api_approvals.sh @@ -116,7 +116,7 @@ if [ "${ADDED_OP_USE_DEFAULT_GRAD_MAKER}" != "" ]; then check_approval 1 6888866 7913861 fi -OUTPUT_LOG=`git diff -U0 upstream/$BRANCH |grep "^+" | grep -Ew "print|printf|fprintf|std::cout" || true` +OUTPUT_LOG=`git diff -U0 upstream/$BRANCH | grep "^+" | grep -Ew "print|printf|fprintf|std::cout" || true` if [ "$OUTPUT_LOG" != "" ];then git diff -U0 upstream/$BRANCH |grep "^+" | grep -Ew "print|printf|fprintf|std::cout"|sed 's#[ ][ ]##g'|sed 's#+##g' >/tmp/print.txt samplecode=`find samplecode_temp -type f || true` From 67eeab8fab04bdb0141b513ae4096231e06c6eaf Mon Sep 17 00:00:00 2001 From: tianshuo78520a <707759223@qq.com> Date: Wed, 31 May 2023 10:53:17 +0800 Subject: [PATCH 03/11] test=document_fix --- python/paddle/hapi/callbacks.py | 1 - tools/check_api_approvals.sh | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python/paddle/hapi/callbacks.py b/python/paddle/hapi/callbacks.py index 085381f99d8078..9619c65aa189ca 100644 --- a/python/paddle/hapi/callbacks.py +++ b/python/paddle/hapi/callbacks.py @@ -339,7 +339,6 @@ class ProgBarLogger(Callback): callback = paddle.callbacks.ProgBarLogger(log_freq=10) model.fit(train_dataset, batch_size=64, callbacks=callback) - print(1111) """ def __init__(self, log_freq=1, verbose=2): diff --git a/tools/check_api_approvals.sh b/tools/check_api_approvals.sh index 85990e7d8154ff..f58c0eb103335c 100644 --- a/tools/check_api_approvals.sh +++ b/tools/check_api_approvals.sh @@ -116,7 +116,8 @@ if [ "${ADDED_OP_USE_DEFAULT_GRAD_MAKER}" != "" ]; then check_approval 1 6888866 7913861 fi -OUTPUT_LOG=`git diff -U0 upstream/$BRANCH | grep "^+" | grep -Ew "print|printf|fprintf|std::cout" || true` +#OUTPUT_LOG=`git diff -U0 upstream/$BRANCH | grep "^+" | grep -Ew "print|printf|fprintf|std::cout" || true` +OUTPUT_LOG=`git diff -U0 upstream/$BRANCH python/paddle/hapi | grep "^+" | grep -Ew "print|printf|fprintf|std::cout" || true` if [ "$OUTPUT_LOG" != "" ];then git diff -U0 upstream/$BRANCH |grep "^+" | grep -Ew "print|printf|fprintf|std::cout"|sed 's#[ ][ ]##g'|sed 's#+##g' >/tmp/print.txt samplecode=`find samplecode_temp -type f || true` From 3128e347ef1fa80e46461ef899c890897ecb9110 Mon Sep 17 00:00:00 2001 From: tianshuo78520a <707759223@qq.com> Date: Wed, 31 May 2023 14:07:45 +0800 Subject: [PATCH 04/11] test=document_fix --- python/paddle/hapi/dynamic_flops.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/paddle/hapi/dynamic_flops.py b/python/paddle/hapi/dynamic_flops.py index e5be25ac2686f0..2d3864cceb6e95 100644 --- a/python/paddle/hapi/dynamic_flops.py +++ b/python/paddle/hapi/dynamic_flops.py @@ -102,6 +102,7 @@ def count_leaky_relu(m, x, y): #| linear_2 | [1, 84] | [1, 10] | 850 | 840 | #+--------------+-----------------+-----------------+--------+--------+ #Total Flops: 347560 Total Params: 61610 + print(111) """ if isinstance(net, nn.Layer): # If net is a dy2stat model, net.forward is StaticFunction instance, From e8b774b4d6001bbecd76f0c9663d1a843acd1b7f Mon Sep 17 00:00:00 2001 From: tianshuo78520a <707759223@qq.com> Date: Wed, 31 May 2023 15:30:28 +0800 Subject: [PATCH 05/11] test=document_fix --- paddle/scripts/paddle_build.sh | 4 ++-- tools/check_api_approvals.sh | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/paddle/scripts/paddle_build.sh b/paddle/scripts/paddle_build.sh index 2dd6ddd550a4bf..2a8bc0a493238f 100644 --- a/paddle/scripts/paddle_build.sh +++ b/paddle/scripts/paddle_build.sh @@ -3134,10 +3134,10 @@ function exec_samplecode_test() { cd ${PADDLE_ROOT}/tools if [ "$1" = "cpu" ] ; then - python sampcd_processor.py cpu; example_error=$? + python sampcd_processor.py --debug cpu; example_error=$? elif [ "$1" = "gpu" ] ; then SAMPLE_CODE_EXEC_THREADS=${SAMPLE_CODE_EXEC_THREADS:-2} - python sampcd_processor.py --threads=${SAMPLE_CODE_EXEC_THREADS} gpu; example_error=$? + python sampcd_processor.py --threads=${SAMPLE_CODE_EXEC_THREADS} --debug gpu; example_error=$? fi if [ "$example_error" != "0" ];then echo "Code instance execution failed" >&2 diff --git a/tools/check_api_approvals.sh b/tools/check_api_approvals.sh index f58c0eb103335c..66aee4b480ce85 100644 --- a/tools/check_api_approvals.sh +++ b/tools/check_api_approvals.sh @@ -130,6 +130,7 @@ if [ "$OUTPUT_LOG" != "" ];then code_in=`grep "$line" /tmp/samplecode.txt || true` if [ "$code_in" == "" ];then sample_status=1 + echo "Use print to: $line" fi done Date: Thu, 1 Jun 2023 06:18:54 +0000 Subject: [PATCH 06/11] test=document_fix --- tools/check_api_approvals.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/check_api_approvals.sh b/tools/check_api_approvals.sh index 66aee4b480ce85..8de600ec15fbb8 100644 --- a/tools/check_api_approvals.sh +++ b/tools/check_api_approvals.sh @@ -120,10 +120,10 @@ fi OUTPUT_LOG=`git diff -U0 upstream/$BRANCH python/paddle/hapi | grep "^+" | grep -Ew "print|printf|fprintf|std::cout" || true` if [ "$OUTPUT_LOG" != "" ];then git diff -U0 upstream/$BRANCH |grep "^+" | grep -Ew "print|printf|fprintf|std::cout"|sed 's#[ ][ ]##g'|sed 's#+##g' >/tmp/print.txt - samplecode=`find samplecode_temp -type f || true` + samplecode=`find tools/samplecode_temp -type f || true` sample_status=0 if [ "$samplecode" != "" ];then - cat `find samplecode_temp -type f` >/tmp/samplecode.txt + cat `find tools/samplecode_temp -type f` >/tmp/samplecode.txt sed -i s#\"#\'#g /tmp/samplecode.txt while read line do From 687d036d1dcc6ac865ffb2231c308b1a5f1d0b8a Mon Sep 17 00:00:00 2001 From: tianshuo78520a <707759223@qq.com> Date: Thu, 1 Jun 2023 08:59:25 +0000 Subject: [PATCH 07/11] test=document_fix --- paddle/scripts/paddle_build.sh | 4 ++-- tools/check_api_approvals.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/paddle/scripts/paddle_build.sh b/paddle/scripts/paddle_build.sh index 2a8bc0a493238f..722ebdba2a1fd1 100644 --- a/paddle/scripts/paddle_build.sh +++ b/paddle/scripts/paddle_build.sh @@ -3124,10 +3124,10 @@ function build_document_preview() { # origin name: example function exec_samplecode_test() { if [ -d "${PADDLE_ROOT}/build/pr_whl" ];then - pip install ${PADDLE_ROOT}/build/pr_whl/*.whl --force-reinstall + pip install ${PADDLE_ROOT}/build/pr_whl/*.whl else echo "WARNING: PR wheel is not found. Use develop wheel !!!" - pip install ${PADDLE_ROOT}/build/python/dist/*.whl --force-reinstall + pip install ${PADDLE_ROOT}/build/python/dist/*.whl fi python -c "import paddle;print(paddle.__version__);paddle.version.show()" diff --git a/tools/check_api_approvals.sh b/tools/check_api_approvals.sh index 8de600ec15fbb8..a21d396ab8c4d4 100644 --- a/tools/check_api_approvals.sh +++ b/tools/check_api_approvals.sh @@ -119,7 +119,7 @@ fi #OUTPUT_LOG=`git diff -U0 upstream/$BRANCH | grep "^+" | grep -Ew "print|printf|fprintf|std::cout" || true` OUTPUT_LOG=`git diff -U0 upstream/$BRANCH python/paddle/hapi | grep "^+" | grep -Ew "print|printf|fprintf|std::cout" || true` if [ "$OUTPUT_LOG" != "" ];then - git diff -U0 upstream/$BRANCH |grep "^+" | grep -Ew "print|printf|fprintf|std::cout"|sed 's#[ ][ ]##g'|sed 's#+##g' >/tmp/print.txt + git diff -U0 upstream/$BRANCH python/paddle/hapi |grep "^+" | grep -Ew "print|printf|fprintf|std::cout"|sed 's#[ ][ ]##g'|sed 's#+##g' >/tmp/print.txt samplecode=`find tools/samplecode_temp -type f || true` sample_status=0 if [ "$samplecode" != "" ];then @@ -128,7 +128,7 @@ if [ "$OUTPUT_LOG" != "" ];then while read line do code_in=`grep "$line" /tmp/samplecode.txt || true` - if [ "$code_in" == "" ];then + if [ "$code_in" != "" ];then sample_status=1 echo "Use print to: $line" fi From 085306fd906e792bc9e1c5bb0712d86ebda15649 Mon Sep 17 00:00:00 2001 From: tianshuo78520a <707759223@qq.com> Date: Thu, 1 Jun 2023 09:15:35 +0000 Subject: [PATCH 08/11] test=document_fix --- python/paddle/hapi/dynamic_flops.py | 2 +- tools/check_api_approvals.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python/paddle/hapi/dynamic_flops.py b/python/paddle/hapi/dynamic_flops.py index 2d3864cceb6e95..f1c61ef4d7fbc6 100644 --- a/python/paddle/hapi/dynamic_flops.py +++ b/python/paddle/hapi/dynamic_flops.py @@ -102,9 +102,9 @@ def count_leaky_relu(m, x, y): #| linear_2 | [1, 84] | [1, 10] | 850 | 840 | #+--------------+-----------------+-----------------+--------+--------+ #Total Flops: 347560 Total Params: 61610 - print(111) """ if isinstance(net, nn.Layer): + print(1111) # If net is a dy2stat model, net.forward is StaticFunction instance, # we set net.forward to original forward function. _, net.forward = unwrap_decorators(net.forward) diff --git a/tools/check_api_approvals.sh b/tools/check_api_approvals.sh index a21d396ab8c4d4..0a3521f296be52 100644 --- a/tools/check_api_approvals.sh +++ b/tools/check_api_approvals.sh @@ -128,7 +128,7 @@ if [ "$OUTPUT_LOG" != "" ];then while read line do code_in=`grep "$line" /tmp/samplecode.txt || true` - if [ "$code_in" != "" ];then + if [ "$code_in" == "" ];then sample_status=1 echo "Use print to: $line" fi From 8795fa186ee8e8e2b3697db853bb5b4a00e1b420 Mon Sep 17 00:00:00 2001 From: tianshuo78520a <707759223@qq.com> Date: Fri, 2 Jun 2023 01:53:45 +0000 Subject: [PATCH 09/11] test=document_fix --- python/paddle/hapi/dynamic_flops.py | 2 +- tools/check_api_approvals.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python/paddle/hapi/dynamic_flops.py b/python/paddle/hapi/dynamic_flops.py index f1c61ef4d7fbc6..fe8310b872c5b7 100644 --- a/python/paddle/hapi/dynamic_flops.py +++ b/python/paddle/hapi/dynamic_flops.py @@ -87,6 +87,7 @@ def count_leaky_relu(m, x, y): FLOPs = paddle.flops(lenet, [1, 1, 28, 28], custom_ops= {nn.LeakyReLU: count_leaky_relu}, print_detail=True) print(FLOPs) + print(1111) #+--------------+-----------------+-----------------+--------+--------+ #| Layer Name | Input Shape | Output Shape | Params | Flops | @@ -104,7 +105,6 @@ def count_leaky_relu(m, x, y): #Total Flops: 347560 Total Params: 61610 """ if isinstance(net, nn.Layer): - print(1111) # If net is a dy2stat model, net.forward is StaticFunction instance, # we set net.forward to original forward function. _, net.forward = unwrap_decorators(net.forward) diff --git a/tools/check_api_approvals.sh b/tools/check_api_approvals.sh index 0a3521f296be52..4e00b5d9238b7e 100644 --- a/tools/check_api_approvals.sh +++ b/tools/check_api_approvals.sh @@ -130,10 +130,10 @@ if [ "$OUTPUT_LOG" != "" ];then code_in=`grep "$line" /tmp/samplecode.txt || true` if [ "$code_in" == "" ];then sample_status=1 - echo "Use print to: $line" fi done Date: Fri, 2 Jun 2023 12:02:49 +0000 Subject: [PATCH 10/11] fix log --- python/paddle/hapi/dynamic_flops.py | 1 - tools/check_api_approvals.sh | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/python/paddle/hapi/dynamic_flops.py b/python/paddle/hapi/dynamic_flops.py index fe8310b872c5b7..e5be25ac2686f0 100644 --- a/python/paddle/hapi/dynamic_flops.py +++ b/python/paddle/hapi/dynamic_flops.py @@ -87,7 +87,6 @@ def count_leaky_relu(m, x, y): FLOPs = paddle.flops(lenet, [1, 1, 28, 28], custom_ops= {nn.LeakyReLU: count_leaky_relu}, print_detail=True) print(FLOPs) - print(1111) #+--------------+-----------------+-----------------+--------+--------+ #| Layer Name | Input Shape | Output Shape | Params | Flops | diff --git a/tools/check_api_approvals.sh b/tools/check_api_approvals.sh index 4e00b5d9238b7e..cb0df8ffdfc499 100644 --- a/tools/check_api_approvals.sh +++ b/tools/check_api_approvals.sh @@ -116,10 +116,9 @@ if [ "${ADDED_OP_USE_DEFAULT_GRAD_MAKER}" != "" ]; then check_approval 1 6888866 7913861 fi -#OUTPUT_LOG=`git diff -U0 upstream/$BRANCH | grep "^+" | grep -Ew "print|printf|fprintf|std::cout" || true` -OUTPUT_LOG=`git diff -U0 upstream/$BRANCH python/paddle/hapi | grep "^+" | grep -Ew "print|printf|fprintf|std::cout" || true` +OUTPUT_LOG=`git diff -U0 upstream/$BRANCH | grep "^+" | grep -Ew "print|printf|fprintf|std::cout" || true` if [ "$OUTPUT_LOG" != "" ];then - git diff -U0 upstream/$BRANCH python/paddle/hapi |grep "^+" | grep -Ew "print|printf|fprintf|std::cout"|sed 's#[ ][ ]##g'|sed 's#+##g' >/tmp/print.txt + git diff -U0 upstream/$BRANCH |grep "^+" | grep -Ew "print|printf|fprintf|std::cout"|sed 's#[ ][ ]##g'|sed 's#+##g' >/tmp/print.txt samplecode=`find tools/samplecode_temp -type f || true` sample_status=0 if [ "$samplecode" != "" ];then @@ -133,7 +132,6 @@ if [ "$OUTPUT_LOG" != "" ];then fi done Date: Fri, 2 Jun 2023 12:03:54 +0000 Subject: [PATCH 11/11] test=document_fix --- tools/check_api_approvals.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/check_api_approvals.sh b/tools/check_api_approvals.sh index cb0df8ffdfc499..55c348365e107a 100644 --- a/tools/check_api_approvals.sh +++ b/tools/check_api_approvals.sh @@ -132,6 +132,7 @@ if [ "$OUTPUT_LOG" != "" ];then fi done