From afe74b5dbd9c56d6988ad43fc8a36bf8383a188c Mon Sep 17 00:00:00 2001 From: heya02 Date: Tue, 28 Jul 2020 03:07:55 +0000 Subject: [PATCH] update run.sh and limit the epoch to train --- .../paddle_fl/examples/ctr_demo/fl_trainer.py | 6 ++++-- python/paddle_fl/paddle_fl/examples/ctr_demo/run.sh | 10 ++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/python/paddle_fl/paddle_fl/examples/ctr_demo/fl_trainer.py b/python/paddle_fl/paddle_fl/examples/ctr_demo/fl_trainer.py index 955b9cd..3f3ce48 100644 --- a/python/paddle_fl/paddle_fl/examples/ctr_demo/fl_trainer.py +++ b/python/paddle_fl/paddle_fl/examples/ctr_demo/fl_trainer.py @@ -44,11 +44,13 @@ trainer = FLTrainerFactory().create_fl_trainer(job) trainer._current_ep = "127.0.0.1:{}".format(9000 + trainer_id) place = fluid.CPUPlace() trainer.start(place) -print(trainer._scheduler_ep, trainer._current_ep) +print("scheduler_ep is {}, current_ep is {}".format(trainer._scheduler_ep, trainer._current_ep)) output_folder = "fl_model" epoch_id = 0 while not trainer.stop(): - print("batch %d start train" % (epoch_id)) + if epoch_id > 15: + break + print("{} epoch {} start train".format(time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())), epoch_id)) train_step = 0 for data in reader(): trainer.run(feed=data, fetch=[]) diff --git a/python/paddle_fl/paddle_fl/examples/ctr_demo/run.sh b/python/paddle_fl/paddle_fl/examples/ctr_demo/run.sh index e740110..a3c3422 100644 --- a/python/paddle_fl/paddle_fl/examples/ctr_demo/run.sh +++ b/python/paddle_fl/paddle_fl/examples/ctr_demo/run.sh @@ -1,14 +1,16 @@ unset http_proxy unset https_proxy -python fl_master.py +log_dir=${1:-$(pwd)} +mkdir -p ${log_dir} +python fl_master.py > ${log_dir}/master.log 2>&1 & sleep 2 -python -u fl_scheduler.py > scheduler.log & +python -u fl_scheduler.py > ${log_dir}/scheduler.log 2>&1 & sleep 5 -python -u fl_server.py >server0.log & +python -u fl_server.py > ${log_dir}/server0.log 2>&1 & sleep 2 for ((i=0;i<2;i++)) do - python -u fl_trainer.py $i >trainer$i.log & + python -u fl_trainer.py $i > ${log_dir}/trainer$i.log 2>&1 & sleep 2 done -- GitLab