Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
5157ba69
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
5157ba69
编写于
6月 28, 2017
作者:
H
Helin Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
create save model design doc
上级
9a41f829
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
100 addition
and
0 deletion
+100
-0
doc/design/cluster_train/save_model.md
doc/design/cluster_train/save_model.md
+100
-0
未找到文件。
doc/design/cluster_train/save_model.md
0 → 100644
浏览文件 @
5157ba69
# Design Doc: Save Model
## Overview
The model is the output of the training process. There are two
ways from which user can obtain a model:
-
Save model triggered by user code: user code asks PaddlePaddle to
save a model.
-
Convert model from the snapshot: model being converted from
pservers' periodic snapshot. In this way, the user can cancel a job
at any time, and still have a relatively fresh model (we snapshot
around every 5 minutes).
### Save Model Triggered by User Code
Both trainers and pservers have access to the model. So the model can
be saved from a trainer or pservers. We need to decide on where the
model is saved from.
#### Dense Model vs. Sparse Model
There are two types of model: dense and sparse model (when the
parameter is configured to be sparse). Pservers always jointly have
the entire model at any given time. Trainers only have the entire
dense model, but only have a fraction of the sparse model at any given
time.
#### Pservers Saving Model
The benefit of letting pservers save model is they have the entire
model all the time. However, since pservers are on different nodes, it
requires a merging process to merge model shards into the same
model. Thus requires the pservers to write models to a distributed
filesystem, making the snapshot shards visible to the merge program.
#### Trainer Saving Model
The benefit of letting one trainer to save the model is it does not
require a distributed filesystem. And it's reusing the same save model
logic when the trainer is training locally - except when training
sparse model, the trainer needs to download the entire sparse model
during the saving process.
#### Conclusion
Given trainer saving model does not require a distributed filesystem,
and is an intuitive extension to training locally, we decide to let
the trainer save the model.
### Convert Model from Snapshot
TODO
## Timeline
We first implement trainer save the model. Converting the latest
snapshot to a model will be a TODO for future.
## Trainer Save Model
### Trainer Election
One trainer will be elected as the one to save the model. When using
etcd, trainer ID is a randomly generated UUID, we will utilize etcd to
elect one trainer. When not using etcd, unique trainer IDs will be
given by the administrator, the trainer whose ID is "0" is elected to
save the model.
### Model Save Path
Each trainer will be given the directory to save the model. The
elected trainer will save the model to
`given-directory/trainerID`
. Since the tainerID is unique, this would
prevent concurrent save to the same file when multiple trainers are
elected to save the model when split-brain problem happens.
### What Happens When Model Is Saving
It takes some time to save model, we need to define what will happen
when save model is taking place.
When saving a dense model, the trainer uses the local model. Pservers
does not need to pause model update.
When saving a sparse model. The trainer needs to download the entire
sparse model while saving. To get the most accurate model, the model
update needs to be paused before the download starts and resumed after
the download finishes. Otherwise, the trainer gets a model that is
"polluted": some part of the model is old, some part of the model is
new.
It's unclear that the "polluted" model will be inferiod due to the
stochastic nature of deep learning, and pausing the model update will
add more complexity to the system. Since supporting sparse model is a
TODO item. We defer the evaluation of pause the model update or not
during saving model to the future.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录