Skip to content
Snippets Groups Projects
Unverified Commit 704f79fc authored by William Muir's avatar William Muir Committed by GitHub
Browse files

update golang install guide for 2.6.0 release (#38)

parent afce8817
No related branches found
No related tags found
No related merge requests found
...@@ -37,7 +37,7 @@ library is required for use of the TensorFlow Go package at runtime. For example ...@@ -37,7 +37,7 @@ library is required for use of the TensorFlow Go package at runtime. For example
on Linux (64-bit, x86): on Linux (64-bit, x86):
```sh ```sh
$ curl -L https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-2.5.0.tar.gz | tar xz --directory /usr/local $ curl -L https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-2.6.0.tar.gz | tar xz --directory /usr/local
$ ldconfig $ ldconfig
``` ```
...@@ -70,36 +70,42 @@ will be used in these instructions. ...@@ -70,36 +70,42 @@ will be used in these instructions.
- Clone the Tensorflow source respository to the install location - Clone the Tensorflow source respository to the install location
```sh ```sh
$ git clone --branch v2.5.0 https://github.com/tensorflow/tensorflow.git /go/src/github.com/tensorflow/tensorflow $ git clone --branch v2.6.0 https://github.com/tensorflow/tensorflow.git /go/src/github.com/tensorflow/tensorflow
``` ```
- Change the working directory to the install location. - Change the working directory to the install location
```sh ```sh
$ cd /go/src/github.com/tensorflow/tensorflow $ cd /go/src/github.com/tensorflow/tensorflow
``` ```
- Apply a patch to declare the Go package within Tensorflow's proto definition files - Initialize a new go.mod file
```sh ```sh
$ git format-patch -1 835d7da --stdout | git apply $ go mod init github.com/tensorflow/tensorflow
``` ```
- Initialize a new go.mod file - Fetch the Go protocol buffer package
```sh ```sh
$ go mod init github.com/tensorflow/tensorflow $ go get google.golang.org/protobuf/proto
``` ```
- Generate the protocol buffers and move the generating files to their correct locations. You - Generate the protocol buffers and move the generated output to its correct location
will receive two errors (`no required module provides package ...`), which you can ignore.
```sh ```sh
$ cd tensorflow/go $ cd tensorflow/go
$ go generate ./... $ (cd genop && go generate)
$ mv vendor/github.com/tensorflow/tensorflow/tensorflow/go/* . $ mv vendor/github.com/tensorflow/tensorflow/tensorflow/go/* .
``` ```
- Generate wrappers
```sh
$ (cd op && go generate)
```
- Add missing modules - Add missing modules
```sh ```sh
...@@ -125,7 +131,7 @@ example: ...@@ -125,7 +131,7 @@ example:
```sh ```sh
$ go mod init hello-world $ go mod init hello-world
$ go mod edit -require github.com/tensorflow/tensorflow@v2.5.0+incompatible $ go mod edit -require github.com/tensorflow/tensorflow@v2.6.0+incompatible
$ go mod edit -replace github.com/tensorflow/tensorflow=/go/src/github.com/tensorflow/tensorflow $ go mod edit -replace github.com/tensorflow/tensorflow=/go/src/github.com/tensorflow/tensorflow
$ go mod tidy $ go mod tidy
``` ```
...@@ -171,7 +177,7 @@ func main() { ...@@ -171,7 +177,7 @@ func main() {
```sh ```sh
$ go mod init app $ go mod init app
$ go mod edit -require github.com/tensorflow/tensorflow@v2.5.0+incompatible $ go mod edit -require github.com/tensorflow/tensorflow@v2.6.0+incompatible
$ go mod edit -replace github.com/tensorflow/tensorflow=/go/src/github.com/tensorflow/tensorflow $ go mod edit -replace github.com/tensorflow/tensorflow=/go/src/github.com/tensorflow/tensorflow
$ go mod tidy $ go mod tidy
``` ```
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
FROM golang:1.16-buster FROM golang:1.16-buster
# 1. Install the TensorFlow C library (v2.5.0) # 1. Install the TensorFlow C library (v2.6.0)
RUN curl -L https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-$(uname -m)-2.5.0.tar.gz \ RUN curl -L https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-$(uname -m)-2.6.0.tar.gz \
| tar xz --directory /usr/local \ | tar xz --directory /usr/local \
&& ldconfig && ldconfig
...@@ -27,13 +27,14 @@ RUN apt-get update && apt-get -y install --no-install-recommends \ ...@@ -27,13 +27,14 @@ RUN apt-get update && apt-get -y install --no-install-recommends \
protobuf-compiler protobuf-compiler
# 3. Install and setup the Tensorflow Go API # 3. Install and setup the Tensorflow Go API
RUN git clone --branch v2.5.0 https://github.com/tensorflow/tensorflow.git /go/src/github.com/tensorflow/tensorflow \ RUN git clone --branch v2.6.0 https://github.com/tensorflow/tensorflow.git /go/src/github.com/tensorflow/tensorflow \
&& cd /go/src/github.com/tensorflow/tensorflow \ && cd /go/src/github.com/tensorflow/tensorflow \
&& git format-patch -1 835d7da --stdout | git apply \
&& go mod init github.com/tensorflow/tensorflow \ && go mod init github.com/tensorflow/tensorflow \
&& go get google.golang.org/protobuf/proto \
&& cd tensorflow/go \ && cd tensorflow/go \
&& (go generate ./... || true) \ && (cd genop && go generate) \
&& mv vendor/github.com/tensorflow/tensorflow/tensorflow/go/* . \ && mv vendor/github.com/tensorflow/tensorflow/tensorflow/go/* . \
&& (cd op && go generate) \
&& go mod tidy \ && go mod tidy \
&& go test ./... && go test ./...
...@@ -42,7 +43,7 @@ RUN git clone --branch v2.5.0 https://github.com/tensorflow/tensorflow.git /go/s ...@@ -42,7 +43,7 @@ RUN git clone --branch v2.5.0 https://github.com/tensorflow/tensorflow.git /go/s
WORKDIR /example-program WORKDIR /example-program
COPY hello_tf.go . COPY hello_tf.go .
RUN go mod init app \ RUN go mod init app \
&& go mod edit -require github.com/tensorflow/tensorflow@v2.5.0+incompatible \ && go mod edit -require github.com/tensorflow/tensorflow@v2.6.0+incompatible \
&& go mod edit -replace github.com/tensorflow/tensorflow=/go/src/github.com/tensorflow/tensorflow \ && go mod edit -replace github.com/tensorflow/tensorflow=/go/src/github.com/tensorflow/tensorflow \
&& go mod tidy \ && go mod tidy \
&& go build && go build
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment