admin管理员组文章数量:1279085
getting this error while trying to load a tf model I converted to tflite so I can use it in my app
I did what the message suggests and added the .tensorflow:tensorflow-lite-select-tf-ops
dep in the app/build.gradle but still no luck, when I try to load a much simpler model it loaded no problem but this model it just wont load.
Select TensorFlow op(s), included in the given model, is(are) not supported by this interpreter. Make sure you apply/link the Flex delegate before inference. For the Android, it can be resolved by adding ".tensorflow:tensorflow-lite-select-tf-ops" dependency. See instructions:
this model itself is not complex at all, it is just a NER
model
this is the model
MAX_SEQ_LEN = 128
VOCAB_SIZE = 10000
EMBEDDING_DIM = 128
RNN_UNITS = 64
NUM_TAGS = 10
model = tf.keras.Sequential([
tf.keras.layers.Embedding(VOCAB_SIZE, EMBEDDING_DIM, input_length=MAX_SEQ_LEN), # Static shape
tf.keras.layers.Bidirectional(tf.keras.layers.GRU(RNN_UNITS, return_sequences=True)), # No dynamic TensorArray
tf.keras.layers.TimeDistributed(tf.keras.layers.Dense(NUM_TAGS)) # Output per token
])
this is the conversion
converter = tf.lite.TFLiteConverter.from_saved_model("ner_model")
converter.experimental_enable_resource_variables = True
converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS, tf.lite.OpsSet.SELECT_TF_OPS]
converter._experimental_lower_tensor_list_ops = False
tflite_model = converter.convert()
with open("ner_model.tflite", "wb") as f:
f.write(tflite_model)
tflite package version used in flutter project
tflite_flutter: ^0.10.4
tflite lib version used in the conversion
2.18.0
本文标签:
版权声明:本文标题:Select TensorFlow op(s), included in the given model, is(are) not supported by this interpreter. when trying load the model in f 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741220485a2360878.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论