I have am ONNX model that I converted to tensorflow, that conversion went ahead without any problems, but now I want to convert this .pb file to tf lite using the following code
import tensorflow as tf
TF_PATH = "/content/tf_model/saved_model.pb" # where the forzen graph is stored
TFLITE_PATH = "./model.tflite"
# make a converter object from the saved tensorflow file
converter = tf.compat.v1.lite.TFLiteConverter.from_frozen_graph(TF_PATH, # TensorFlow freezegraph .pb model file
input_arrays=['input_ids'], # name of input arrays as defined in torch.onnx.export function before.
output_arrays=['logits'], # name of output arrays defined in torch.onnx.export function before.
)
converter.experimental_new_converter = True
converter.target_spec.supported_ops = [tf.compat.v1.lite.OpsSet.TFLITE_BUILTINS,
tf.compat.v1.lite.OpsSet.SELECT_TF_OPS]
tf_lite_model = converter.convert()
# Save the model.
with open(TFLITE_PATH, 'wb') as f:
f.write(tf_lite_model)
But when I run this cell on Colab I get the error:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa3 in position
3: invalid start byte
And directs towards the line: converter = tf.compat.v1.lite.TFLiteConverter.from_frozen_graph()
.
I cant seem to figure out what is causing this..
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…