TF 2 compatibility
Created by: scarlehoff
As the title says.
This is a compatibility fix. At first I was going to go full TF 2.0 as said in #570 (closed) but it doesn't seem to be worth it as at the moment is a lot of work and, according to Google, it is slower. Our case is in the "sad end" of the spectrum from what I've read. For instance in https://www.tensorflow.org/guide/eager#benchmarks (although they talk here about GPU).
Some of the things we talked in the past about (like doing many replicas at once) would help here. But these are not high priority.
I tried to follow TF official guide, except that this statement
It is still possible to run 1.X code, unmodified (except for contrib), in TensorFlow 2.0: import tensorflow.compat.v1 as tf tf.disable_v2_behavior()
is a lie. That's why there are a few things I had to move around.
I also ignore the recommendation of using tf.keras instead of keras because TF is still in 2.2.4 while 2.3 brings features needed for the compatibility they talk about ?? Maybe I need to be more careful when using tf.keras
, I'll give it a second change.
I hope to have this ready for tomorrow after checking this last point and performing a fit.
Edit: I have to say I am a bit dissapointed by the lack of care TF/Google shows moving from TF 1. to TF 2. Many projects not actively developed will be basically broken forever because the effort to fix it is just not worth it (they provide a "automigration" script which should make a multibillion company ashamed tbh).