PyTorch convert function for op 'pad' not implemented.
- Name of layer type: pad
- Is this a PyTorch or a TensorFlow layer type: PyTorch
- Your version of coremltools: 6.0b2
- Your version of PyTorch/TensorFlow: 1.12.0
- Impact of supporting this layer type. Why is adding support for this layer type important? Is it necessary to support a popular model or use case? Yes, support for Confomer models for audio.
I’ll second the request for an official pad implementation when PyTorch 1.12.0 support rolls out, though as a workaround I’ve been able to compile torchaudio.models.Conformer to CoreML with PyTorch 1.11.0 and torchaudio 0.11.0, if that’s any help.
@iansampson thanks for the info. I'm trying to convert another implementation from nvidia/NeMo instead. Were you also able to run it/any console warnings? Are you using it in a streaming or offline context?
Well now this is interesting...
https://github.com/apple/coremltools/blob/6.0b1/coremltools/converters/mil/frontend/torch/test/test_torch_ops.py#L4229-L4286
🤔
Well now this is interesting...
https://github.com/apple/coremltools/blob/6.0b1/coremltools/converters/mil/frontend/torch/test/test_torch_ops.py#L4229-L4286
🤔
So apparently this is for some specific padding ops, and this test only passes for pytorch < 1.12.
In my case I was able to use torch.constant_pad_nd as a replacement for torch.nn.functional.pad. Check it out.
Ok, so the issue here is supporting PyTorch version 1.12.0, not a missing layer type.
@iansampson thanks for the info. I'm trying to convert another implementation from nvidia/NeMo instead. Were you also able to run it/any console warnings? Are you using it in a streaming or offline context?
@piraka9011 Yep, the conformer module works as expected – no console warnings as far as I can remember. I’m experimenting with both streaming and offline processing (for speech enhancement, not speech recognition).
And thanks for the tip @mallman – I’ll give torch.constant_pad_nd a try.
FYI, gelu has a new argument ("approximation") in pytorch 1.12. coremltools has issues converting models with the gelu activation in pytorch 1.12