Santiago Valdarrama
1 min readOct 15, 2018

--

Thanks, Eric!

I found this issue as well. The solution is explained here: https://github.com/tensorflow/models/issues/3252. Unfortunately, you’ll have to patch your local copy of TensorFlow.

Here is the relevant section of the link that explains what you need to do (quote below):

I had same error with Python3.5 and TF1.5. This causes tf_example.features.feature[self.field_name].bytes_list.value returns byte type instead of string type in metrics/tf_example_parser.StringParser.

So I changed tf_example_parser.StringParser below

class StringParser(data_parser.DataToNumpyParser):
"""Tensorflow Example string parser."""
def __init__(self, field_name):
self.field_name = field_name
def parse(self, tf_example):
if tf_example.features.feature[self.field_name].HasField("bytes_list"):
result = tf_example.features.feature[self.field_name].bytes_list.value
result = "".join([x if type(x)=='str' else x.decode('utf-8') for x in result])
else:
result = None
return result

--

--

Santiago Valdarrama
Santiago Valdarrama

Written by Santiago Valdarrama

I build machine learning systems until 5 pm. Then I come here and tell you stories about them.

No responses yet