Using the model from https://github.com/saurabhmathur96/clickbait-detector and using the following script
from models.convnets import ConvolutionalNet
from keras.models import load_model
from keras.preprocessing import sequence
from preprocessors.preprocess_text import clean
import sys
import string
import re
import coremltools
SEQUENCE_LENGTH = 20
EMBEDDING_DIMENSION = 30
vocabulary = open("data/vocabulary.txt").read().split("\n")
inverse_vocabulary = dict((word, i) for i, word in enumerate(vocabulary))
model = ConvolutionalNet(vocabulary_size=len(vocabulary), embedding_dimension=EMBEDDING_DIMENSION, input_length=SEQUENCE_LENGTH)
model.load_weights("models/detector.h5")
# import pdb
# pdb.set_trace()
coreml_model = coremltools.converters.keras.convert(model)
print(coreml_model)I get error
Traceback:
Traceback (most recent call last):
File "src/createCoreMLModel.py", line 25, in <module>
coreml_model = coremltools.converters.keras.convert(model)
File "/Users/michael.caulley/.virtualenvs/mlhackathon/lib/python2.7/site-packages/coremltools/converters/keras/_keras_converter.py", line 284, in convert
graph.insert_1d_permute_layers()
File "/Users/michael.caulley/.virtualenvs/mlhackathon/lib/python2.7/site-packages/coremltools/converters/keras/_topology.py", line 480, in insert_1d_permute_layers
in_edges, out_edges = self._get_1d_interface_edges()
File "/Users/michael.caulley/.virtualenvs/mlhackathon/lib/python2.7/site-packages/coremltools/converters/keras/_topology.py", line 448, in _get_1d_interface_edges
if not self.is_1d_layer(pred):
File "/Users/michael.caulley/.virtualenvs/mlhackathon/lib/python2.7/site-packages/coremltools/converters/keras/_topology.py", line 424, in is_1d_layer
keras_layer = self.keras_layer_map[layer]
TypeError: unhashable type: 'list'I spoke to a couple engineers at the WWDC Core ML Lab (thanks for the help!) and was told to post the issue here so a follow up can happen.