问题:
Tensorflow Saver,Exporter,SavedModelBuilder都可以用于保存模型.根据 /sf/ask/2921807101/和张量流服务,我知道Saver用于保存训练检查点和Exporter和SavedModelBuilder用于服务.
但是,我不知道他们的产出的差异.是变量.data - ??? - of - ??? 和SavedModelBuilder生成的variable.index文件与cpkt-xxx.index和cpkt-xxx.data相同 - ??? - of - ??? Saver生成的?
我仍然对tensorflow的模型文件的含义感到困惑.我读过http://cv-tricks.com/tensorflow-tutorial/save-restore-tensorflow-models-quick-complete-tutorial/和Tensorflow:如何保存/恢复模式?这让我感到更加困惑.
模型目录中有4个文件:
文件2和4存储变量的权重.文件3存储图表.然后1商店是什么?
如何将Saver的输出转换为SavedModelBuilder.我有检查点目录,并希望导出模型以进行服务.根据https://github.com/tensorflow/tensorflow/tree/master/tensorflow/python/saved_model
它应该是这样的
export_dir = ...
...
builder = tf.saved_model.builder.SavedModelBuilder(export_dir)
with tf.Session(graph=tf.Graph()) as sess:
...
builder.add_meta_graph_and_variables(sess,
[tf.saved_model.tag_constants.TRAINING],
signature_def_map=foo_signatures,
assets_collection=foo_assets)
...
with tf.Session(graph=tf.Graph()) as sess:
...
builder.add_meta_graph(["bar-tag", "baz-tag"])
...
builder.save()
Run Code Online (Sandbox Code Playgroud)
所以,我首先需要加载检查点:
saver = tf.train.import_meta_graph('model-number.meta')
saver.restore(sess, tf.train.latest_checkpoint('./'))
Run Code Online (Sandbox Code Playgroud)
然后将其sess用于构建器.
我对吗?
我知道这个问题已被多次询问,而我仍然坚持使用它.我已经回顾了之前被问过的所有答案,例如 找不到版本`CXXABI_1.3.8'(需要......)
如何修复:[程序名称] /usr/lib/x86_64-linux-gnu/libstdc++.so.6:找不到版本CXXABI_1.3.8'([程序名称]要求)
我读过https://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.how_to_set_paths
我的系统是RHEL7,之前安装了gcc 4.8,我安装了gcc 4.9 yum -y install devtoolset-3-gcc devtoolset-3-gcc-c++
然后成功安装了gcc 4.9.有了gcc -v,我明白了
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-3/root/usr/libexec/gcc/x86_64-redhat-linux/4.9.2/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/opt/rh/devtoolset-3/root/usr --mandir=/opt/rh/devtoolset-3/root/usr/share/man --infodir=/opt/rh/devtoolset-3/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,fortran,lto --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.9.2-20150212/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.9.2-20150212/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.9.2 20150212 (Red Hat 4.9.2-6) (GCC)
Run Code Online (Sandbox Code Playgroud)
然后我LD_LIBRARY_PATH按照其他人的建议设置:
export LD_LIBRARY_PATH=/opt/rh/devtoolset-3/root/usr/lib/gcc/x86_64-redhat-linux/4.9.2:${LD_LIBRARY_PATH}
Run Code Online (Sandbox Code Playgroud)
但是,错误仍然存在,似乎我的新版本gcc4.9不起作用.任何帮助,将不胜感激!