简体   繁体   English

构建较旧的 Tensorflow 2.x

[英]Building an older Tensorflow 2.x

I have been trying to do this for a while now.我已经尝试这样做了一段时间了。 I wasn't able to get a build on my local machine so I went the Docker route.我无法在本地机器上构建,所以我选择了 Docker 路线。 I was able to successfully the use docker image devel-gpu to build Tensorflow.我能够成功地使用 docker image devel-gpu 来构建 Tensorflow。 The problem is that it built the latest and greatest (2.5).问题在于它构建了最新和最好的(2.5)。 I have searched and searched for a way to build an older 2.x version but have had no luck.我已经搜索并搜索了一种构建较旧 2.x 版本的方法,但没有成功。

How do you build, say TensorFlow 2.1 using docker?你如何构建,比如使用 docker 的 TensorFlow 2.1?

I seemed like they quit making docker images for individual versions that contained the source code to build.我似乎不再为包含要构建的源代码的各个版本制作 docker 镜像。

If you are fine with using already built images there are older versions available on Docker Hub.如果您可以使用已经构建的镜像,Docker Hub 上有旧版本可用。 Here is a link for 2.1: https://hub.docker.com/r/tensorflow/tensorflow/tags?page=1&name=2.1 This is the easiest way to obtain an older version.这是 2.1 的链接: https : //hub.docker.com/r/tensorflow/tensorflow/tags?page= 1 &name= 2.1 这是获取旧版本的最简单方法。

If you want to build it yourself:如果你想自己构建它:

  1. Clone the repository:克隆存储库:
git clone https://github.com/tensorflow/tensorflow.git && cd tensorflow
  1. Switch to the desired release:切换到所需的版本:
git checkout v2.1.0
  1. You'll find Dockerfiles in tensorflow/tools/dockerfiles/dockerfiles/ but before building I recommend you to check out tensorflow/tools/dockerfiles/README.md for exact building instructions.您将在tensorflow/tools/dockerfiles/dockerfiles/找到 Dockerfiles,但在构建之前,我建议您查看tensorflow/tools/dockerfiles/README.md以获取确切的构建说明。 For version 2.1.0 it states that you have to run build command setting context to the directory with the README.md .对于 2.1.0 版,它声明您必须使用README.md将构建命令设置上下文运行到目录中。 That is:那是:
cd tensorflow/tools/dockerfiles
docker build -f ./dockerfiles/cpu.Dockerfile -t tf .

And that's pretty much it, when building is finished you'll have an image named tf:latest (customize with flag -t in build command).差不多就是这样,构建完成后,您将拥有一个名为tf:latest的图像(在构建命令中使用标志-t进行自定义)。

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

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