Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleFL
提交
ea1b56ab
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看板
未验证
提交
ea1b56ab
编写于
1月 08, 2020
作者:
D
Dong Daxiang
提交者:
GitHub
1月 08, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #31 from qjing666/scheduler_bug_fix
Fix the zmq bug in python3
上级
662b3c42
8ed6a47b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
21 addition
and
20 deletion
+21
-20
docs/requirements.txt
docs/requirements.txt
+1
-0
paddle_fl/core/scheduler/agent_master.py
paddle_fl/core/scheduler/agent_master.py
+14
-14
paddle_fl/core/trainer/diffiehellman/diffiehellman.py
paddle_fl/core/trainer/diffiehellman/diffiehellman.py
+3
-3
paddle_fl/core/trainer/fl_trainer.py
paddle_fl/core/trainer/fl_trainer.py
+1
-1
paddle_fl/version.py
paddle_fl/version.py
+2
-2
未找到文件。
docs/requirements.txt
浏览文件 @
ea1b56ab
...
...
@@ -2,3 +2,4 @@ sphinx==2.1.0
mistune
sphinx_rtd_theme
paddlepaddle>=1.6
zmq
paddle_fl/core/scheduler/agent_master.py
浏览文件 @
ea1b56ab
...
...
@@ -4,7 +4,7 @@ import random
def
recv_and_parse_kv
(
socket
):
message
=
socket
.
recv
()
group
=
message
.
split
(
"
\t
"
)
group
=
message
.
decode
().
split
(
"
\t
"
)
if
group
[
0
]
==
"alive"
:
return
group
[
0
],
"0"
else
:
...
...
@@ -23,9 +23,9 @@ class FLServerAgent(object):
def
connect_scheduler
(
self
):
while
True
:
self
.
socket
.
send
(
"SERVER_EP
\t
{}"
.
format
(
self
.
current_ep
))
self
.
socket
.
send
_string
(
"SERVER_EP
\t
{}"
.
format
(
self
.
current_ep
))
message
=
self
.
socket
.
recv
()
group
=
message
.
split
(
"
\t
"
)
group
=
message
.
decode
().
split
(
"
\t
"
)
if
group
[
0
]
==
'INIT'
:
break
...
...
@@ -39,14 +39,14 @@ class FLWorkerAgent(object):
def
connect_scheduler
(
self
):
while
True
:
self
.
socket
.
send
(
"WORKER_EP
\t
{}"
.
format
(
self
.
current_ep
))
self
.
socket
.
send
_string
(
"WORKER_EP
\t
{}"
.
format
(
self
.
current_ep
))
message
=
self
.
socket
.
recv
()
group
=
message
.
split
(
"
\t
"
)
group
=
message
.
decode
().
split
(
"
\t
"
)
if
group
[
0
]
==
'INIT'
:
break
def
finish_training
(
self
):
self
.
socket
.
send
(
"FINISH
\t
{}"
.
format
(
self
.
current_ep
))
self
.
socket
.
send
_string
(
"FINISH
\t
{}"
.
format
(
self
.
current_ep
))
key
,
value
=
recv_and_parse_kv
(
self
.
socket
)
if
key
==
"WAIT"
:
time
.
sleep
(
3
)
...
...
@@ -54,7 +54,7 @@ class FLWorkerAgent(object):
return
False
def
can_join_training
(
self
):
self
.
socket
.
send
(
"JOIN
\t
{}"
.
format
(
self
.
current_ep
))
self
.
socket
.
send
_string
(
"JOIN
\t
{}"
.
format
(
self
.
current_ep
))
key
,
value
=
recv_and_parse_kv
(
self
.
socket
)
if
key
==
"ACCEPT"
:
...
...
@@ -91,13 +91,13 @@ class FLScheduler(object):
key
,
value
=
recv_and_parse_kv
(
self
.
socket
)
if
key
==
WORKER_EP
:
self
.
fl_workers
.
append
(
value
)
self
.
socket
.
send
(
"INIT
\t
{}"
.
format
(
value
))
self
.
socket
.
send
_string
(
"INIT
\t
{}"
.
format
(
value
))
elif
key
==
SERVER_EP
:
self
.
fl_servers
.
append
(
value
)
self
.
socket
.
send
(
"INIT
\t
{}"
.
format
(
value
))
self
.
socket
.
send
_string
(
"INIT
\t
{}"
.
format
(
value
))
else
:
time
.
sleep
(
3
)
self
.
socket
.
send
(
"REJECT
\t
0"
)
self
.
socket
.
send
_string
(
"REJECT
\t
0"
)
if
len
(
self
.
fl_workers
)
==
self
.
worker_num
and
\
len
(
self
.
fl_servers
)
==
self
.
server_num
:
ready
=
True
...
...
@@ -122,12 +122,12 @@ class FLScheduler(object):
if
worker_dict
[
value
]
==
0
:
ready_workers
.
append
(
value
)
worker_dict
[
value
]
=
1
self
.
socket
.
send
(
"ACCEPT
\t
0"
)
self
.
socket
.
send
_string
(
"ACCEPT
\t
0"
)
continue
else
:
if
value
not
in
ready_workers
:
ready_workers
.
append
(
value
)
self
.
socket
.
send
(
"REJECT
\t
0"
)
self
.
socket
.
send
_string
(
"REJECT
\t
0"
)
if
len
(
ready_workers
)
==
len
(
self
.
fl_workers
):
all_ready_to_train
=
True
...
...
@@ -137,9 +137,9 @@ class FLScheduler(object):
key
,
value
=
recv_and_parse_kv
(
self
.
socket
)
if
key
==
"FINISH"
:
finish_training_dict
[
value
]
=
1
self
.
socket
.
send
(
"WAIT
\t
0"
)
self
.
socket
.
send
_string
(
"WAIT
\t
0"
)
else
:
self
.
socket
.
send
(
"REJECT
\t
0"
)
self
.
socket
.
send
_string
(
"REJECT
\t
0"
)
if
len
(
finish_training_dict
)
==
len
(
worker_dict
):
all_finish_training
=
True
time
.
sleep
(
5
)
...
...
paddle_fl/core/trainer/diffiehellman/diffiehellman.py
浏览文件 @
ea1b56ab
...
...
@@ -42,9 +42,9 @@ try:
from
ssl
import
RAND_bytes
rng
=
RAND_bytes
except
(
AttributeError
,
ImportError
):
raise
RNGError
#python2
#rng = os.urandom
#python2
rng
=
os
.
urandom
#raise RNGError
class
DiffieHellman
:
"""
...
...
paddle_fl/core/trainer/fl_trainer.py
浏览文件 @
ea1b56ab
...
...
@@ -16,7 +16,7 @@ import logging
from
paddle_fl.core.scheduler.agent_master
import
FLWorkerAgent
import
numpy
import
hmac
#
from .diffiehellman.diffiehellman import DiffieHellman
from
.diffiehellman.diffiehellman
import
DiffieHellman
class
FLTrainerFactory
(
object
):
def
__init__
(
self
):
...
...
paddle_fl/version.py
浏览文件 @
ea1b56ab
...
...
@@ -12,5 +12,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
""" PaddleFL version string """
fl_version
=
"0.1.
3
"
module_proto_version
=
"0.1.
3
"
fl_version
=
"0.1.
5
"
module_proto_version
=
"0.1.
5
"
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录