tensorflow-model-analysis release 0.13.2 and 0.13.1 does not run in python2

142 views Asked by At

I downloaded tfma source code 0.13.2 and ran it in jupyter notebook locally with python2, and it does not work

Working code:

import tensorflow as tf

import third_party.tensorflow_model_analysis.tensorflow_model_analysis.version as v
print('TFMA version: {}'.format(v.VERSION_STRING))

Output is: 

TFMA version: 0.13.1

Not working code:

import third_party.tensorflow_model_analysis.tensorflow_model_analysis.types as types
model_location = '/tmp/model0712/export/tfma/1562953448'

eval_shared_model = types.EvalSharedModel(model_path=model_location)

Output is: 

....third_party/tensorflow_model_analysis/tensorflow_model_analysis/types.py", line 54
    value: float,
         ^
SyntaxError: invalid syntax

Seems type hint thing is only supported in Python 3, so above error is reasonable to me.

However does it mean tfma code cannot be run in Python 2 although github page says that it is Python2.7 compatible?

Or did I missed anything?

1

There are 1 answers

0
Zixun Zhang On

Checked tensorflow_model_analysis/types.py from 0.13.0 which seems compatible for python2, both 0.13.1 and 0.13.2 are not compatible for python2