Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleFL
提交
f6bcc2c6
P
PaddleFL
项目概览
PaddlePaddle
/
PaddleFL
通知
35
Star
5
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
6
列表
看板
标记
里程碑
合并请求
4
Wiki
3
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleFL
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
6
Issue
6
列表
看板
标记
里程碑
合并请求
4
合并请求
4
Pages
分析
分析
仓库分析
DevOps
Wiki
3
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f6bcc2c6
编写于
11月 29, 2019
作者:
Q
qjing666
浏览文件
操作
浏览文件
下载
差异文件
update
上级
404bffea
1640cae2
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
7 addition
and
15 deletion
+7
-15
paddle_fl/core/trainer/fl_trainer.py
paddle_fl/core/trainer/fl_trainer.py
+0
-10
paddle_fl/examples/ctr_demo/fl_master.py
paddle_fl/examples/ctr_demo/fl_master.py
+1
-1
paddle_fl/examples/ctr_demo/fl_scheduler.py
paddle_fl/examples/ctr_demo/fl_scheduler.py
+2
-2
paddle_fl/examples/ctr_demo/fl_trainer.py
paddle_fl/examples/ctr_demo/fl_trainer.py
+1
-1
paddle_fl/examples/ctr_demo/run.sh
paddle_fl/examples/ctr_demo/run.sh
+1
-1
paddle_fl/examples/femnist_demo/fl_master.py
paddle_fl/examples/femnist_demo/fl_master.py
+1
-0
paddle_fl/examples/femnist_demo/fl_trainer.py
paddle_fl/examples/femnist_demo/fl_trainer.py
+1
-0
未找到文件。
paddle_fl/core/trainer/fl_trainer.py
浏览文件 @
f6bcc2c6
...
...
@@ -13,13 +13,10 @@
# limitations under the License.
import
paddle.fluid
as
fluid
import
logging
<<<<<<<
HEAD
from
paddle_fl.core.scheduler.agent_master
import
FLWorkerAgent
=======
import
numpy
import
hmac
from
.diffiehellman.diffiehellman
import
DiffieHellman
>>>>>>>
3145
ed186544ac195bb957c22a638461d8e480bd
class
FLTrainerFactory
(
object
):
def
__init__
(
self
):
...
...
@@ -150,11 +147,6 @@ class FedAvgTrainer(FLTrainer):
self
.
exe
.
run
(
self
.
_send_program
)
self
.
cur_step
+=
1
return
loss
<<<<<<<
HEAD
=======
def
stop
(
self
):
return
False
class
SecAggTrainer
(
FLTrainer
):
...
...
@@ -205,8 +197,6 @@ class SecAggTrainer(FLTrainer):
self
.
_recv_program
=
job
.
_trainer_recv_program
self_step
=
job
.
_strategy
.
_inner_step
self
.
_param_name_list
=
job
.
_strategy
.
_param_name_list
>>>>>>>
3145
ed186544ac195bb957c22a638461d8e480bd
def
reset
(
self
):
self
.
cur_step
=
0
...
...
paddle_fl/examples/ctr_demo/fl_master.py
浏览文件 @
f6bcc2c6
...
...
@@ -47,5 +47,5 @@ strategy = build_strategy.create_fl_strategy()
endpoints
=
[
"127.0.0.1:8181"
]
output
=
"fl_job_config"
job_generator
.
generate_fl_job
(
strategy
,
server_endpoints
=
endpoints
,
worker_num
=
5
,
output
=
output
)
strategy
,
server_endpoints
=
endpoints
,
worker_num
=
2
,
output
=
output
)
# fl_job_config will be dispatched to workers
paddle_fl/examples/ctr_demo/fl_scheduler.py
浏览文件 @
f6bcc2c6
from
paddle_fl.core.scheduler.agent_master
import
FLScheduler
worker_num
=
5
worker_num
=
2
server_num
=
1
scheduler
=
FLScheduler
(
worker_num
,
server_num
)
scheduler
.
set_sample_worker_num
(
5
)
scheduler
.
set_sample_worker_num
(
worker_num
)
scheduler
.
init_env
()
print
(
"init env done."
)
scheduler
.
start_fl_training
()
paddle_fl/examples/ctr_demo/fl_trainer.py
浏览文件 @
f6bcc2c6
...
...
@@ -23,7 +23,6 @@ job._scheduler_ep = "127.0.0.1:9091"
trainer
=
FLTrainerFactory
().
create_fl_trainer
(
job
)
trainer
.
_current_ep
=
"127.0.0.1:{}"
.
format
(
9000
+
trainer_id
)
trainer
.
start
()
print
(
trainer
.
_scheduler_ep
,
trainer
.
_current_ep
)
output_folder
=
"fl_model"
step_i
=
0
...
...
@@ -38,3 +37,4 @@ while not trainer.stop():
step_i
+=
1
if
step_i
%
100
==
0
:
trainer
.
save_inference_program
(
output_folder
)
paddle_fl/examples/ctr_demo/run.sh
浏览文件 @
f6bcc2c6
...
...
@@ -6,7 +6,7 @@ python -u fl_scheduler.py > scheduler.log &
sleep
5
python
-u
fl_server.py
>
server0.log &
sleep
2
for
((
i
=
0
;
i<
5
;
i++
))
for
((
i
=
0
;
i<
2
;
i++
))
do
python
-u
fl_trainer.py
$i
>
trainer
$i
.log &
sleep
2
...
...
paddle_fl/examples/femnist_demo/fl_master.py
浏览文件 @
f6bcc2c6
...
...
@@ -13,6 +13,7 @@ class Model(object):
self
.
label
=
fluid
.
layers
.
data
(
name
=
'label'
,
shape
=
[
1
],
dtype
=
'int64'
)
self
.
conv_pool_1
=
fluid
.
nets
.
simple_img_conv_pool
(
input
=
self
.
inputs
,
num_filters
=
20
,
filter_size
=
5
,
pool_size
=
2
,
pool_stride
=
2
,
act
=
'relu'
)
self
.
conv_pool_2
=
fluid
.
nets
.
simple_img_conv_pool
(
input
=
self
.
conv_pool_1
,
num_filters
=
50
,
filter_size
=
5
,
pool_size
=
2
,
pool_stride
=
2
,
act
=
'relu'
)
self
.
predict
=
self
.
predict
=
fluid
.
layers
.
fc
(
input
=
self
.
conv_pool_2
,
size
=
62
,
act
=
'softmax'
)
self
.
cost
=
fluid
.
layers
.
cross_entropy
(
input
=
self
.
predict
,
label
=
self
.
label
)
self
.
accuracy
=
fluid
.
layers
.
accuracy
(
input
=
self
.
predict
,
label
=
self
.
label
)
...
...
paddle_fl/examples/femnist_demo/fl_trainer.py
浏览文件 @
f6bcc2c6
...
...
@@ -15,6 +15,7 @@ job_path = "fl_job_config"
job
=
FLRunTimeJob
()
job
.
load_trainer_job
(
job_path
,
trainer_id
)
job
.
_scheduler_ep
=
"127.0.0.1:9091"
print
(
job
.
_target_names
)
trainer
=
FLTrainerFactory
().
create_fl_trainer
(
job
)
trainer
.
_current_ep
=
"127.0.0.1:{}"
.
format
(
9000
+
trainer_id
)
trainer
.
start
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录