我没有在Tensorflow的经验,最近开始研究NLP。遇到了基于注意是你所需要的文件的变压器的Tensorflow实现。
Tensor2Tensor包有一个快速启动部分,其中有一个colab链接
快速入门 这个iPython笔记本解释T2T并在浏览器中运行,使用来自谷歌的免费VM,不需要安装。
我想要运行这个,它会产生错误
ValueError: Tensorflow 1 is unsupported in Colab.
Your notebook should be updated to use Tensorflow 2.
See the guide at https://www.tensorflow.org/guide/migrate#migrate-from-tensorflow-1x-to-tensorflow-2.不知道该改变什么。
我不应该运行colab,只是观察已经打印出来的结果。有我可以运行和看到的Tensorflow 2版本吗?
发布于 2022-08-26 12:30:35
从错误来看,您想要使用的代码是基于Tensorflow 1的,您应该知道Colab最近使用了移除支座 for Tf1。不过,您仍然可以手动安装它。只需删除先前的Tf2安装,并将其替换为以前的版本,如下所示:
!pip uninstall tensorflow
!pip install tensorflow-gpu==1.15这几乎总是足够的(可以要求您重新启动运行时以使更改生效)。但是,如果您由于Cuda的版本而体验到错误,您也可以尝试重新安装cuda和libcudnn:
!apt install --allow-change-held-packages libcudnn7=7.4.1.5-1+cuda10.0更新:
手动安装tensorflow 1之后,您可以删除指令%tensorflow_version 1.x,这被称为魔术。在Colab停止使用tf1之前,可以使用这个指令来激活它,而不是手工安装。
同样在回购的QuickStart中,它说你也应该安装两个软件包。因此,在安装tensorflow之后,添加:
!pip install tensor2tensor
!pip install t2t-trainer 发布于 2022-09-01 02:28:42
在遵循上述步骤之后,我遇到了以下错误:
Loaded runtime CuDNN library: 7.4.1 but source was compiled with: 7.6.0. CuDNN library major and minor version needs to match or have higher minor version in case of CuDNN 7.0 or later version. If using a binary install, upgrade your CuDNN library. If building from sources, make sure the library loaded at runtime is compatible with the version specified during compile configuration似乎即使在安装了兼容的cudnn版本之后,它也不能工作,我如何解决这个问题?
https://stackoverflow.com/questions/73498648
复制相似问题