A package for running tflite files in MLX.
pip install -e .from mlxlite import load_model
m = load_model("./path-to-model.tflite")
sub = m.get_subgraph(0) # index of the subgraph, default is 0
sub.init_arrays()
res = sub([mx.array(...), mx.array(...)]) # run with array inputstensorflow utilizes flatbuffers to create tflite files, to enable parsing in other languages you first need to load the schema used to define the file and generate a language equivalent. To help streamline this a helper script was created called setup_fbs.sh which downloads the tensorflow version of the fbs used and generates the swift/cpp equivalent utilizing flatc compiler.
If you do not have flatc installed run the following command on macos
brew install flatbuffersTo run the setup script
This script will fetch the fbs schema from tensorflow repo and run flatc
./setup_fbs.sh