0

我在此页面中运行示例 Keras2DML 代码时遇到了一些问题。在运行代码时,我遇到了这个错误:

Traceback (most recent call last):
  File "/home/fregy/kerasplayground/sysml/examplenn.py", line 12, in <module>
    sysml_model = Keras2DML(spark, keras_model,input_shape=(3,224,224))
  File "/usr/local/lib/python2.7/dist-packages/systemml/mllearn/estimators.py", line 909, in __init__
    convertKerasToCaffeNetwork(keras_model, self.name + ".proto")
  File "/usr/local/lib/python2.7/dist-packages/systemml/mllearn/keras2caffe.py", line 201, in convertKerasToCaffeNetwork
    jsonLayers = list(chain.from_iterable(imap(lambda layer: _parseKerasLayer(layer), kerasModel.layers)))
  File "/usr/local/lib/python2.7/dist-packages/systemml/mllearn/keras2caffe.py", line 201, in <lambda>
    jsonLayers = list(chain.from_iterable(imap(lambda layer: _parseKerasLayer(layer), kerasModel.layers)))
  File "/usr/local/lib/python2.7/dist-packages/systemml/mllearn/keras2caffe.py", line 137, in _parseKerasLayer
    ret = { 'layer': { 'name':layer.name, 'type':supportedLayers[layerType], 'bottom':_getBottomLayers(layer), 'top':layer.name, paramName:param[paramName] } }
  File "/usr/local/lib/python2.7/dist-packages/systemml/mllearn/keras2caffe.py", line 112, in _getBottomLayers
    return [ bottomLayer.name for bottomLayer in _getInboundLayers(layer) ]
  File "/usr/local/lib/python2.7/dist-packages/systemml/mllearn/keras2caffe.py", line 70, in _getInboundLayers
    for node in layer.inbound_nodes:  # get inbound nodes to current layer
AttributeError: 'Conv2D' object has no attribute 'inbound_nodes'
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/lib/python2.7/SocketServer.py", line 230, in serve_forever
    r, w, e = _eintr_retry(select.select, [self], [], [],
AttributeError: 'NoneType' object has no attribute 'select'

我正在使用 Tensorflow-GPU 1.5 和 Keras 2.1.3 。

4

1 回答 1

0

感谢您试用 Keras2DML。出现问题是因为较新的 Keras 版本将属性重命名inbound_nodes_inbound_nodes. 此问题已在昨天的提交中修复:https ://github.com/apache/systemml/commit/9c3057a34c84d5bf1c698ad0a5c3c34d90412dbb 。

由于您使用的是 TensorFlow-GPU,因此您可能需要检查 TF 是否在使用nvidia-smi. 如果是,这里有两个简单的解决方法:

一个。对 TF 隐藏 GPU:

os.environ['CUDA_DEVICE_ORDER'] = 'PCI_BUS_ID'
os.environ['CUDA_VISIBLE_DEVICES'] = ''
import tensorflow as tf

湾。或者最小化 TensorFlow 带来的开销:

from keras.backend.tensorflow_backend import set_session    
tf_config = tf.ConfigProto()
tf_config.gpu_options.allow_growth = True
set_session(tf.Session(config=tf_config))
于 2018-02-01T06:45:20.680 回答