How to convert bestresult to onnx

Lama Is a great inpaint model, open source code
At present, it’s bestressult is in CKPT format, and I hope to convert it to onnx mode. I tried the code,

        model = load_checkpoint(train_config, checkpoint_path, strict=False, map_location='cpu')

        img = torch.rand(1,3,320,320,requires_grad=False)
        img ='cpu'))
        print('=====================best onnx result is saved!================')

but it reported an error. How can I solve it? thank you.

  [2021-11-26 06:25:35,036][__main__][CRITICAL] - Prediction failed due to too many indices for tensor of dimension 4:
Traceback (most recent call last):
  File "bin/", line 68, in main

and how do you get that error ?
it’s not from opencv …

OK,get it.Thanks the same.

Mark! :grin:
still unsoloved