News for hackers. Stuff that matters.
Re:Oracle-samples/sd4j: Stable Diffusion pipeline in Java us... by craigacp on Monday January 01, 2024 @11:19AM (#38832916)
ONNX Runtime needed a good demo application in Java and this was fun to do (I maintain the Java API for ONNX Runtime and wrote this SD implementation). I've added SDv2 and SDXL support (and the turbo variants thereof) after the initial release, and I'll upgrade it to the latest ONNX Runtime when that comes out to get FP16 support among other things.
Re:Oracle-samples/sd4j: Stable Diffusion pipeline in Java us... by xrd on Monday January 01, 2024 @12:02PM (#38833266)
Did you write this code? Any good tutorials for ONNX you recommend?
Re:Oracle-samples/sd4j: Stable Diffusion pipeline in Java us... by craigacp on Monday January 01, 2024 @12:17PM (#38833394)
I did. It depends what you want, for an overview of how ONNX Runtime works then Microsoft have a bunch of things on https://onnxruntime.ai, but the Java content is a bit lacking on there as I've not had time to write much. Eventually I'll probably write something similar to the C# SD tutorial they have on there but for the Java API.

For writing ONNX models from Java we added an ONNX export system to Tribuo in 2022 which can be used by anything on the JVM to export ONNX models in an easier way than writing a protobuf directly. Tribuo doesn't have full coverage of the ONNX spec, but we're happy to accept PRs to expand it, otherwise it'll fill out as we need it.

Re:Oracle-samples/sd4j: Stable Diffusion pipeline in Java us... by galangalalgol on Monday January 01, 2024 @12:52PM (#38833654)
I have been very impressed at how performant the runtime's cpu inference is. It beat out hand written avx intrinsics by almost an order of magnitude. I had to go find a machine with no discrete gpu to convince myself it wasn't using one despite it saying it wasn't.