What is OnnxStream and how does it work?
masterOnnxStream is a lightweight inference library designed to minimize memory consumption, enabling large machine learning models (like Stable Diffusion) to run on hardware with extremely limited RAM, such as a Raspberry Pi Zero 2 (512MB RAM).
Unlike standard frameworks that prioritize latency or throughput at the cost of high RAM usage, OnnxStream achieves low memory footprints by decoupling the inference engine from the model weight loading mechanism. This is achieved through a WeightsProvider abstraction.
By implementing a custom WeightsProvider, you can control how model parameters are loaded, cached, or prefetched. This allows for techniques like streaming weights directly from an HTTP server without ever writing them to disk.