gmalivenko / pytorch2keras

PyTorch to Keras model convertor
https://pytorch2keras.readthedocs.io/en/latest/
MIT License
857 stars 143 forks source link

cannot import name 'optimizer' from 'onnx' #139

Open avani17101 opened 2 years ago

avani17101 commented 2 years ago

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

Baionikke commented 2 years ago

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.

HarHarLinks commented 2 years ago

dupe of #132

bourcierj commented 2 years ago

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.

HksH143 commented 1 year ago

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

Magnificent-01 commented 6 months ago

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