TypeError: from_onnx() got an unexpected keyword argument 'opset'

My tvm is 0.6.dev built from source, and my onnx is 1.6, the code is like this:

import onnx
import numpy as np
import tvm
import tvm.relay as relay
import cv2


input_shape = (1, 3, 768, 768)
shape_dict = {'0': input_shape}
impth = '000000000139.jpg'
mdpth = './tmp/model_final_pbn.onnx'
opt_level = 3
target = 'cuda'

model = onnx.load(mdpth)
for el in model.graph.input:
    tt = el.type.tensor_type
    print(el.name)
    print(tt)
mod, params = relay.frontend.from_onnx(model, shape_dict, dtype='float32', opset=11)

And I got the error message of:

TypeError: from_onnx() got an unexpected keyword argument ‘opset’

What is the matter with my code please ?

Sorry, my build is 2 weeks ago and I find the updates in the official repository. I recompiled the tvm and the problem no longer exists.

However, there is still some problems, the error message is:

tvm.error.OpNotImplemented: The following operators are not supported for frontend ONNX: DepthToSpace

Hope the community can bring this feature to us as soon as possible, thanks :wink:

Hi @coincheung

The PR was merged: https://github.com/apache/incubator-tvm/pull/4271

Thanks, I noticed that pr and have tried it. It works fine.

Would you please help me with another question? The question link is here: How could I accelerate model inference?