Compatibility issues between keras and tensorflow - tensorflow

I want to ask about compatibility issues between keras and tensorflow.
Specifically, how can I find the latest compatible version of keras and tensorflow? I found a lot of places including the official website of keras and did not find how to find the tensorflow version compatible with the latest keras2.24.
My current version of tensorflow+keras is 1.4.0+2.1.0, which does not support some new features.

If you don't care about having the latest Keras version, you can use the tf.Keras module that is already available with your Tensorflow installation. Check here
As per the doc:
tf.keras can run any Keras-compatible code, but keep in mind:
The tf.keras version in the latest TensorFlow release might not be the
same as the latest keras version from PyPI. Check tf.keras.version.
When saving a model's weights, tf.keras defaults to the checkpoint
format. Pass save_format='h5' to use HDF5.

I have tensorflow 1.12.0 with keras 2.2.4. I got this by downloading the latest (Anaconda3-2018.12-Windows-x86_64.exe) anaconda which has conda 4.6.4 and python 3.6.8.
I believe I then did a conda update conda and a conda update anaconda.
I then did a conda install tensorflow and a conda install keras.

Activate your environment and update your anaconda version using
conda update anaconda
Next uninstall tensorflow and keras as below
pip uninstall keras
pip uninstall tensorflow
Install Keras and tensorflow again
pip install tensorflow
pip install keras
check the version is updated.If it is not possible comment below.

Related

problem with importing tensorflow probability

I am using Anaconda and Ubuntu 18.04. I installed TensorFlow probability base on Anaconda's command:
conda install -c conda-forge tensorflow-probability
but when I wanted to import TensorFlow probability, I faced with below error:
ImportError: cannot import name 'compiler' from 'tensorflow.python.autograph.pyct' (/home/alireza/anaconda3/envs/tf-gpu/lib/python3.8/site-packages/tensorflow/python/autograph/pyct/init.py)
I check Anaconda by conda list tensorflow and TensorFlow probability version 0.8 was installed.
I appreciate your suggestion.
I think it's been a long time since the conda recipe for TFP was updated (TFP is now at 0.12), so you would need to ensure the version of TensorFlow you have is compatible. FWIW from the 0.8 release notes: "It is tested and stable against TensorFlow version 2.0.0 and 1.15.0rc1."

AttributeError: module 'tensorflow._api.v1.config' has no attribute 'set_visible_devices'

First of all, I apologize that my English is not good for you to understand.
Currently, I am doing computer vision using tensorflow version 1.14. In the process, the following problem ocurred in the process of rotating the model using GPU.
AttributeError: module 'tensorflow._api.v1.config' has no attribute 'set_visible_devices'
The current development environment is as follows.
Python: 3.7.9
conda: 4.8.3
tensorflow: 1.14.0
keras: 2.3.1
In addition, I currently have 4 gpu, and i want to use 2 gpu as if it were 1 gpu. Can you give me a good idea for this?
thank you.
It seems you need to upgrade the tensorflow because tf.config.set_visible_devices() function is available in latest version of tensorflow, you can use below code to upgrade the tensorflow:
!pip install --upgrade pip.
!pip install --upgrade tensorflow
You can follow the link to install the CPU/GPU version of tensorflow as per requirement and for tf.config.set_visible_devices() function related details, check here

How to downgrade Keras in colab ? "NotFoundError: No algorithm worked!"

I was getting the error "NotFoundError: No algorithm worked!" on an architecture that was developed based on the older versions of tensorflow (pre-2.0.0 versions), and that is run on Colab.
Now, Google Colab has an updated version of Tensorflow (post-2.0.0 versions) and Keras.
Following the question that was asked here I downgraded Tensorflow to 1.15.0 : How to downgrade tensorflow version in colab?
I used this command to downgrade Tensorflow :
!pip install tensorflow==1.15.0
import tensorflow as tf
Still, I have a problem importing Keras.
To solve the problem, I downgraded the Keras version to 2.2.4 using this command :
!pip install keras==2.2.4

Installed pytorch with conda which changed my TF version to 1.13.0 now conda install tensorflow-gpu=2.0 not working?

Like I said in title I installed pytorch with conda install and that downgraded my tensorflow version to 1.13.0 and now conda install tensorflow-gpu=2.0 is not working how can I get the command to execute?
I would suggest that you try to install tensorflow with pip. pip install -U tensorflow-gpu
https://www.tensorflow.org/install/gpu
I am using pytorch, but my env has pytorch 1.2 + tensorflow 2.1
You should have installed pyTorch in another virtual environment but since now it has been installed.
I would recommend you to create a virtual environment and install TF plus other libraries in it. Because I am sure you would not use both PyTorch and TF in the same program for ML.

Tensorflow has no attribute 'svd'

The documentation indicate that tensorflow has a svd operator.
However, I can't find it in my tensorflow with pip for python2.7
I used these command on Mac:
pip install https://storage.googleapis.com/tensorflow/mac/tensorflow-0.8.0-py2-none-any.whl
Any suggestion would be appreciated.
You are trying to install tensorflow 0.8. The SVD was introduced in tensorflow 0.10. Try installing a more recent version. (Current version is 1.2).