ONNX itself is packaged in Debian Bookworm, and works fine:
sudo apt install python3-onnx
ONNX Optimizer can be installed in Debian Bookworm per its installation instructions.
ONNX Runtime can be installed in Debian Bookworm per its installation instructions. Note that if you've morphed Debian to Bedrock, you may need to restrict the build script to the Debian stratum. Python bindings are not enabled by default, and there may be some unit test issues if building the Python bindings against Debian-packaged ONNX. A fully working Python-enabled installation command for Debian+Bedrock is:
strat -r debian ./build.sh --config Release --build_shared_lib --enable_pybind --build_wheel --parallel --compile_no_warning_as_error --skip_submodule_sync --build
The ONNX Runtime wheel will be produced at
build/Linux/Release/dist/; you can install it with