jasonrig / address-net

A package to structure Australian addresses
MIT License
195 stars 86 forks source link

Tensorflow version #11

Open ingram-arginlerit opened 4 years ago

ingram-arginlerit commented 4 years ago

Hello, this is looking to be perfect for the project I'm working on right now but encountered an issue with what seems to be the Tensorflow version dependency. I understand the TF version needs to be higher than 1.12 and I'm using 2.2 but there seems to have been changes to the TF syntax.

E.g. get_variable is now Variable, random_normal is now random.normal in the model.py file.

I tried to fix these and it worked but now I'm getting an error in a tensorflow file tensorflow\python\ops\variables.py Line 261: TypeError: _variable_v2_call() got an unexpected keyword argument 'initializer'.

Can you let me know please which specific Tensorflow version you used during the development?

jasonrig commented 4 years ago

Oh dear, you are right. The TF version range in setup.py is bad! At the time of development, it would have been 1.12 because I always set the version to be a minimum of the version I was using at the time of development. In this case, I forgot to set the upper limit to be less than version 2.0. There are definitely many breaking changes from TF 1.x to 2.x!

Please feel free to use any version up until 2.0 (v1.15 should be fine).

By the way, it should be possible to "transplant" the model weights into a TF 2.x project, but it would require a bit of work. So, if you want to use this project as-is (pre-trained models and all), I would suggest sticking to TF 1.x for the fastest result. If you want to build on this work, it could be that spending the time to port to TF 2.x is worthwhile.

As for your specific errors, I'd have to look into it more deeply (and I can't say when I will have time to do that). TF 2.x does have a compatibility API (https://www.tensorflow.org/api_docs/python/tf/compat/v1) that you might be able to use to bridge the gap between TF 1.x and 2.x.

myndworks commented 4 years ago

I also found the same issues as @ingram-arginlerit. I would love to upgrade this to TF 2.0 but I am quite new to TF and don't have enough knowledge to do it.

I have spun a Google colab and was able to successfully run it by downgrading to TF 1.15.0 as suggested by @jasonrig

Steps to run in Google Colab

1. !pip install address-net
2. !pip install tensorflow==1.15.0
3. copy the predict.py to ./content
4. !python ./content/predict.py
Apoorvgarg-creator commented 2 years ago

@jasonrig, FixedLenFeature has moved from tf.FixedLenFeature into tf.io.FixedLenFeature. This has been used in dataset.py. Found this on the tensor flow website - Guide