microsoft/onnxruntime让训练好的 AI 模型跑得更快、更省钱的加速工具
ONNX Runtime 是微软开源的一个工具,作用是让已经训练好的 AI 模型跑起来更快、成本更低。你从 PyTorch、TensorFlow、scikit-learn 这些做模型的框架里训出来的模型,它都能接过来跑。它兼容不同的硬件、驱动和操作系统,会尽量调用电脑里的加速硬件,再加上对计算过程做整理优化,让你得到更流畅的使用体验。
它最特别的地方是跨平台:不管你的设备是什么系统、什么芯片,它都想办法适配上去。做推理(就是让模型给出结果)时能省时间和成本;做训练时也有专门的能力,能在多台机器的 NVIDIA 显卡上加速 Transformer 模型的训练,并且对现有的 PyTorch 训练代码改动很小。项目用 MIT 许可证开源。
做在线 AI 产品的团队,想缩短用户等待时间、降低服务器开销,用它来加速模型推理。
用 PyTorch 训练模型的人,在多台 NVIDIA 显卡机器上,加一行改动就能加快训练。
手里有 scikit-learn、LightGBM、XGBoost 这类传统机器学习模型的人,也能用它来跑推理。
案例来自项目官方说明里举的例子和演示,不是本站编的。
用之前要准备:要会写代码、了解怎么把模型接进来;想用显卡加速时需要有对应的硬件和驱动
下载链接直接指向 GitHub 官方发布页的文件,不经过本站。国内下载 GitHub 文件可能偏慢。
随便用、随便改,也能用在公司产品里,只要保留原作者的版权声明。
以上是对许可证的通俗解释,不是法律意见;正式商用以官方仓库的 LICENSE 文件为准。
开源,用的是 MIT 许可,一般可以免费使用,包括商用。具体以项目许可条款为准。
推理不强制要显卡,也能在 CPU 上跑;想用多张 NVIDIA 显卡加速训练,则需要这类硬件。
它本身是跑模型的工具,不是聊天界面,界面上没有中文与否的问题;能不能处理中文取决于你用的模型。
介绍里说跨平台、支持多种操作系统,但给出的安装包只列了 Linux 和其他平台,Windows 情况没有明确说明。
项目说明提到可能收集使用数据发给微软,用来改进产品服务。建议查看其隐私声明确认细节。
下面是海外开发者在 Hacker News(国外程序员常去的技术论坛)上讨论这个项目的真实评论,按讨论热度挑选,中文由 AI 翻译,点「看原文」可以对照英文。
Some context for those who aren't in the loop: ONNX Runtime (https://onnxruntime.ai/) is a standardization format for AI models. Nowadays, it's extremely easy to export models in the ONNX format, especially language models with tools like Hugging Face transformers which have special workflows for it. ONNX support in the browser was lacking and limited to CPU, but with a WebGPU backend it may now finally be feasible to run models in the browser on a GPU, which opens up interesting oppertunities. Although from this PR it looks like only a few operations are implemented, no browser-based GPT yet.
Okay, I’ve just got to know: what’s up with the commit messages? I’ve never seen anyone just straight up use numbers before.
A great option but there is wonnx which seems to be more complete and mature. And the bonus is that it's implemented in Rust (if you are into it). https://github.com/webonnx/wonnx
interesting, is there a helloworld example or tutorial somewhere to check out how this works in real?
A pretty cool library that uses ONNX is transformers.js [1] and they're already working to add WebGPU support.[2] [1] https://xenova.github.io/transformers.js/ [2] https://twitter.com/xenovacom/status/1650634015060156420
It would be great if, one lovely day, we could just slap together an electron app and run inference through webgpu hassle-free and cross-platform.
数据来自 GitHub,本站每周核对一次,最近核对于 2026-11-15。