经 AI Skill Hub 精选评估,PyTorch转NNEF模型转换器 获评「推荐使用」。这款AI工具在功能完整性、社区活跃度和易用性方面表现出色,AI 评分 7.2 分,适合有一定技术背景的用户使用。
专业的PyTorch模型到NNEF格式转换工具,支持深度学习模型导出和跨平台推理部署。适合需要模型格式转换、模型优化和推理加速的AI工程师和研究人员使用。
PyTorch转NNEF模型转换器 是一款基于 Python 开发的开源工具,专注于 模型转换、PyTorch、NNEF格式 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
专业的PyTorch模型到NNEF格式转换工具,支持深度学习模型导出和跨平台推理部署。适合需要模型格式转换、模型优化和推理加速的AI工程师和研究人员使用。
PyTorch转NNEF模型转换器 是一款基于 Python 开发的开源工具,专注于 模型转换、PyTorch、NNEF格式 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
# 方式一:pip 安装(推荐)
pip install torch-to-nnef
# 方式二:虚拟环境安装(推荐生产环境)
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install torch-to-nnef
# 方式三:从源码安装(获取最新功能)
git clone https://github.com/sonos/torch-to-nnef
cd torch-to-nnef
pip install -e .
# 验证安装
python -c "import torch_to_nnef; print('安装成功')"
# 命令行使用
torch-to-nnef --help
# 基本用法
torch-to-nnef input_file -o output_file
# Python 代码中调用
import torch_to_nnef
# 示例
result = torch_to_nnef.process("input")
print(result)
# torch-to-nnef 配置文件示例(config.yml) app: name: "torch-to-nnef" debug: false log_level: "INFO" # 运行时指定配置文件 torch-to-nnef --config config.yml # 或通过环境变量配置 export TORCH_TO_NNEF_API_KEY="your-key" export TORCH_TO_NNEF_OUTPUT_DIR="./output"
[
]( https://sonos.github.io/torch-to-nnef/)
Export any PyTorch model to NNEF, a simple and explicit neural network exchange format, in a way that is auditable, debuggable, and stable across runtimes.
torch_to_nnef traces a vanilla nn.Module (any internal tensor type, quantized models included) and produces a portable NNEF archive. Unlike the protobuf used by ONNX, the NNEF graph is human-readable text with weights kept aside as separate files, so you can open it and review exactly which ops got serialized. tract, the inference engine developed openly by SONOS, is the primary supported target: it gets extended operator coverage and an optional check_io step that compares tract outputs against PyTorch at export time.
🚀 See it run: live browser demos (image classifier, pose estimation, voice activity detection, LLM) exported with torch_to_nnef and running through tract compiled to WASM, no install required.
pip install torch_to_nnef # needs pip >= 23.2
import torch
from torch_to_nnef import export_model_to_nnef, TractNNEF
model = torch.nn.Linear(8, 4).eval()
example_input = torch.randn(1, 8)
export_model_to_nnef(
model=model,
args=example_input,
file_path_export="my_model.nnef.tgz",
# version pins the tract opset to target; check_io downloads that tract
# build once and asserts its output matches PyTorch on example_input.
inference_target=TractNNEF(version="0.21.13", check_io=True),
input_names=["input"],
output_names=["output"],
)
This writes a self-contained my_model.nnef.tgz; with check_io=True the call also raises if tract and PyTorch outputs diverge, so reaching the end means the export is validated. The getting started tutorial (linked below) walks through running the archive in tract from Python, Rust, and the CLI.
<details> <summary>What's inside <code>my_model.nnef.tgz</code></summary>
The archive keeps the graph and the weights apart:
graph.nnef weight.dat bias.dat
and graph.nnef is plain text you can read end to end (metadata header elided):
graph network(input) -> (output) { input = tract_core_external(shape = [1, 8], datum_type = 'f32'); weight = variable<scalar>(label = 'weight', shape = [4, 8]); bias = variable<scalar>(label = 'bias', shape = [4]); bias_aligned_rank_expanded = unsqueeze(bias, axes = [0]); output = linear(input, weight, bias_aligned_rank_expanded); }
</details>
专业的模型转换工具,填补PyTorch到NNEF的转换空白。功能明确,适合模型部署场景,但社区规模较小,需持续关注维护状态。
该工具使用 NOASSERTION 协议,商用场景请仔细阅读协议条款,必要时咨询法律意见。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
📄 NOASSERTION — 请查阅原始协议条款了解具体使用限制。
AI Skill Hub 点评:PyTorch转NNEF模型转换器 的核心功能完整,质量良好。对于AI 技术爱好者来说,这是一个值得纳入个人工具库的选择。建议先在非生产环境试用,再逐步推广。
| 原始名称 | torch-to-nnef |
| 原始描述 | 开源AI工具:Any PyTorch model to NNEF exchange format。⭐18 · Python |
| Topics | 模型转换PyTorchNNEF格式模型导出推理部署 |
| GitHub | https://github.com/sonos/torch-to-nnef |
| License | NOASSERTION |
| 语言 | Python |
收录时间:2026-06-08 · 更新时间:2026-06-11 · License:NOASSERTION · AI Skill Hub 不对第三方内容的准确性作法律背书。