Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleRec
提交
7408da55
P
PaddleRec
项目概览
PaddlePaddle
/
PaddleRec
通知
68
Star
12
Fork
5
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
27
列表
看板
标记
里程碑
合并请求
10
Wiki
1
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleRec
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
27
Issue
27
列表
看板
标记
里程碑
合并请求
10
合并请求
10
Pages
分析
分析
仓库分析
DevOps
Wiki
1
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7408da55
编写于
4月 09, 2020
作者:
T
tangwei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix ctr trainer
上级
9368aec8
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
31 addition
and
33 deletion
+31
-33
trainer/ctr_trainer.py
trainer/ctr_trainer.py
+27
-28
trainer/transpiler_trainer.py
trainer/transpiler_trainer.py
+4
-5
未找到文件。
trainer/ctr_trainer.py
浏览文件 @
7408da55
...
...
@@ -12,28 +12,24 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import
abc
import
sys
import
copy
import
yaml
import
time
import
json
import
datetime
import
numpy
as
np
import
paddle.fluid
as
fluid
from
..
utils
import
fs
as
fs
from
..
utils
import
util
as
util
from
..
metrics
.
auc_metrics
import
AUCMetric
from
..
models
import
base
as
model_basic
from
..
reader
import
dataset
from
.
import
trainer
from
paddle.fluid.incubate.fleet.parameter_server.pslib
import
fleet
from
paddle.fluid.incubate.fleet.base.role_maker
import
GeneralRoleMaker
from
eleps.utils
import
fs
as
fs
from
eleps.utils
import
util
as
util
from
eleps.metrics.auc_metrics
import
AUCMetric
from
eleps.models
import
base
as
model_basic
from
eleps.reader
import
dataset
from
.trainer
import
Trainer
def
wroker_numric_opt
(
value
,
env
,
opt
):
"""
...
...
@@ -75,21 +71,24 @@ def worker_numric_max(value, env="mpi"):
return
wroker_numric_opt
(
value
,
env
,
"max"
)
class
CtrPaddleTrainer
(
trainer
.
Trainer
):
class
CtrPaddleTrainer
(
Trainer
):
"""R
"""
def
__init__
(
self
,
config
):
"""R
"""
trainer
.
Trainer
.
__init__
(
self
,
config
)
Trainer
.
__init__
(
self
,
config
)
config
[
'output_path'
]
=
util
.
get_absolute_path
(
config
[
'output_path'
],
config
[
'io'
][
'afs'
])
self
.
global_config
=
config
self
.
_place
=
fluid
.
CPUPlace
()
self
.
_exe
=
fluid
.
Executor
(
self
.
_place
)
self
.
_exector_context
=
{}
self
.
global_config
=
config
self
.
_metrics
=
{}
self
.
_path_generator
=
util
.
PathGenerator
({
'templates'
:
[
{
'name'
:
'xbox_base_done'
,
'template'
:
config
[
'output_path'
]
+
'/xbox_base_done.txt'
},
...
...
trainer/transpiler_trainer.py
浏览文件 @
7408da55
...
...
@@ -28,7 +28,6 @@ from ..utils import envs
class
TranspileTrainer
(
Trainer
):
def
__init__
(
self
,
config
=
None
):
Trainer
.
__init__
(
self
,
config
)
self
.
exe
=
fluid
.
Executor
(
fluid
.
CPUPlace
())
self
.
processor_register
()
self
.
inference_models
=
[]
...
...
@@ -87,9 +86,9 @@ class TranspileTrainer(Trainer):
dirname
=
os
.
path
.
join
(
dirname
,
str
(
epoch_id
))
if
is_fleet
:
fleet
.
save_inference_model
(
dirname
,
feed_varnames
,
fetch_vars
,
self
.
exe
)
fleet
.
save_inference_model
(
dirname
,
feed_varnames
,
fetch_vars
)
else
:
fluid
.
io
.
save_inference_model
(
dirname
,
feed_varnames
,
fetch_vars
,
self
.
exe
)
fluid
.
io
.
save_inference_model
(
dirname
,
feed_varnames
,
fetch_vars
,
self
.
_
exe
)
self
.
inference_models
.
append
((
epoch_id
,
dirname
))
def
save_persistables
():
...
...
@@ -104,9 +103,9 @@ class TranspileTrainer(Trainer):
dirname
=
os
.
path
.
join
(
dirname
,
str
(
epoch_id
))
if
is_fleet
:
fleet
.
save_persistables
(
self
.
exe
,
dirname
)
fleet
.
save_persistables
(
dirname
)
else
:
fluid
.
io
.
save_persistables
(
self
.
exe
,
dirname
)
fluid
.
io
.
save_persistables
(
self
.
_
exe
,
dirname
)
self
.
increment_models
.
append
((
epoch_id
,
dirname
))
save_persistables
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录