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

Attribute error when preparing a model on MacOS #53

@svohara

Description

@svohara

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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions