Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

define_py_data_sources2 如何读取不同形式的训练文件? #2431

Closed
huangpingchun opened this issue Jun 9, 2017 · 4 comments
Closed
Assignees

Comments

@huangpingchun
Copy link

我有两种训练文件一种是稠密的向量dense 数据,一种是sparse的,怎么将这两种训练文件读入,读取后不同的data_layer的联合训练,类似google 的wide和deep的模型训练方式?

@lcy-seso
Copy link
Contributor

@huangpingchun
Copy link
Author

huangpingchun commented Jun 10, 2017

好的,谢谢!
1:我想在train.list的时候分开不同的文件,里面含有两种类型的训练文件,在process的时候分别处理,可是这样会出错。
2:我把两种数据合并在一个文件里,一个ins的拼接稀疏二值向量和浮点稠密的向量 在一个dataProvider的process里面做了解析,在inputtypes里面定义了两个数据field,在网络配置里分别指给对应的data_layer。这样能run,请问这种做法是不是比较low?有更好的方式请给予建议。

@lcy-seso
Copy link
Contributor

lcy-seso commented Jun 10, 2017

  • 这里有一个Google Wide & Deep 网络的例子,用 v2 写成,供参考:https://github.com/PaddlePaddle/models/tree/develop/ctr
  • 如果您仍需要使用 v1 版本,实际上,这两个版本在读取数据接口的核心是一致的,都是只需要自己来编写一个 python 的 generator ,实现处理一行数据的逻辑。
  • 不论是 v1 还是 v2 ,需要实现的这个 generator 的逻辑一样,返回的数据类型也一样,只是用不同的 decorator 修饰一下。可以参考 Paddle/models 中的例子。

@huangpingchun
Copy link
Author

好的,非常感谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants