Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyTorch convert function for op 'norm' not implemented. #1000

Closed
vivisl opened this issue Nov 21, 2020 · 3 comments
Closed

PyTorch convert function for op 'norm' not implemented. #1000

vivisl opened this issue Nov 21, 2020 · 3 comments
Assignees
Labels
missing layer type Unable to convert a layer type from the relevant framework PyTorch (traced) question Response providing clarification needed. Will not be assigned to a release. (type)

Comments

@vivisl
Copy link

vivisl commented Nov 21, 2020

❓PyTorch convert function for op 'norm' not implemented.

Problem description

  • Hi, I am using this depth estimation algorithm BTS to predict my pics and it works well on my Ubuntu 18,04.
  • But I have encountered a problem when I try to convert the pytorch model to coreml model:
mlmodel = ct.convert(traced_model, inputs=[input])
  • Hope for all of your replies. THANKS A LOT !

System Info

  • python 3.7
  • opencv 4.4
  • pytorch 1.6
  • coremltools 4.0

Converting code

import coremltools as ct
example_input = torch.rand(1, 3, 256, 512).cuda()
traced_model = torch.jit.trace(model.module, example_input)
# input = ct.ImageType(shape=(1, 3, 256, 512), bias=[-1,-1,-1], scale=1/127)
input = ct.TensorType(name='bts_input', shape=(1,3,256,512))
mlmodel = ct.convert(traced_model, inputs=[input])
mlmodel.save("bts_coremltool.mlmodel")

Error info

Converting Frontend ==> MIL Ops:  76%|█████████████████▍     | 1581/2084 [00:01<00:00, 1302.10 ops/s]
Traceback (most recent call last):
  File "bts_test.py", line 289, in <module>
    test(args)
  File "bts_test.py", line 185, in test
    mlmodel = ct.convert(traced_model, inputs=[input])
  File "/home/vivi/anaconda3/envs/pt16/lib/python3.7/site-packages/coremltools/converters/_converters_entry.py", line 183, in convert
    **kwargs
  File "/home/vivi/anaconda3/envs/pt16/lib/python3.7/site-packages/coremltools/converters/mil/converter.py", line 129, in mil_convert
    ConverterRegistry, **kwargs)
  File "/home/vivi/anaconda3/envs/pt16/lib/python3.7/site-packages/coremltools/converters/mil/converter.py", line 171, in mil_convert_to_proto
    prog = frontend_converter(model, **kwargs)
  File "/home/vivi/anaconda3/envs/pt16/lib/python3.7/site-packages/coremltools/converters/mil/converter.py", line 85, in __call__
    return load(*args, **kwargs)
  File "/home/vivi/anaconda3/envs/pt16/lib/python3.7/site-packages/coremltools/converters/mil/frontend/torch/load.py", line 83, in load
    raise e
  File "/home/vivi/anaconda3/envs/pt16/lib/python3.7/site-packages/coremltools/converters/mil/frontend/torch/load.py", line 75, in load
    prog = converter.convert()
  File "/home/vivi/anaconda3/envs/pt16/lib/python3.7/site-packages/coremltools/converters/mil/frontend/torch/converter.py", line 224, in convert
    convert_nodes(self.context, self.graph)
  File "/home/vivi/anaconda3/envs/pt16/lib/python3.7/site-packages/coremltools/converters/mil/frontend/torch/ops.py", line 53, in convert_nodes
    "PyTorch convert function for op '{}' not implemented.".format(node.kind)
RuntimeError: PyTorch convert function for op 'norm' not implemented.
@vivisl vivisl added the question Response providing clarification needed. Will not be assigned to a release. (type) label Nov 21, 2020
@AtomLee4279
Copy link

I encountered the same problem.
Has anyone solved it?

@qqpann
Copy link

qqpann commented May 6, 2021

+1 on this

@TobyRoseman TobyRoseman added the missing layer type Unable to convert a layer type from the relevant framework label May 10, 2021
@TobyRoseman TobyRoseman self-assigned this Oct 20, 2021
@TobyRoseman
Copy link
Collaborator

With the release of coremltools 5.1, we now support norm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
missing layer type Unable to convert a layer type from the relevant framework PyTorch (traced) question Response providing clarification needed. Will not be assigned to a release. (type)
Projects
None yet
Development

No branches or pull requests

5 participants