提交 58b67c6f 编写于 作者: H hysunflower 提交者: Jinhua Liang

Add profiler maxiter seq2seq (#3938)

* add_profiler_maxiter_seq2seq

* add_profiler_maxiter_seq2seq
上级 eee28b3e
......@@ -122,6 +122,16 @@ def parse_args():
parser.add_argument(
"--profile", action='store_true', help="Whether enable the profile.")
# NOTE: profiler args, used for benchmark
parser.add_argument(
"--is_profiler",
type=int,
default=0,
help="The switch of profiler tools. (used for benchmark)")
parser.add_argument(
"--profiler_path",
type=str,
default='./',
help="the profiler output file path. (used for benchmark)")
args = parser.parse_args()
return args
......@@ -27,6 +27,7 @@ import contextlib
import paddle
import paddle.fluid as fluid
from paddle.fluid import profiler
import paddle.fluid.framework as framework
import paddle.fluid.profiler as profiler
from paddle.fluid.executor import Executor
......@@ -213,6 +214,13 @@ def main():
ce_ppl.append(np.exp(total_loss / word_count))
total_loss = 0.0
word_count = 0.0
# profiler tools
if args.is_profiler and epoch_id == 0 and batch_id == 100:
profiler.start_profiler("All")
elif args.is_profiler and epoch_id == 0 and batch_id == 105:
profiler.stop_profiler("total", args.profiler_path)
return
end_time = time.time()
epoch_time = end_time - start_time
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册