liveBook · Manning

ONNX Runtime

As explained in LLMs in Production

ONNX Runtime is a cross-platform inference engine that optimizes and executes models represented in ONNX format.

When TensorRT does not support a model or hardware setup cleanly, ONNX Runtime offers a practical alternative for optimizing and running ONNX models. ONNX is the standardized interchange format; ONNX Runtime is the inference engine. section 6.1.1

Use ONNX Runtime when deployment requires:

  • Porting models trained with TensorFlow, PyTorch, Keras, or MXNet into a standardized representation. section 6.1.1
  • Running inference across CPUs, GPUs, and specialized accelerators rather than targeting one hardware vendor. section 6.1.1
  • Avoiding extensive reengineering when moving models between tools, platforms, and environments. section 6.1.1

Export and optimize with Optimum

Hugging Face Optimum can export a model to ONNX and apply optimization: `optimum-cli export onnx --model WizardLM/WizardCoder-1B-V1.0 ./models_onnx --optimize O1`. The resulting ONNX model can then be optimized and executed with ONNX Runtime. section 6.1.1

How LLMs in Production covers it

How deep it goes
Defines ONNX Runtime’s role and deployment rationale but stops short of explaining its internal optimization algorithms.
Examples
Uses a Hugging Face Optimum CLI command to export and optimize WizardCoder in ONNX format.
What it assumes
Assumes familiarity with trained models and frameworks while distinguishing the ONNX format from its runtime.
What you can do after
Apply it via Optimum to export models into ONNX for portable inference deployment.
How it connects
Connects ONNX Runtime with ONNX, TensorRT, TensorRT-LLM, Optimum, and major training frameworks.

Also explained in

Compare how 3 books explain ONNX Runtime →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of LLMs in Production. The section links point to the parts of the book it draws on.