小巧、实用、自包含的Tensorflow与ONNX推理
Sonos 的神经网络推理引擎。
tract 加载 ONNX 和 NNEF 模型,对其进行优化,并可在任何地方运行—— 从嵌入式 ARM CPU 到 NVIDIA / Apple GPU,在浏览器中通过 WebAssembly,或在 Linux / macOS / Windows 工作站上运行。它已在 Sonos 生产环境中用于唤醒词和流式语音识别工作负载,同时也运行 LLM、文本到图像以及经典 CV 模型, 特别关注由基于 NNEF 的中间格式(tract-OPL)所实现的 一次翻译 / 发布微型运行时 方案。
use tract::prelude::*;
tract::impl_ndarray_interop!();
let model = tract::onnx()?
.load("mobilenetv2-7.onnx")?
.into_model()?;
// prepare() optimises and compiles the model for the chosen runtime
let runtime = tract::runtime_for_name("default")?;
let runnable = runtime.prepare(model)?;
let result = runnable.run([input.tract()?])?;tract 套件(api/rs/src/lib.rs)是权威的公共 API。内部套件(tract-core、tract-nnef、tract-onnx …)不是稳定的接口,不应直接依赖。
| 示例 | 什么 |
暂无开放 Issues,或尚未同步最近议题。