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

dssm模型保存报错 #99

Open
chenzk1993 opened this issue Apr 3, 2023 · 3 comments
Open

dssm模型保存报错 #99

chenzk1993 opened this issue Apr 3, 2023 · 3 comments
Labels
question Further information is requested

Comments

@chenzk1993
Copy link

Describe the question(问题描述)
使用下面命令训练并保存模型,报ValueError: Unable to save the object ListWrapper([<tensorflow.python.keras.layers.core.Activation object at 0x7f1a301de5e0>, <tensorflow.python.keras.layers.core.Activation object at 0x7f1b88dc48b0>]) (a list wrapper constructed to track trackable TensorFlow objects). A list element was replaced (setitem, setslice), deleted (delitem, delslice), or moved (sort). In order to support restoration on object creation, tracking is exclusively for append-only data structures.

  callbacks = [
      tf.keras.callbacks.ModelCheckpoint(best_model_dir, monitor='val_loss', save_best_only=True),
  ]
  model.fit(train_data, validation_data=valid_data, epochs=2, callbacks=callbacks)

Operating environment(运行环境):

  • python version [3.8]
  • tensorflow version [2.5.0]
  • deepmatch version [0.3.0]
@chenzk1993 chenzk1993 added the question Further information is requested label Apr 3, 2023
@chenzk1993 chenzk1993 changed the title dssm模型报错报错 dssm模型保存报错 Apr 3, 2023
@sxzhou1937
Copy link

您好,请问解决了吗,我这样保存也是同样的错误

from tensorflow.python.keras.models import save_model
save_model(model, './model', save_format='tf')

@chenzk1993
Copy link
Author

您好,请问解决了吗,我这样保存也是同样的错误

from tensorflow.python.keras.models import save_model
save_model(model, './model', save_format='tf')

你在线上推理时并不需要这个模型,你只要把user emb和item emb的模型保存下来就可以了。

@lowenhu
Copy link

lowenhu commented Dec 7, 2023

您好,请问解决了吗,我这样保存也是同样的错误

from tensorflow.python.keras.models import save_model
save_model(model, './model', save_format='tf')

你在线上推理时并不需要这个模型,你只要把user emb和item emb的模型保存下来就可以了。

求一个代码

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

No branches or pull requests

3 participants