Google.protobuf.text_format.ParseError when instantiating a TensorFlow model using Python

I'm on Ubuntu 16.04. I have: Python 2.7.12, Python 3.5.2, tensorflow 1.2.0-rc1, protobuf 3.3.0.

I want to follow this tutorial .

But I think my problem can be demonstrated more briefly with this test.py:

import tensorflow as tf
regressor = tf.contrib.learn.LinearRegressor(feature_columns=[])

I cannot create an instance of regression. I get (full Traceback at the end):

google.protobuf.text_format.ParseError: 48:12: The message type "tensorflow.AttrValue" does not have a field named "5".

The same thing happens in the textbook [21]. The same thing happens with python2 and python3. The same thing happens if I use LinearClassifier instead of LinearRegressor.

Any idea on what I am doing very wrong?

Traceback (last last call):

"test.py", 2,     regressor = tf.contrib.learn.LinearRegressor(feature_columns = [])

"/usr/local/lib/python2.7/dist-packages/tensorflow/python/util/lazy_loader.py", 53, getattr    module = self._load()

"/usr/local/lib/python2.7/dist-packages/tensorflow/python/util/lazy_loader.py", 42, _load     module = importlib.import_module (self. name)

"/usr/lib/python2.7/importlib/ init.py", 37, import_module      ()

"/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/ init.py", 35,      import.contrib.contrib

"/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/image/ init.py", 40,     from tensorflow.contrib.image.python.ops.single_image_random_dot_stereograms import single_image_random_dot_stereograms

"/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/image/python/ops/single_image_random_dot_stereograms.py", 26,      "_single_image_random_dot_stereograms.so" ))

"/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/util/loader.py", 55, load_op_library     ret = load_library.load_op_library ()

"/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/load_library.py", 84, load_op_library     exec (, . dict)

", 248,

" ", 114, _InitOpDefLibrary

" /usr/local/lib/python 2.7/dist-packages/google/protobuf/text_format.py ", 481,     descriptor_pool = descriptor_pool)

" /usr/local/lib/python 2.7/dist-packages/google/protobuf/text_format.py ", 535, MergeLines     return parser.MergeLines(, )

" /usr/local/lib/python 2.7/dist-packages/google/protobuf/text_format.py ", 568, MergeLines     self._ParseOrMerge (, )

" /usr/local/lib/python 2.7/dist-packages/google/protobuf/text_format.py ", 583, _ParseOrMerge     self._MergeField (, )

" /usr/local/lib/python 2.7/dist-packages/google/protobuf/text_format.py ", 684, _MergeField      (, , )

" /usr/local/lib/python 2.7/dist-packages/google/protobuf/text_format.py ", 773, _MergeMessageField     self._MergeField (, sub_message)

" /usr/local/lib/python 2.7/dist-packages/google/protobuf/text_format.py ", 684, _MergeField      (, , )

" /usr/local/lib/python 2.7/dist-packages/google/protobuf/text_format.py ", 773, _MergeMessageField     self._MergeField (, sub_message)

" /usr/local/lib/python 2.7/dist-packages/google/protobuf/text_format.py ", 684, _MergeField      (, , )

" /usr/local/lib/python 2.7/dist-packages/google/protobuf/text_format.py ", 773, _MergeMessageField     self._MergeField (, sub_message)

" /usr/local/lib/python 2.7/dist-packages/google/protobuf/text_format.py", 652, _MergeField     (message_descriptor.full_name, name))

+4
3

, (.) (,) .

protobuf Google float FloatToBuffer().

.

eye_separation: float = 2.5

0xa3b4 emphasized _single_image_random_dot_stereograms.so

, FloatToBuffer(), :

attr {\n'
  name: "eye_separation"\n'
  type: "float"\n'
  default_value {\n'
    f: 2,5\n'
  }\n'
}\n'

(at google/protobuf/text_format.py) , , 5 .

GitHub, , , .

+2

export LC_ALL=C.

//Erik

+3

:

import _locale
_locale.setlocale(_locale.LC_NUMERIC, 'en_US.UTF-8')

python3.6, freebsd11

-1

Source: https://habr.com/ru/post/1678282/


All Articles