简体   繁体   中英

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. I was able to successfully the use docker image devel-gpu to build Tensorflow. The problem is that it built the latest and greatest (2.5). I have searched and searched for a way to build an older 2.x version but have had no luck.

How do you build, say TensorFlow 2.1 using docker?

I seemed like they quit making docker images for individual versions that contained the source code to build.

If you are fine with using already built images there are older versions available on 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.

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. For version 2.1.0 it states that you have to run build command setting context to the directory with the 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).

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