TensorFlow:如何在没有源代码的情况下发布模型? [英] TensorFlow: How do I release a model without source code?

查看:34
本文介绍了TensorFlow:如何在没有源代码的情况下发布模型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Tensorflow + Python.

I am using Tensorflow + Python.

我很好奇是否可以在没有详细源代码的情况下发布已保存的 Tensorflow 模型(架构 + 训练变量).我知道 tf.train.Saver(),但它看起来只保存变量,为了恢复/运行它们,用户需要定义"相同的架构.

I am curious if I can release a saved Tensorflow model (architecture + trained variables) without detailed source code. I'm aware of tf.train.Saver(), but it looks to save only variables, and in order to restore/run them, a user needs to "define" the same architecture.

仅出于测试/运行目的,有没有办法在没有源代码的情况下释放已保存的{架构+训练变量},以便用户只需投射查询并获得结果?

For the testing/running purpose only, is there a way to release a saved {architecture+trained variables} without source code, so that a user can just cast a query and get a result?

推荐答案

TensorFlow Serving 项目是旨在使这个用例简单明了(假设最终用户仅使用模型进行推理,而不是训练).TensorFlow Serving 包括一个 Exporter 类,它接受你的 tf.train.Saver、定义你的整体模型的 tf.GraphDef 和一个签名" 描述模型的输入和输出.

The TensorFlow Serving project is intended to make this use case straightforward (assuming that the end user is only using the model for inference, not training). TensorFlow Serving includes an Exporter class that takes your tf.train.Saver, the tf.GraphDef that defines your overall model, and a "signature" that describes the inputs to and output from your model.

基础教程很好地介绍了导出模型.

The basics tutorial has a good introduction to exporting your model.

这篇关于TensorFlow:如何在没有源代码的情况下发布模型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆