#lua-bindings #lua #tensorflow #onnx #inference #api-bindings

mlua-tract

Lua bindings for tract, the tiny, no-nonsense, self-contained, Rust-based Tensorflow and ONNX inference runtime

3 releases

0.1.2 Feb 17, 2024
0.1.1 Jan 13, 2024
0.1.0 Jan 7, 2024

#514 in Machine learning

Download history 5/week @ 2024-01-07 9/week @ 2024-01-14 45/week @ 2024-01-28 12/week @ 2024-02-04 132/week @ 2024-02-11 53/week @ 2024-02-18 58/week @ 2024-02-25 3/week @ 2024-03-03 19/week @ 2024-03-10 50/week @ 2024-03-17 35/week @ 2024-03-24 110/week @ 2024-03-31

215 downloads per month

MIT license

95KB
986 lines

mlua-tract

Lua bindings for tract, the tiny, no-nonsense, self-contained, Rust-based Tensorflow and ONNX inference runtime.

License Arch Lua

Installing

Add to your Rust project using one of MLua's features: [lua51, lua52, lua53, lua54, luajit, luajit52].

$ cargo add mlua-tract --features luajit

Using

use mlua::Lua;
use mlua_tract;

let lua = Lua::new();
mlua_tract::preload(&lua)?;
let script = r#"
    local tract_onnx = require('tract.onnx')
    local model = tract_onnx.model_for_path('testdata/keras-tract-tf2-example.onnx')
    return tostring(model:input_fact(1))
"#;
let result: String = lua.load(script).eval()?; // returns: "unk__6,100,F32"

Testing

$ make check

Dependencies

~17–31MB
~483K SLoC