IRModule expects 2 arguments, but 3 were provided

I use the example from https://tvm.apache.org/docs/how_to/compile_models/from_pytorch.html The code is:

model_name = “resnet18”

model = getattr(torchvision.models, model_name)(pretrained=True)

model = model.eval()

input_shape = [1, 3, 224, 224]

input_data = torch.randn(input_shape)

scripted_model = torch.jit.trace(model, input_data).eval()

from PIL import Image

img_url = “https://github.com/dmlc/mxnet.js/blob/main/data/cat.png?raw=true

img_path = download_testdata(img_url, “cat.png”, module=“data”)

img = Image.open(img_path).resize((224, 224))

from torchvision import transforms

my_preprocess = transforms.Compose( [ transforms.Resize(256), transforms.CenterCrop(224), transforms.ToTensor(), transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]), ] ) img = my_preprocess(img)

img = np.expand_dims(img, 0)

input_name = “input0”

shape_list = [(input_name, img.shape)]

mod, params = relay.frontend.from_pytorch(scripted_model, shape_list)`

but the error is :

Traceback (most recent call last): File “/root/codes/walk_TVM/demo_onxx.py”, line 48, in mod, params = relay.frontend.from_pytorch(scripted_model, shape_list) File “/code/tvm/python/tvm/relay/frontend/pytorch.py”, line 4933, in from_pytorch mod = tvm.IRModule() File “/code/tvm/python/tvm/ir/module.py”, line 72, in init attrs, File “/code/tvm/python/tvm/_ffi/_ctypes/object.py”, line 145, in init_handle_by_constructor handle = init_by_constructor(fconstructor, args) File “/code/tvm/python/tvm/_ffi/_ctypes/packed_func.py”, line 260, in init_handle_by_constructor raise get_last_ffi_error() tvm._ffi.base.TVMError: Traceback (most recent call last): 1: TVMFuncCall 0: tvm::runtime::PackedFuncObj::Extractor<tvm::runtime::PackedFuncSubObj<tvm::runtime::TypedPackedFunc<tvm::IRModule (tvm::runtime::Map<tvm::GlobalVar, tvm::BaseFunc, void, void>, tvm::runtime::Map<tvm::GlobalTypeVar, tvm::TypeData, void, void>)>::AssignTypedLambda<tvm::__mk_TVM2::{lambda(tvm::runtime::Map<tvm::GlobalVar, tvm::BaseFunc, void, void>, tvm::runtime::Map<tvm::GlobalTypeVar, tvm::TypeData, void, void>)#1}>(tvm::__mk_TVM2::{lambda(tvm::runtime::Map<tvm::GlobalVar, tvm::BaseFunc, void, void>, tvm::runtime::Map<tvm::GlobalTypeVar, tvm::TypeData, void, void>)#1}, std::__cxx11::basic_string<char, std::char_traits, std::allocator >)::{lambda(tvm::runtime::TVMArgs const&, tvm::runtime::TVMRetValue*)#1}> >::Call(tvm::runtime::PackedFuncObj const*, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, tvm::runtime::TVMRetValue) File “/root/anaconda3/conda-bld/tvm-package_1676887019899/work/include/tvm/runtime/packed_func.h”, line 1727 TVMError: Function ir.IRModule(0: Map<GlobalVar, BaseFunc>, 1: Map<GlobalTypeVar, relay.TypeData>) → IRModule expects 2 arguments, but 3 were provided.

my tvm version is 0.13dev0

torch version is 1.7.0

by the way , i got same error by running the onnx example from the site