1

My project requires Tensorflow 1.x and Tensorflow 2.x versions as this different versions do a specific task in the work flow. For deployment how do I add this to the workflow so I can programmatically select the instance to use the required version for the task. What’s the best solution

  • Have you tried using virtual environments? They may seem tedious at first, but they're useful for exactly your situation. – Sean Apr 03 '21 at 11:46
  • can I be able to interact with both envs programmatically – Okafor Zuruoke Apr 03 '21 at 14:16
  • I'm not sure what exactly you mean, but yes, you can activate/deactivate virtual environments using a Python script. Take a look at this: https://stackoverflow.com/questions/6943208/activate-a-virtualenv-with-a-python-script – Sean Apr 04 '21 at 03:36
  • According to me you can't use two different versions in the same project. *Why don't you convert whole code into `TF 2.x`?* However there is work around. Except for `contrib`, It is still possible to run `1.x` code in `2.x` using `tf.compat.v1`. You can use `tf.function` decorator to make it run efficiently in graph mode. For more details you can refer [Migrate your TF1 code to TF2 guide](https://www.tensorflow.org/guide/migrate). Thanks! –  Apr 14 '21 at 12:37

0 Answers0