Skip to content

Commit

Permalink
Update to TensorFlow 2.12 (#292)
Browse files Browse the repository at this point in the history
* Fix compilation with tensorflow 2.12 and higher

* Update tensorflow submodule to 2.12.0

* Update Dockerfiles to 2.12.0
  • Loading branch information
jbransen authored Aug 15, 2023
1 parent bfd8de5 commit 925c2e9
Show file tree
Hide file tree
Showing 8 changed files with 204 additions and 54 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ working, the following commands will compile and run the tests.
```
git clone --recursive https://github.com/tensorflow/haskell.git tensorflow-haskell
cd tensorflow-haskell
docker build -t tensorflow/haskell:2.10.1 docker
docker build -t tensorflow/haskell:2.12.0 docker
# TODO: move the setup step to the docker script.
stack --docker setup
stack --docker test
Expand All @@ -90,7 +90,7 @@ stack --docker build --exec Main
If you want to use GPU you can do:

```
IMAGE_NAME=tensorflow/haskell:2.10.1-gpu
IMAGE_NAME=tensorflow/haskell:2.12.0-gpu
docker build -t $IMAGE_NAME docker/gpu
# TODO: move the setup step to the docker script.
stack --docker --docker-image=$IMAGE_NAME setup
Expand Down
6 changes: 3 additions & 3 deletions ci_build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# stack to be installed on the host. This comes at the expense of
# flexibility.

FROM tensorflow/tensorflow:2.10.1
FROM tensorflow/tensorflow:2.12.0
LABEL maintainer="TensorFlow authors <[email protected]>"

# The build context directory is the top of the tensorflow-haskell
Expand Down Expand Up @@ -36,8 +36,8 @@ RUN \
curl -O -L https://github.com/google/protobuf/releases/download/v3.13.0/protoc-3.13.0-linux-x86_64.zip && \
unzip -d /usr/local protoc-3.13.0-linux-x86_64.zip bin/protoc && \
chmod 755 /usr/local/bin/protoc && \
curl -O https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-2.10.1.tar.gz && \
tar zxf libtensorflow-cpu-linux-x86_64-2.10.1.tar.gz -C /usr/local && \
curl -O https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-2.12.0.tar.gz && \
tar zxf libtensorflow-cpu-linux-x86_64-2.12.0.tar.gz -C /usr/local && \
ldconfig && \
stack setup && \
stack test --only-dependencies
8 changes: 4 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Prepare the image with:
# docker build -t tensorflow/haskell:2.10.1 docker
FROM tensorflow/tensorflow:2.10.1
# docker build -t tensorflow/haskell:2.12.0 docker
FROM tensorflow/tensorflow:2.12.0
LABEL maintainer="TensorFlow authors <[email protected]>"

RUN apt-get update
Expand Down Expand Up @@ -31,8 +31,8 @@ RUN \
curl -O -L https://github.com/google/protobuf/releases/download/v3.13.0/protoc-3.13.0-linux-x86_64.zip && \
unzip -d /usr/local protoc-3.13.0-linux-x86_64.zip bin/protoc && \
chmod 755 /usr/local/bin/protoc && \
curl -O https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-2.10.1.tar.gz && \
tar zxf libtensorflow-cpu-linux-x86_64-2.10.1.tar.gz -C /usr/local && \
curl -O https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-2.12.0.tar.gz && \
tar zxf libtensorflow-cpu-linux-x86_64-2.12.0.tar.gz -C /usr/local && \
ldconfig

ENV LANG en_US.UTF-8
8 changes: 4 additions & 4 deletions docker/gpu/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Prepare the image with:
# docker build -t tensorflow/haskell:2.10.1-gpu docker/gpu
FROM tensorflow/tensorflow:2.10.1-gpu
# docker build -t tensorflow/haskell:2.12.0-gpu docker/gpu
FROM tensorflow/tensorflow:2.12.0-gpu
LABEL maintainer="TensorFlow authors <[email protected]>"

RUN apt-get update
Expand Down Expand Up @@ -31,8 +31,8 @@ RUN \
curl -O -L https://github.com/google/protobuf/releases/download/v3.13.0/protoc-3.13.0-linux-x86_64.zip && \
unzip -d /usr/local protoc-3.13.0-linux-x86_64.zip bin/protoc && \
chmod 755 /usr/local/bin/protoc && \
curl -O https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-linux-x86_64-2.10.1.tar.gz && \
tar zxf libtensorflow-gpu-linux-x86_64-2.10.1.tar.gz -C /usr/local && \
curl -O https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-linux-x86_64-2.12.0.tar.gz && \
tar zxf libtensorflow-gpu-linux-x86_64-2.12.0.tar.gz -C /usr/local && \
ldconfig

ENV LANG en_US.UTF-8
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ extra-include-dirs:

docker:
enable: false
image: tensorflow/haskell:2.10.1
image: tensorflow/haskell:2.12.0

nix:
enable: false
Expand Down
222 changes: 186 additions & 36 deletions tensorflow-proto/tensorflow-proto.cabal

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions tensorflow/src/TensorFlow/Internal/FFI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ resolveOperation graph name = do
where
exception =
let msg = "Operation not found in graph: " <> (T.pack $ show name)
in TensorFlowException Raw.TF_INVALID_ARGUMENT msg
in TensorFlowException Raw.TSL_INVALID_ARGUMENT msg


-- Internal.
Expand Down Expand Up @@ -325,7 +325,7 @@ checkStatus fn =
bracket Raw.newStatus Raw.deleteStatus $ \status -> do
result <- fn status
code <- Raw.getCode status
when (code /= Raw.TF_OK) $ do
when (code /= Raw.TSL_OK) $ do
msg <- T.decodeUtf8With T.lenientDecode <$>
(Raw.message status >>= B.packCString)
throwM $ TensorFlowException code msg
Expand Down Expand Up @@ -372,4 +372,4 @@ getAllOpList =
when (p == nullPtr) (throwM exception)
return p
exception = TensorFlowException
Raw.TF_UNKNOWN "GetAllOpList failure, check logs"
Raw.TSL_UNKNOWN "GetAllOpList failure, check logs"
2 changes: 1 addition & 1 deletion third_party/tensorflow
Submodule tensorflow updated 11710 files

0 comments on commit 925c2e9

Please sign in to comment.