简体   繁体   中英

keras version to use with tensorflow-gpu 1.4

I am using ubuntu 16, with python 3, tf-GPU with keras.

I downgraded to tf 1.4 due to cuda errors as explained here

But now I am getting this error

TypeError: softmax() got an unexpected keyword argument 'axis'

Seems that this is an API change in tensorflow and new keras is not suitable for the old tf.

I can't find what is the correct keras version to use with tf 1.4 gpu. What is the correct one?

Keras - Tensorflow versions compatibility is a frequent problem that i have faced many times myself. I am keeping in my bookmarks this compatibility table , with matches of tensorflow and keras versions. It would seem that keras 2.0.8 is compatible with tensorflow 1.4 .

If you are using keras exclusively with the tensorflow backend, I would recommend to use the keras implementation found in tf.keras rather than the keras module. That way, you won't scratch your head about possible incompatibilities or bugs (see also that question).

There does not seem to be proper documentation on which Keras version targets which TensorFlow version. The quickest way to solve your problem may be just downgrading Keras one version at a time until you find one that works (or, conversely, upgrading one version at a time from one that you know to work until it breaks). If you find that tedious you can do it as a binary search.

Looking at the releases page , it seems that version 2.0.8 should be compatible with TensorFlow 1.4; it's about a year old already but at least you have an starting point there.

I was able to use the conda package manager to install keras and keras-gpu, with a compatible tensorflow and cuda versions to get past your TypeError: softmax() ... error message when I was trying to load the original BERT tensorflow checkpoint using the keras-bert package:

$ conda create -n bert python=3.6
$ conda activate bert
$ conda install keras==2.0.8
$ conda install keras-gpu==2.0.8
$ pip install keras-pos-embd==0.10.0
$ pip install keras-transformer==0.22.0

I am using tensorflow version 1.15.4 and installing Keras version 2.3.1 fixed my problem.

BTW, this page is useful. Find your intended tensorflow version and then click on corresponding Packages and Nvidia Settings .

setuptools==41.0.0
numpy
matplotlib
pandas
pydub
scipy
tensorflow==1.15.4
keras==2.3.1
python_speech_features
praat-parselmouth
pyquaternion

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM