如何保存Tensorflow mulit任务推荐模型?

发布于 2025-01-24 17:12:11 字数 875 浏览 3 评论 0 原文

因此,我遵循了本教程,模型训练好( https:https:// wwww。 tensorflow.org/recommenders/examples/multitask?hl = en )。
我的问题是如何保存训练有素的模型以便将其用于服务?单个排名和检索模型以非常不同的方式保存:

那么如何结合这两个步骤?

So I followed this tutorial and the model trains just fine (https://www.tensorflow.org/recommenders/examples/multitask?hl=en).
My question is how do i save the trained model so that it can be used for serving? The individual ranking and retrieval model are saved in very different ways:

So how do I combine these two steps?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蓝天白云 2025-01-31 17:12:11

您可以在此处尝试第二种Claudiar的方法:
如何保存Tensorflow推荐框架框架模型

model.save_weights('content_model_weights', save_format='tf')
loaded_model = MultiTaskModel(user_model, movie_model, task)
loaded_model.load_weights('content_model_weights')

您的问题是您的问题是您的问题是您仍然需要调用您的 MultitaskModel 类,这导致需要加载 unique_movie_titles simory_user_id 和其他您已放入的唯一列表模型。

You can try the second method of ClaudiaR answer here:
How to save tensorflow recommenders framework model

model.save_weights('content_model_weights', save_format='tf')
loaded_model = MultiTaskModel(user_model, movie_model, task)
loaded_model.load_weights('content_model_weights')

The issue for me is that you still need to call your MultiTaskModel class, which leads to the need of loading the unique_movie_titles, unique_user_id and other unique lists which you have put in the model.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文