SpotLab/MobileViT_DeepLabv3
0251
1from transformers import TFMobileViTForSemanticSegmentation2import tensorflow as tf3 4if __name__ == '__main__':5 model = TFMobileViTForSemanticSegmentation.from_pretrained(".")6 converter = tf.lite.TFLiteConverter.from_keras_model(model)7 converter.optimizations = [tf.lite.Optimize.DEFAULT]8 converter.target_spec.supported_ops = [9 tf.lite.OpsSet.TFLITE_BUILTINS,10 tf.lite.OpsSet.SELECT_TF_OPS,11 ]12 tflite_model = converter.convert()13 tflite_filename = "tflite_model.tflite"14 with open(tflite_filename, "wb") as f:15 f.write(tflite_model)