coremltools: RuntimeError: PyTorch convert function for op '_weight_norm' not implemented.
Try to convert PyTorch model to coreml on mac OS v12 M1 but got error:
model = ct.convert(
"./model.pt",
inputs=[ct.TensorType(shape=(1,3,256,256))],
source="pytorch"
)
model = ct.convert(
File "/Users/alex/miniforge3/envs/tf25_m1/lib/python3.9/site-packages/coremltools/converters/_converters_entry.py", line 326, in convert
mlmodel = mil_convert(
File "/Users/alex/miniforge3/envs/tf25_m1/lib/python3.9/site-packages/coremltools/converters/mil/converter.py", line 182, in mil_convert
return _mil_convert(model, convert_from, convert_to, ConverterRegistry, MLModel, compute_units, **kwargs)
File "/Users/alex/miniforge3/envs/tf25_m1/lib/python3.9/site-packages/coremltools/converters/mil/converter.py", line 209, in _mil_convert
proto, mil_program = mil_convert_to_proto(
File "/Users/alex/miniforge3/envs/tf25_m1/lib/python3.9/site-packages/coremltools/converters/mil/converter.py", line 300, in mil_convert_to_proto
prog = frontend_converter(model, **kwargs)
File "/Users/alex/miniforge3/envs/tf25_m1/lib/python3.9/site-packages/coremltools/converters/mil/converter.py", line 104, in __call__
return load(*args, **kwargs)
File "/Users/alex/miniforge3/envs/tf25_m1/lib/python3.9/site-packages/coremltools/converters/mil/frontend/torch/load.py", line 50, in load
return _perform_torch_convert(converter, debug)
File "/Users/alex/miniforge3/envs/tf25_m1/lib/python3.9/site-packages/coremltools/converters/mil/frontend/torch/load.py", line 95, in _perform_torch_convert
raise e
File "/Users/alex/miniforge3/envs/tf25_m1/lib/python3.9/site-packages/coremltools/converters/mil/frontend/torch/load.py", line 87, in _perform_torch_convert
prog = converter.convert()
File "/Users/alex/miniforge3/envs/tf25_m1/lib/python3.9/site-packages/coremltools/converters/mil/frontend/torch/converter.py", line 239, in convert
convert_nodes(self.context, self.graph)
File "/Users/alex/miniforge3/envs/tf25_m1/lib/python3.9/site-packages/coremltools/converters/mil/frontend/torch/ops.py", line 73, in convert_nodes
raise RuntimeError(
RuntimeError: PyTorch convert function for op '_weight_norm' not implemented.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16
any update ? 🥺
@chinsyo I’m still waiting for advice on how to correctly implement the _weight_norm op
It looks like
_weight_norm
is whatweight_norm
gets lowered to. Here is a minimal example to reproduce the problem:I’m going to reopen this issue.