Skip to content
This repository has been archived by the owner on Aug 30, 2018. It is now read-only.

Attribute error when preparing a model on MacOS #53

Open
svohara opened this issue Oct 24, 2017 · 1 comment
Open

Attribute error when preparing a model on MacOS #53

svohara opened this issue Oct 24, 2017 · 1 comment

Comments

@svohara
Copy link

svohara commented Oct 24, 2017

I have caffe2, onnx, onnx-caffe2 installed on a macbook (following the anaconda installation instructions).

I'm attempting to run the tutorial on converting a super-resolution model from pytorch to caffe2 via ONNX. The torch.onnx commands to save the model to onnx seem to work fine. However, when I try to use the saved model via the onnx-caffe2 backend's prepare method, I receive an attribute error, as shown below.

IIn [51]: model = onnx.load("/Users/ohara/data/models/super_resolution.onnx")

In [52]: prepared_backend = onnx_caffe2.backend.prepare(model)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-52-2fbcb732bd1d> in <module>()
----> 1 prepared_backend = onnx_caffe2.backend.prepare(model)

/Users/ohara/anaconda3/envs/python2/lib/python2.7/site-packages/onnx_caffe2/backend.pyc in prepare(cls, predict_graph, device, init_graph, **kwargs)
    309                 init_net = caffe2_pb2.NetDef()
    310 
--> 311             predict_net, _ = cls._onnx_graph_to_caffe2_net(predict_graph)
    312             predict_net.device_option.CopyFrom(get_device_option(device))
    313 

/Users/ohara/anaconda3/envs/python2/lib/python2.7/site-packages/onnx_caffe2/backend.pyc in _onnx_graph_to_caffe2_net(cls, graph_def)
    423 
    424         net_def = caffe2_pb2.NetDef()
--> 425         net_def.name = graph_def.name
    426 
    427         # environment from ONNX name to Caffe2 name

AttributeError: 'ModelProto' object has no attribute 'name'
@bddppq
Copy link
Member

bddppq commented Oct 24, 2017

Looks like that your onnx and onnx-caffe2 are directly pulled from conda? There have been some updates happened recently, please follow instructions on github front page to install them from source.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants