Hi, I’m new to tvm and I have been trying to compile some deep learning models with tvm. I tried to compile Keras model on the tutorial page, and I ran into some issues. Given that there is few reports on this specific issue, I’m posting the issues that I ran into and how I fixed them.
My laptop and python package settings are as follows:
AttributeError: module ‘keras.engine’ has no attribute ‘topology’
I modified line 477 and 495 at /path/to/tvm/nnvm/python/nnvm/frontend/keras.py into:
if isinstance(keras_layer, keras.engine.input_layer.InputLayer):
if isinstance(pred, keras.engine.input_layer.InputLayer):
I’m not sure why keras.engine doesn’t recognize topology.py, but InputLayer is defined in input_layer.py.
Traceback (most recent call last):
File “nnvm_quick_test.py”, line 44, in
graph, params = nnvm.frontend.from_keras(keras_resnet50)
File “/Users/luzijie/tvm/nnvm/python/nnvm/frontend/keras.py”, line 505, in from_keras
outsym = symtab.get_var(model.output_layers.name + ‘:0’)
AttributeError: ‘Model’ object has no attribute ‘output_layers’
I changed the corresponding line into
outsym = symtab.get_var(model.layers[-1].name + ‘:0’)
layers[-1] corresponds to the last layer of a keras model.
Hope this helps