Comments (9)
这个问题主要是因为core文件中不能用list 方式创建layer,你将其改为字典,而且字典的key必须为字符串
修改deepctr/layers/core.py
self.activation_layers={}
for i in range(len(self.hidden_units)):
self.activation_layers[str(i)]=activation_layer(self.activation)
# self.activation_layers = [activation_layer(self.activation) for _ in range(len(self.hidden_units))]
# print("activation num:", len(self.activation_layers))
if self.output_activation:
# self.activation_layers[-1] = activation_layer(self.output_activation)
self.activation_layers[str(len(self.hidden_units)-1)] = activation_layer(self.output_activation)
from deepmatch.
这个问题主要是因为core文件中不能用list 方式创建layer,你将其改为字典,而且字典的key必须为字符串 修改deepctr/layers/core.py self.activation_layers={} for i in range(len(self.hidden_units)): self.activation_layers[str(i)]=activation_layer(self.activation) # self.activation_layers = [activation_layer(self.activation) for _ in range(len(self.hidden_units))] # print("activation num:", len(self.activation_layers)) if self.output_activation: # self.activation_layers[-1] = activation_layer(self.output_activation) self.activation_layers[str(len(self.hidden_units)-1)] = activation_layer(self.output_activation)
确实有效。
补充一下,再改一下 deepctr/layers/core.py 文件中:
# fc = self.activation_layers[i](fc, training=training)
fc = self.activation_layers[str(i)](fc, training=training)
# fc = self.activation_layers[i](fc)
fc = self.activation_layers[str(i)](fc)
然后用 tf.saved_model.save() 即可保存 pb 格式文件。
from deepmatch.
Was this solved for everyone?
I still cant fix this for sdm, is the change only required in deepctr?
Could this have any impact (DynamicMultiRNN in DeepMatch)
DeepMatch/deepmatch/layers/sequence.py
Line 56 in 5dab795
from deepmatch.
这都被你发现了,你是一个个都试过存pb格式了么?看样子用类似Java调模型的不多,都走TensorFlow serving实时推荐的去了吧
from deepmatch.
还是自己动手改造到TF2版本后,再直接存为savemodel吧。马上过年了,正好有时间弄了
from deepmatch.
这都被你发现了,你是一个个都试过存pb格式了么?看样子用类似Java调模型的不多,都走TensorFlow serving实时推荐的去了吧
不管是Java调模型还是用tensorflow-serving都需要调用pb文件
from deepmatch.
还是自己动手改造到TF2版本后,再直接存为savemodel吧。马上过年了,正好有时间弄了
这个代码本来就是TF2可以成功运行的。
from deepmatch.
这都被你发现了,你是一个个都试过存pb格式了么?看样子用类似Java调模型的不多,都走TensorFlow serving实时推荐的去了吧
不管是Java调模型还是用tensorflow-serving都需要调用pb文件
在训练完后单独保存embeding后的特征向量,然后自己在其它程序里面算物品和用户向量的得分取topn也是能算的,此时甚至不需要保存模型本身。
from deepmatch.
还是自己动手改造到TF2版本后,再直接存为savemodel吧。马上过年了,正好有时间弄了
这个代码本来就是TF2可以成功运行的。
这个不是纯TF2,兼容TF1/2还是有差别的
from deepmatch.
Related Issues (20)
- SDM只能支持item 一个特征吗?
- 当对DSSM模型设置sample_weight会报错
- 请问 DeepMath 如何给 item增加标题、描述等文本特征?
- TF2.0 报“TypeError: Could not build a TypeSpec for <KerasTensor”异常 HOT 1
- YoutubeDNN example run failed
- from preprocess import gen_data_set, gen_model_input HOT 2
- 官方示例YoutubeDNN无法运行 HOT 2
- in batch 负采样 HOT 3
- Question about Dynamic Routing in MIND model
- youtubednn部署报错
- sparsefeature,以传入vocabulary_path的方式做hash,报错 HOT 1
- 关于胶囊网络CapsuleLayer梯度停止更新问题
- 双塔模型在负样本negsample=0的时候,模型学到的是什么? HOT 1
- FM中仅类别特征有效,数值特征建模时会忽略?
- YoutubeDNN训练很慢, YoutubeDNN training so slow
- comirec还有LabelAwareAttention?我看论文是直接argmax HOT 4
- utils.py的inner product实现有问题
- YoutubeDNN导出item侧模型失败 HOT 1
- 跑完sdm模型,想导出用户塔用作实时召回,savemodel格式,失败,显示缺失state
- dssm模型保存报错 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deepmatch.