简体   繁体   English

与 tensorflow-gpu 1.4 一起使用的 keras 版本

[英]keras version to use with tensorflow-gpu 1.4

I am using ubuntu 16, with python 3, tf-GPU with keras.我正在使用 ubuntu 16,带有 python 3,带有 keras 的 tf-GPU。

I downgraded to tf 1.4 due to cuda errors as explained here我降级到TF 1.4由于CUDA错误,说明这里

But now I am getting this error但现在我收到这个错误

TypeError: softmax() got an unexpected keyword argument 'axis'类型错误:softmax() 得到了一个意外的关键字参数“轴”

Seems that this is an API change in tensorflow and new keras is not suitable for the old tf.似乎这是tensorflow中的API变化,新的keras不适用于旧的tf。

I can't find what is the correct keras version to use with tf 1.4 gpu.我找不到与 tf 1.4 gpu 一起使用的正确 keras 版本。 What is the correct one?什么是正确的?

Keras - Tensorflow versions compatibility is a frequent problem that i have faced many times myself. Keras - Tensorflow 版本兼容性是我自己多次遇到的常见问题。 I am keeping in my bookmarks this compatibility table , with matches of tensorflow and keras versions.我将此兼容性表保留在我的书签,其中包含tensorflowkeras版本的匹配项。 It would seem that keras 2.0.8 is compatible with tensorflow 1.4 .似乎keras 2.0.8tensorflow 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.如果您仅将 keras 与 tensorflow 后端一起使用,我建议您使用tf.keras的 keras 实现而不是keras模块。 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.似乎没有关于哪个 Keras 版本针对哪个 TensorFlow 版本的正确文档。 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).解决问题的最快方法可能是一次降级 Keras 一个版本,直到找到一个可用的版本(或者,相反,从一个您知道可以工作的版本升级一个版本,直到它崩溃)。 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;查看发布页面,似乎2.0.8 版本应该与 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 包管理器来安装 keras 和 keras-gpu,并使用兼容的 tensorflow 和 cuda 版本来解决您的TypeError: softmax() ... 当我尝试使用加载原始 BERT tensorflow 检查点时的错误消息keras-bert包:

$ 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.我正在使用 tensorflow 1.15.4 版并安装 Keras 2.3.1 版解决了我的问题。

BTW, this page is useful.顺便说一句,这个页面很有用。 Find your intended tensorflow version and then click on corresponding Packages and Nvidia Settings .找到您想要的 tensorflow 版本,然后单击相应的Packages 和 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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