pytorch2keras icon indicating copy to clipboard operation
pytorch2keras copied to clipboard

cannot import name 'optimizer' from 'onnx'

Open avani17101 opened this issue 3 years ago • 5 comments

Describe the bug While running

import pytorch2keras 
k_model = pytorch2keras (model_pt, input_var, [(3, 32, 32,)], verbose=True, names='short')  

I am getting the following error: image

I am using ubuntu20.04, onnx-1.10.2 pytorch2keras-0.2.4

avani17101 avatar Jan 17 '22 14:01 avani17101

You have to uninstall current version of onnx and reinstall 1.8.1 version, because the optimizer is not further supported from this version on. This worked for me.

Baionikke avatar Jan 19 '22 10:01 Baionikke

dupe of #132

HarHarLinks avatar Jan 24 '22 17:01 HarHarLinks

I got the same error when installing pytorch2keras from PyPI. The version available on PyPI is outdated. A fix was merged on master (and not yet available on PyPI). I got it working by pip installing the package directly from GitHub.

bourcierj avatar Apr 11 '22 10:04 bourcierj

@bourcierj i was able to fix the issue as well by simply installing from the github repo rather then directly installing from pypl

HksH143 avatar Oct 25 '23 10:10 HksH143

@HksH143 @bourcierj 请问一下有这个github pip安装包? 为什么我找不到 在哪?

Magnificent-01 avatar Apr 11 '24 03:04 Magnificent-01