从源代码编译Tensorflow时出错-没有名为'keras_applications'的模块

时间:2018-08-09 15:37:36

标签: python tensorflow compilation bazel

我正在尝试通过Intel CPU设置上的MKL优化从源构建张量流。我一直遵循官方说明here,直到命令for (var d = new Date(startDate.replace("-", "/")); d <= now; d.setDate(d.getDate() + 1)) { var year = d.getFullYear(); var month = d.getMonth() + 1; var day = d.getDate(); if (month.toString().length < 2) month = '0' + month; if (day.toString().length < 2) day = '0' + day; console.log([year, month, day].join('-')); }

不幸的是,编译运行了一段时间,然后失败了。感谢您对此事的帮助。

更新后的输出日志(使用bazel --verbose_failures):

bazel build --config=mkl --config=opt //tensorflow/tools/pip_package:build_pip_package

2 个答案:

答案 0 :(得分:9)

这似乎是Tensorflow 1.10构建的问题。我建议您检查一下r1.9分支,因为它完全可以构建。要么依赖列表需要更新,要么Tensorflow将解决此问题。如果确定要运行r.1.10 api,请在终端中运行以下命令:

pip install keras_applications==1.0.4 --no-deps
pip install keras_preprocessing==1.0.2 --no-deps
pip install h5py==2.8.0

答案 1 :(得分:0)

如果您仅对发行版本感兴趣(git tag将向您显示所有可用发行版),请在git checkout v1.10.1步骤之前运行./configure。然后,您可以按照官方说明进行操作,而无需安装其他依赖项。

当前,主分支构建会在以前运行的Keras代码中给我以下错误(这是在从Keras的独立版本调用model.fit_generator()之后):

`steps_per_epoch=None` is only valid for a generator based on the `keras.utils.Sequence` class. Please specify `steps_per_epoch` or use the `keras.utils.Sequence` class.

基于TensorFlow 1.10.1发行版的版本不会导致此错误。

相关问题