Running Tensorflow model model_main_tf2.py has SyntaxError

I use tensorflow models to train my dataset, running

python3 model_main_tf2.py \     --model_dir=/home/123/Documents/tf//train \     --pipeline_config_path=/home/123/Documents/tf/ssd_mobilenet_v2_coco.config \     --alsologtostderr 

in terminal, a few min has an error :

File "/home/123/venv/lib/python3.5/site-packages/tensorflow/models/official/vision/image_classification/efficientnet/efficientnet_model.py", line 44     input_filters: int = 0                  ^ SyntaxError: invalid syntax  

I try to change to

input_filters = int(0) 

it ok, but has another wrong, so I change back. Maybe python version does not match or something else, I have no idea.

my python version is 3.5.2, tensorflow version is CPU 2.1.0

Add Comment
1 Answer(s)

The code is using type hints on variables. The minimum Python version to support these is 3.6, so you need to upgrade your Python installation (Python 3.5 is by now quite old).

Answered on July 16, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.