tensorflow: error parsing inception v3 file: 64MB python protobuf parsing limit

I just upgraded TF to 469b3ddb4bb914a02f496748dd4ee5dbcbd7fce0 and I’m now getting an error importing the inception v3 model provided at https://storage.googleapis.com/download.tensorflow.org/models/inception_dec_2015.zip

I didn’t have this problem before the upgrade. Here is the error

Traceback (most recent call last):
  File "test.py", line 7, in <module>
    graph_def.ParseFromString(fileContent)
google.protobuf.message.DecodeError: Error parsing message

And this is the code I’m using

import tensorflow as tf

with open("tensorflow_inception_graph.pb", mode='rb') as f:
  fileContent = f.read()
graph_def = tf.GraphDef()
graph_def.ParseFromString(fileContent)

input_layer = tf.placeholder("float", [1, 299, 299, 3])
tf.import_graph_def(graph_def, input_map={ "Mul": input_layer })

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 4
  • Comments: 46 (11 by maintainers)

Most upvoted comments

Set environment PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python would solve this. slower though.

I’m still having a similar issue, I believe. I tried @raingo 's solution but get this error now: google.protobuf.message.DecodeError: Truncated message.

@ry , I got a workaround by changing https://github.com/google/protobuf/blob/master/src/google/protobuf/io/coded_stream.h#L611 to 256 << 20 and then recompile.

I resolved this by deleting the model I had downloaded and re-downloading.

@ffmpbgrnn I’m getting google.protobuf.message.DecodeError: Truncated message. Is this the same problem as “Error parsing message”? I tried revise the coded_stream.h to 256<<20 and reinstall protobuf. But it still shows me the same error.

@vrv I got Segmentation fault (core dumped) after installing protobuf 3.0.0b2.post2. But it works fine with the default protobuf 3.0.0b2.

$ python -c "import tensorflow"
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcurand.so locally
Segmentation fault (core dumped)