# Load TensorFlow import tensorflow as tf # Set up the converter converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir) converter.optimizations = [tf.lite.Optimize.OPTIMIZE_FOR_SIZE] # Perform conversion and output file tflite_quant_model = converter.convert() output_dir.write_bytes(tflite_quant_model)