Zubnet AIसीखेंWiki › ONNX
Infrastructure

ONNX

Open Neural Network Exchange
Machine learning models को represent करने का एक open format जो frameworks के बीच interoperability enable करता है। PyTorch में trained एक model ONNX में export किया जा सकता है और फिर ONNX Runtime, TensorRT, या specific hardware के लिए optimized दूसरे inference engines use करके run हो सकता है। ONNX training world (PyTorch, TensorFlow) और deployment world (optimized runtimes) के बीच एक common language की तरह act करता है।

यह क्यों matter करता है

ONNX एक real production problem solve करता है: आप PyTorch (research standard) में train करते हैं लेकिन ऐसे hardware पर deploy करते हैं जो एक different runtime के साथ बेहतर चलता है। ONNX में convert करना आपको अपना model rewrite किए बिना optimized inference engines use करने देता है। ये edge deployment के लिए especially important है जहाँ आपको limited hardware पर maximum performance चाहिए।

Deep Dive

ONNX defines a computation graph format: nodes represent operations (matrix multiply, convolution, attention), edges represent tensors flowing between operations. The graph includes all the information needed to run the model: architecture, weights, input/output shapes, and operator definitions. ONNX Runtime (Microsoft) is the most popular runtime, supporting CPU, GPU, and specialized accelerators.

When to Use ONNX

ONNX is most useful when: (1) you need to deploy on non-NVIDIA hardware (Intel, AMD, ARM, mobile) where PyTorch CUDA isn't available, (2) you need maximum inference speed and ONNX Runtime's optimizations outperform PyTorch, or (3) you're integrating a model into a non-Python application (ONNX Runtime has C++, C#, Java, and JavaScript bindings). For standard GPU inference with large LLMs, specialized serving frameworks (vLLM, TGI) typically outperform ONNX.

Limitations

Not all PyTorch operations convert cleanly to ONNX, especially custom operators and dynamic architectures. Complex models may require manual intervention to export correctly. ONNX also lags behind cutting-edge architectures — new model types may not be supported until ONNX operators are added. For LLM inference specifically, the GGUF/llama.cpp ecosystem and TensorRT-LLM have become more popular than ONNX for most use cases.

संबंधित अवधारणाएँ

← सभी Terms
← Ollama Open vs. Closed →