Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleRec
提交
5590948a
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看板
提交
5590948a
编写于
3月 31, 2020
作者:
T
tangwei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add copyright
上级
aa5a08e0
变更
20
显示空白变更内容
内联
并排
Showing
20 changed file
with
336 addition
and
24 deletion
+336
-24
__init__.py
__init__.py
+13
-0
metrics/auc_metrics.py
metrics/auc_metrics.py
+13
-0
metrics/base.py
metrics/base.py
+14
-3
models/__init__.py
models/__init__.py
+13
-0
models/base.py
models/base.py
+14
-3
models/ctr_dnn/model.py
models/ctr_dnn/model.py
+14
-0
models/ctr_dnn/reader.py
models/ctr_dnn/reader.py
+13
-0
models/layers.py
models/layers.py
+14
-0
reader/__init__.py
reader/__init__.py
+13
-0
reader/data_loader.py
reader/data_loader.py
+13
-0
reader/dataset.py
reader/dataset.py
+14
-3
trainer/cluster_training_local.py
trainer/cluster_training_local.py
+77
-0
trainer/cluster_training_offline.py
trainer/cluster_training_offline.py
+13
-0
trainer/ctr_trainer.py
trainer/ctr_trainer.py
+14
-3
trainer/trainer.py
trainer/trainer.py
+14
-3
utils/__init__.py
utils/__init__.py
+13
-0
utils/envs.py
utils/envs.py
+15
-0
utils/fs.py
utils/fs.py
+14
-3
utils/table.py
utils/table.py
+14
-3
utils/util.py
utils/util.py
+14
-3
未找到文件。
__init__.py
浏览文件 @
5590948a
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
metrics/auc_metrics.py
浏览文件 @
5590948a
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
math
import
math
import
numpy
as
np
import
numpy
as
np
...
...
metrics/base.py
浏览文件 @
5590948a
"""
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
Do metric jobs. calculate AUC, MSE, COCP ...
#
"""
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
abc
import
abc
...
...
models/__init__.py
浏览文件 @
5590948a
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
models/base.py
浏览文件 @
5590948a
"""
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
Model Net: analyse layer config, and parse to Paddle Pragram
#
"""
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
abc
import
abc
import
copy
import
copy
import
yaml
import
yaml
...
...
models/ctr_dnn/model.py
浏览文件 @
5590948a
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
math
import
math
import
paddle.fluid
as
fluid
import
paddle.fluid
as
fluid
...
...
models/ctr_dnn/reader.py
浏览文件 @
5590948a
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
...utils
import
envs
from
...utils
import
envs
...
...
models/layers.py
浏览文件 @
5590948a
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
paddle.fluid
as
fluid
import
paddle.fluid
as
fluid
from
.base
import
Layer
from
.base
import
Layer
...
...
reader/__init__.py
浏览文件 @
5590948a
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
reader/data_loader.py
浏览文件 @
5590948a
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
reader/dataset.py
浏览文件 @
5590948a
"""
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
Define Dataset
#
"""
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
abc
import
abc
import
copy
import
copy
import
yaml
import
yaml
...
...
trainer/cluster_training_local.py
0 → 100644
浏览文件 @
5590948a
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
__future__
import
print_function
import
os
import
time
import
numpy
as
np
import
logging
import
paddle.fluid
as
fluid
from
network
import
CTR
from
argument
import
params_args
logging
.
basicConfig
(
format
=
"%(asctime)s - %(levelname)s - %(message)s"
)
logger
=
logging
.
getLogger
(
"fluid"
)
logger
.
setLevel
(
logging
.
INFO
)
def
get_dataset
(
inputs
,
params
):
dataset
=
fluid
.
DatasetFactory
().
create_dataset
()
dataset
.
set_use_var
(
inputs
)
dataset
.
set_pipe_command
(
"python dataset_generator.py"
)
dataset
.
set_batch_size
(
params
.
batch_size
)
dataset
.
set_thread
(
int
(
params
.
cpu_num
))
file_list
=
[
str
(
params
.
train_files_path
)
+
"/%s"
%
x
for
x
in
os
.
listdir
(
params
.
train_files_path
)
]
dataset
.
set_filelist
(
file_list
)
logger
.
info
(
"file list: {}"
.
format
(
file_list
))
return
dataset
def
train
(
params
):
ctr_model
=
CTR
()
inputs
=
ctr_model
.
input_data
(
params
)
avg_cost
,
auc_var
,
batch_auc_var
=
ctr_model
.
net
(
inputs
,
params
)
optimizer
=
fluid
.
optimizer
.
Adam
(
params
.
learning_rate
)
optimizer
.
minimize
(
avg_cost
)
fluid
.
default_main_program
()
exe
=
fluid
.
Executor
(
fluid
.
CPUPlace
())
exe
.
run
(
fluid
.
default_startup_program
())
dataset
=
get_dataset
(
inputs
,
params
)
logger
.
info
(
"Training Begin"
)
for
epoch
in
range
(
params
.
epochs
):
start_time
=
time
.
time
()
exe
.
train_from_dataset
(
program
=
fluid
.
default_main_program
(),
dataset
=
dataset
,
fetch_list
=
[
auc_var
],
fetch_info
=
[
"Epoch {} auc "
.
format
(
epoch
)],
print_period
=
100
,
debug
=
False
)
end_time
=
time
.
time
()
logger
.
info
(
"epoch %d finished, use time=%d
\n
"
%
((
epoch
),
end_time
-
start_time
))
if
params
.
test
:
model_path
=
(
str
(
params
.
model_path
)
+
"/"
+
"epoch_"
+
str
(
epoch
))
fluid
.
io
.
save_persistables
(
executor
=
exe
,
dirname
=
model_path
)
logger
.
info
(
"Train Success!"
)
if
__name__
==
"__main__"
:
params
=
params_args
()
train
(
params
)
\ No newline at end of file
trainer/cluster_training_offline.py
0 → 100644
浏览文件 @
5590948a
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
trainer/ctr_trainer.py
浏览文件 @
5590948a
"""
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
A paddle trainer Adapt to Ctr
#
"""
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
abc
import
abc
import
sys
import
sys
import
copy
import
copy
...
...
trainer/trainer.py
浏览文件 @
5590948a
"""
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
Define A Trainer Base
#
"""
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
abc
import
abc
import
time
import
time
...
...
utils/__init__.py
浏览文件 @
5590948a
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
utils/envs.py
浏览文件 @
5590948a
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
os
import
os
...
...
utils/fs.py
浏览文件 @
5590948a
"""
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
util for file_system io
#
"""
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
os
import
os
import
time
import
time
from
paddle.fluid.incubate.fleet.utils.hdfs
import
HDFSClient
from
paddle.fluid.incubate.fleet.utils.hdfs
import
HDFSClient
...
...
utils/table.py
浏览文件 @
5590948a
"""
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
Construct ParamTable Meta
#
"""
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
copy
import
copy
import
yaml
import
yaml
...
...
utils/util.py
浏览文件 @
5590948a
"""
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
Util lib
#
"""
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
os
import
os
import
time
import
time
import
datetime
import
datetime
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录