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

[Relay][Frontend] CoreML Support #2476

Merged
merged 5 commits into from
Jan 30, 2019
Merged

Conversation

yzhliu
Copy link
Member

@yzhliu yzhliu commented Jan 21, 2019

@zhreshold @siju-samuel @tqchen Please help to review

@@ -1,4 +1,4 @@
import urllib
from six.moves import urllib
Copy link
Member

Choose a reason for hiding this comment

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

make sure six in installed as dependency in CI

Copy link
Member Author

Choose a reason for hiding this comment

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

added. thanks for reminding.

shape_dict = {input_name : x.shape}
with nnvm.compiler.build_config(opt_level=3):
with nnvm.compiler.build_config(opt_level=2):
Copy link
Member Author

Choose a reason for hiding this comment

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

with opt_level=3, mobilenet fails with error below. Looks like it is due to some problem in nnvm's foldaxis pass, I will open an issue to track.

$ python -m nose -v nnvm/tests/python/frontend/coreml
test_forward.test_mobilenet_checkonly ... ERROR
test_forward.test_resnet50_checkonly ... ^C
======================================================================
ERROR: test_forward.test_mobilenet_checkonly
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/ubuntu/tvm/nnvm/tests/python/frontend/coreml/test_forward.py", line 41, in test_mobilenet_checkonly
    run_model_checkonly(model_file, 'mobilenet')
  File "/home/ubuntu/tvm/nnvm/tests/python/frontend/coreml/test_forward.py", line 36, in run_model_checkonly
    tvm_output = get_tvm_output(sym, x, params, target, ctx)
  File "/home/ubuntu/tvm/nnvm/tests/python/frontend/coreml/test_forward.py", line 21, in get_tvm_output
    graph, lib, params = nnvm.compiler.build(symbol, target, shape_dict, params=params)
  File "/home/ubuntu/tvm/nnvm/python/nnvm/compiler/build_module.py", line 292, in build
    graph = graph.apply("InferShape")
  File "/home/ubuntu/tvm/nnvm/python/nnvm/graph.py", line 234, in apply
    check_call(_LIB.NNGraphApplyPasses(self.handle, npass, cpass, ctypes.byref(ghandle)))
  File "/home/ubuntu/tvm/nnvm/python/nnvm/_base.py", line 75, in check_call
    raise NNVMError(py_str(_LIB.NNGetLastError()))
nnvm._base.NNVMError: Error in operator _param_9_sc: [01:28:47] /home/ubuntu/tvm/nnvm/src/top/tensor/broadcast.cc:119: Check failed: l == 1 || r == 1 operands could not be broadcast together with shapes [32,1,3,3] [32,1,1,1,112,112], l=3, r=112

Stack trace returned 10 entries:
[bt] (0) /home/ubuntu/tvm/build/libtvm.so(dmlc::StackTrace[abi:cxx11](unsigned long)+0x1f5) [0x7fca99a28365]
[bt] (1) /home/ubuntu/tvm/build/libtvm.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x3e) [0x7fca99a28fee]
[bt] (2) /home/ubuntu/tvm/nnvm/python/nnvm/../../../build/libnnvm_compiler.so(nnvm::top::BinaryBroadcastShape(nnvm::NodeAttrs const&, std::vector<nnvm::TShape, std::allocator<nnvm::TShape> >*, std::vector<nnvm::TShape, std::allocator<nnvm::TShape> >*)+0x6c0) [0x7fca949c6e00]
[bt] (3) /home/ubuntu/tvm/nnvm/python/nnvm/../../../build/libnnvm_compiler.so(+0x1174dd) [0x7fca948b04dd]
[bt] (4) /home/ubuntu/tvm/nnvm/python/nnvm/../../../build/libnnvm_compiler.so(+0x118c4a) [0x7fca948b1c4a]
[bt] (5) /home/ubuntu/tvm/nnvm/python/nnvm/../../../build/libnnvm_compiler.so(+0x119f3a) [0x7fca948b2f3a]
[bt] (6) /home/ubuntu/tvm/nnvm/python/nnvm/../../../build/libnnvm_compiler.so(nnvm::ApplyPasses(nnvm::Graph, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)+0x127d) [0x7fca94885eed]
[bt] (7) /home/ubuntu/tvm/nnvm/python/nnvm/../../../build/libnnvm_compiler.so(NNGraphApplyPasses+0x320) [0x7fca94863d10]
[bt] (8) /home/ubuntu/anaconda3/lib/python3.7/lib-dynload/../../libffi.so.6(ffi_call_unix64+0x4c) [0x7fcaac8cdec0]
[bt] (9) /home/ubuntu/anaconda3/lib/python3.7/lib-dynload/../../libffi.so.6(ffi_call+0x22d) [0x7fcaac8cd87d]

Copy link
Member Author

Choose a reason for hiding this comment

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

Previously this test did not run on CI. besides, it only fails on CUDA. CPU is good.
Also Relay is good.

Copy link
Member Author

Choose a reason for hiding this comment

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

@yzhliu
Copy link
Member Author

yzhliu commented Jan 25, 2019

@zhreshold Please help to review again.

@yzhliu yzhliu mentioned this pull request Jan 28, 2019
@yzhliu
Copy link
Member Author

yzhliu commented Jan 28, 2019

Thanks for the review @zhreshold

Copy link
Member

@icemelon icemelon left a comment

Choose a reason for hiding this comment

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

lgtm

@icemelon icemelon merged commit 881a78b into apache:master Jan 30, 2019
merrymercy pushed a commit to merrymercy/tvm that referenced this pull request Feb 18, 2019
* [Relay][Frontend] Add CoreML Support

* pip install six in CI

* remove triggering nnvm coreml test

* set opt_level=2 for nnvm coreml test case
wweic pushed a commit to neo-ai/tvm that referenced this pull request Feb 20, 2019
* [Relay][Frontend] Add CoreML Support

* pip install six in CI

* remove triggering nnvm coreml test

* set opt_level=2 for nnvm coreml test case
wweic pushed a commit to neo-ai/tvm that referenced this pull request Feb 20, 2019
* [Relay][Frontend] Add CoreML Support

* pip install six in CI

* remove triggering nnvm coreml test

* set opt_level=2 for nnvm coreml test case
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants