PyTorch convert function for op 'pad' not implemented
When I trying to convert model.ckpt to core ML model use coremltools I got this error:
  
  File &quot;/Users/peterpan/miniforge3/lib/python3.10/site-packages/coremltools/converters/mil/frontend/torch/ops.py&quot;, line 86, in convert_nodes
    raise RuntimeError(
RuntimeError: PyTorch convert function for op 'pad' not implemented.

Here is converting code:
   model: torch.nn.Module = make_training_model(train_config)
    state = torch.load(path, map_location=map_location)
    model.load_state_dict(state['state_dict'], strict=strict)
    model.on_load_checkpoint(state)
    model.eval()
   
    jit_model_wrapper = JITWrapper(model)
    image = torch.rand(1, 3, 120, 120)
    mask = torch.rand(1, 1, 120, 120)
    output = jit_model_wrapper(image, mask)

    device = torch.device(&quot;cpu&quot;)

    image = image.to(device)
    mask = mask.to(device)
    traced_model = torch.jit.trace(jit_model_wrapper, (image, mask), strict=False).to(device)
    model1 = ct.convert(
        traced_model,
        source='pytorch',
        inputs=[ct.ImageType(name='image',shape=image.shape), ct.ImageType(name='mask',shape=mask.shape)]
    )
    model1.save(&quot;newmodel.mlmodel&quot;)

I'm newbie in python. What's wrong with my code?

Upgrading to coremltools==6.0 fixed this problem for me
