Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
8b70f0f3
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8b70f0f3
编写于
2月 13, 2017
作者:
Y
Yi Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
addrss
https://github.com/PaddlePaddle/Paddle/issues/1319
as well
上级
5a1f0617
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
12 addition
and
6 deletion
+12
-6
doc/design/api.md
doc/design/api.md
+12
-6
未找到文件。
doc/design/api.md
浏览文件 @
8b70f0f3
...
@@ -166,14 +166,19 @@ There are some open questions here:
...
@@ -166,14 +166,19 @@ There are some open questions here:
### Training
### Training
The recommended way to training a model is to call
`paddle.train`
,
The recommended way to training a model is to call
`paddle.train`
,
which simply calls
`paddle.
optimiz
er.Default`
, a global variable of
which simply calls
`paddle.
train
er.Default`
, a global variable of
type
`paddle.
optimiz
er.SGD`
. Equivalently, we can do
type
`paddle.
train
er.SGD`
. Equivalently, we can do
```
python
```
python
opt
=
paddle
.
optimizer
.
SGD
(...
)
opt
=
paddle
.
trainer
.
SGD
(...,
paddle
.
updater
.
Adam
(...)
)
opt
.
train
(
model
,
reader
=
read
,
...)
opt
.
train
(
model
,
reader
=
read
,
...)
```
```
Please be aware that a trainer requires an updater as its data
member. This is to make it easier to customize trainers, as
discussed
[
here
](
https://github.com/PaddlePaddle/Paddle/issues/1319
)
.
#### Distributed Training
#### Distributed Training
If users want to do distributed training on a cluster, s/he should
If users want to do distributed training on a cluster, s/he should
...
@@ -185,8 +190,9 @@ access a Kubernetes cluster, s/he should be able to call
...
@@ -185,8 +190,9 @@ access a Kubernetes cluster, s/he should be able to call
```
python
```
python
paddle
.
dist_train
(
model
,
paddle
.
dist_train
(
model
,
trainer
=
paddle
.
trainer
.
SGD
(...,
paddle
.
updater
.
Adam
(...)),
reader
=
read
,
reader
=
read
,
optimizer
=
paddle
.
optimizer
.
SGDOptimizer
(...),
k8s_user
=
"yi"
,
k8s_user
=
"yi"
,
k8s_token
=
"kube_cluster_tls.pem"
,
k8s_token
=
"kube_cluster_tls.pem"
,
k8s_job
=
"hello"
,
k8s_job
=
"hello"
,
...
@@ -196,7 +202,7 @@ paddle.dist_train(model,
...
@@ -196,7 +202,7 @@ paddle.dist_train(model,
The pseudo code if
`paddle.dist_train`
is as follows:
The pseudo code if
`paddle.dist_train`
is as follows:
```
python
```
python
def
dist_train
():
def
dist_train
(
topology
,
parameters
,
trainer
,
reader
,
...
):
if
os
.
getenv
(
"KUBERNETES_SERVICE_HOST"
)
==
None
:
if
os
.
getenv
(
"KUBERNETES_SERVICE_HOST"
)
==
None
:
image_name
=
k8s_user
+
'/'
+
k8s_job
image_name
=
k8s_user
+
'/'
+
k8s_job
docker_build
(
image_name
)
docker_build
(
image_name
)
...
@@ -209,7 +215,7 @@ def dist_train():
...
@@ -209,7 +215,7 @@ def dist_train():
elif
rank
<
15
:
elif
rank
<
15
:
parameter_server
()
parameter_server
()
else
:
else
:
optimiz
er
.
train
(
model
,
reader
=
read
)
train
er
.
train
(
model
,
reader
=
read
)
```
```
Please be aware that if a process is running on the Kubernetes
Please be aware that if a process is running on the Kubernetes
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录