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

'ModelProto' object has no attribute 'opset_import' #98

Open
tjingrant opened this issue Dec 17, 2017 · 1 comment
Open

'ModelProto' object has no attribute 'opset_import' #98

tjingrant opened this issue Dec 17, 2017 · 1 comment

Comments

@tjingrant
Copy link

tjingrant commented Dec 17, 2017

Hi,

I'm seeing the following error when loading official onnx models:

Traceback (most recent call last):
  File "test_model_large_stepping.py", line 37, in test
    cf_rep = c2.prepare(_model)
  File "/Users/xxx/onnx-caffe2/onnx_caffe2/backend.py", line 559, in prepare
    for imp in model.opset_import:
AttributeError: 'ModelProto' object has no attribute 'opset_import'

I'm using latest onnx from source, latest onnx-caffe2 from pip install.

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import unittest
import numpy as np
import onnx
import onnx_caffe2.backend as c2
from onnx import helper
from onnx.onnx_pb2 import TensorProto

class TestLargeModel(unittest.TestCase):
  MODEL_PATH = "../../../onnx_models/"

  def test(self):
    _model = onnx.load(self.MODEL_PATH + "shufflenet/model.pb")
    cf_rep = c2.prepare(_model)

if __name__ == '__main__':
  unittest.main()

maybe time to update model zoo?

Best wishes,
Tian Jin.

@ezyang
Copy link
Collaborator

ezyang commented Dec 28, 2017

What is the commit ID of the onnx Git checkout you are building with? opset_import was added relatively recently, so the most plausible explanation is your onnx checkout is still not recent enough.

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