torch.onnx.export报告:“未安装模块onnx!”

huangapple go评论60阅读模式
英文:

torch.onnx.export reports "Module onnx is not installed!"

问题

在执行torch.onnx.export()时,出现了以下错误:

`============= Diagnostic Run torch.onnx.export version 2.0.1+cu117 =============
verbose: False, log level: Level.ERROR
======================= 0 NONE 0 NOTE 0 WARNING 0 ERROR ========================

Module onnx is not installed!`

我已经尝试过 "pip uninstall torch torchvision onnx",然后再 "pip install torch torchvision onnx"。但这并没有帮助我解决报告的错误。

我想解决这个错误。

英文:

while I am executing torch.onnx.export() call it fails as below.

`============= Diagnostic Run torch.onnx.export version 2.0.1+cu117 =============
verbose: False, log level: Level.ERROR
======================= 0 NONE 0 NOTE 0 WARNING 0 ERROR ========================

Module onnx is not installed!`

I already tried "pip uninstall torch torchvision onnx" and then "pip install torch torchvision onnx". But this doesn't help me.

I want to resolve reported error.

答案1

得分: 1

你提供的错误信息表明尽管你尝试卸载和重新安装所需的软件包,但"Module onnx is not installed!"。以下是解决此问题的一些步骤:

检查Onnx安装:首先,请确保onnx包在你的Python环境中正确安装。你可以使用以下命令检查是否已安装:

import onnx

如果这个导入语句引发错误,说明onnx包未安装,你需要重新安装它。


而你提供的另一个日志信息似乎是成功的情况。
例如:

$ torch.onnx.export(model,x,"model.onnx")
============= Diagnostic Run torch.onnx.export version 2.0.1+cu117 ============
verbose: False, log level: Level.ERROR
======================= 0 NONE 0 NOTE 0 WARNING 0 ERROR =======================

在这种情况下,这只是来自onnx导出的日志,显示没有任何错误。

英文:

The error message you provided indicates that the "Module onnx is not installed!" despite your attempts to uninstall and reinstall the required packages. Here are some steps you can take to resolve it:

Check Onnx Installation: First, ensure that the onnx package is installed properly in your Python environment. You can use the following command to check if it's installed:

import onnx

If this import statement raises an error, it means the onnx package is not installed, and you need to install it again.


And the other log message that you have provided seems to be of success case.
For eg:

$ torch.onnx.export(model,x,"model.onnx")
============= Diagnostic Run torch.onnx.export version 2.0.1+cu117 ============
verbose: False, log level: Level.ERROR
======================= 0 NONE 0 NOTE 0 WARNING 0 ERROR =======================

In this case, it is just a log from onnx export which shows no any error.

huangapple
  • 本文由 发表于 2023年7月27日 15:37:36
  • 转载请务必保留本文链接:https://go.coder-hub.com/76777480.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定