Skip to content

Conversation

@KsenijaS
Copy link
Contributor

Add ONNX export support for torch.nn.CrossEntropyLoss.

@dr-ci
Copy link

dr-ci bot commented Feb 25, 2020

💊 CircleCI build failures summary and remediations

As of commit 2a3fdda (more details on the Dr. CI page):


💚 💚 Looks good so far! There are no CircleCI failures yet. 💚 💚


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker.

This comment has been revised 51 times.

@mruberry mruberry requested a review from houseroad February 26, 2020 18:03
@mruberry mruberry added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Feb 26, 2020
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@houseroad has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@KsenijaS KsenijaS requested a review from apaszke as a code owner March 3, 2020 20:56
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@houseroad has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@lara-hdr
Copy link
Contributor

lara-hdr commented Mar 9, 2020

OnnxBackendSimpleModelTest.test_gradient_of_add_and_mul_cpu is failing on the CI, could you run it locally and see if you can repro the error?

Copy link
Contributor

@lara-hdr lara-hdr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.Thanks!

@KsenijaS
Copy link
Contributor Author

@houseroad can you please review?

@houseroad houseroad requested a review from neginraoof March 11, 2020 18:14
Copy link
Member

@houseroad houseroad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@houseroad has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@neginraoof neginraoof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@KsenijaS
Copy link
Contributor Author

@houseroad can you please merge this PR if there are no more comments

@facebook-github-bot
Copy link
Contributor

@houseroad merged this pull request in 944ea4c.

@ezyang
Copy link
Contributor

ezyang commented Mar 13, 2020

It looks like celu cuda needed to be blacklisted too

21:01:33 =================================== FAILURES ===================================
21:01:33 ___________________ OnnxBackendNodeModelTest.test_celu_cuda ____________________
21:01:33 
21:01:33 test_self = <caffe2.python.onnx.tests.onnx_backend_test.OnnxBackendNodeModelTest testMethod=test_celu_cuda>
21:01:33 device = 'CUDA'
21:01:33 
21:01:33     def run(test_self, device):  # type: (Any, Text) -> None
21:01:33         if model_test.model_dir is None:
21:01:33             model_dir = self.prepare_model_data(model_test)
21:01:33         else:
21:01:33             model_dir = model_test.model_dir
21:01:33         model_pb_path = os.path.join(model_dir, 'model.onnx')
21:01:33         model = onnx.load(model_pb_path)
21:01:33         model_marker[0] = model
21:01:33         if hasattr(self.backend, 'is_compatible') \
21:01:33            and callable(self.backend.is_compatible) \
21:01:33            and not self.backend.is_compatible(model):
21:01:33             raise unittest.SkipTest('Not compatible with backend')
21:01:33 >       prepared_model = self.backend.prepare(model, device)
21:01:33 
21:01:33 ../.local/lib/python3.6/site-packages/onnx/backend/test/runner/__init__.py:278: 
21:01:33 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
21:01:33 ../.local/lib/python3.6/site-packages/caffe2/python/onnx/backend.py:713: in prepare
21:01:33     init_net, predict_net = cls._onnx_model_to_caffe2_net(model, device, opset_version, False)
21:01:33 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
21:01:33 
21:01:33 cls = <class 'caffe2.python.onnx.backend.Caffe2Backend'>
21:01:33 onnx_model = ir_version: 7
21:01:33 producer_name: "backend-test"
21:01:33 graph {
21:01:33   node {
21:01:33     input: "X"
21:01:33     output: "Y"
21:01:33     op_type: "Celu"
21:01:33     at...  dim {
21:01:33             dim_value: 1
21:01:33           }
21:01:33         }
21:01:33       }
21:01:33     }
21:01:33   }
21:01:33 }
21:01:33 opset_import {
21:01:33   domain: ""
21:01:33   version: 12
21:01:33 }
21:01:33 
21:01:33 device = 'CUDA', opset_version = 12, include_initializers = False
21:01:33 
21:01:33     @classmethod
21:01:33     def _onnx_model_to_caffe2_net(cls, onnx_model, device, opset_version, include_initializers):
21:01:33         device_option = get_device_option(Device(device))
21:01:33     
21:01:33         onnx_model = onnx.utils.polish_model(onnx_model)
21:01:33         init_model = cls.optimize_onnx(onnx_model, init=True)
21:01:33         pred_model = cls.optimize_onnx(onnx_model, predict=True)
21:01:33     
21:01:33         init_net = caffe2_pb2.NetDef()
21:01:33         pred_net = caffe2_pb2.NetDef()
21:01:33     
21:01:33         init_net.name = onnx_model.graph.name + '_init'
21:01:33         pred_net.name = onnx_model.graph.name + '_predict'
21:01:33     
21:01:33         if include_initializers:
21:01:33             init_net.op.extend(cls._create_tensor_filling_op(tp) for tp in onnx_model.graph.initializer)
21:01:33     
21:01:33         cls._dummy_name.reset(cls._all_names_in_graph(init_model.graph) | cls._all_names_in_graph(pred_model.graph))
21:01:33     
21:01:33         errors = []
21:01:33         for net, model in ( (init_net, init_model), (pred_net, pred_model) ):
21:01:33             net.device_option.CopyFrom(device_option)
21:01:33             for node in model.graph.node:
21:01:33                 try:
21:01:33                     c2ops = cls._onnx_node_to_caffe2_op(
21:01:33                         init_model, pred_model, node, opset_version)
21:01:33                 except Exception as e:
21:01:33                     msg = 'Error while processing node: {}. Exception: {}'.format(node, e)
21:01:33                     errors.append(msg)
21:01:33                     print('ONNX FATAL:', msg, file=sys.stderr)
21:01:33                     continue
21:01:33                 init_net.op.extend(c2ops.init_ops)
21:01:33                 net.op.extend(c2ops.ops)
21:01:33                 net.external_input.extend(c2ops.interface_blobs)
21:01:33             net.external_output.extend(
21:01:33                 value_info.name for value_info in model.graph.output)
21:01:33             net.external_input.extend(
21:01:33                 value_info.name for value_info in model.graph.input)
21:01:33     
21:01:33         if len(errors) > 0:
21:01:33             raise RuntimeError(
21:01:33                 "ONNX conversion failed, encountered {} errors:\n\n{}".format(
21:01:33 >                   len(errors), "\n\n".join(errors)))
21:01:33 E           RuntimeError: ONNX conversion failed, encountered 1 errors:
21:01:33 E           
21:01:33 E           Error while processing node: input: "X"
21:01:33 E           output: "Y"
21:01:33 E           op_type: "Celu"
21:01:33 E           attribute {
21:01:33 E             name: "alpha"
21:01:33 E             f: 2.0
21:01:33 E             type: FLOAT
21:01:33 E           }
21:01:33 E           . Exception: Don't know how to translate op Celu
21:01:33 

@houseroad
Copy link
Member

@ezyang which ci runs this cuda test?

@ezyang
Copy link
Contributor

ezyang commented Mar 13, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merged open source triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants