-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit af836c2
Showing
4 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Tensorflow | ||
|
||
Docker files ready to build tensorflow and it's addons from source files. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: "3.9" | ||
services: | ||
tensorflow: | ||
build: | ||
context: ./tensorflow | ||
dockerfile: Dockerfile | ||
container_name: tensorflow | ||
image: tensorflow:r2.11 | ||
tensorflow-addons: | ||
build: | ||
context: ./tensorflow-addons | ||
dockerfile: Dockerfile | ||
container_name: tensorflow-addons | ||
image: tensorflow-addons:r0.18 | ||
depends_on: | ||
- "tensorflow" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
ARG UBUNTU_VERSION=latest | ||
FROM ubuntu:${UBUNTU_VERSION} AS tfa-build | ||
RUN apt-get update | ||
RUN apt-get install -y python3-dev python3-pip | ||
RUN pip install -U pip numpy wheel packaging requests opt_einsum | ||
RUN pip install -U keras_preprocessing --no-deps | ||
|
||
RUN apt-get install -y apt-transport-https curl gnupg | ||
RUN curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel-archive-keyring.gpg | ||
RUN mv bazel-archive-keyring.gpg /usr/share/keyrings | ||
RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/bazel-archive-keyring.gpg] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list | ||
ARG BAZEL_VERSION=5.3.0 | ||
RUN apt-get update && apt-get install -y bazel-${BAZEL_VERSION} | ||
RUN ln -s /usr/bin/bazel-${BAZEL_VERSION} /usr/bin/bazel | ||
|
||
WORKDIR / | ||
RUN apt-get -y install git rsync python-is-python3 | ||
RUN git clone https://github.com/tensorflow/addons.git | ||
WORKDIR /addons | ||
ARG TF_ADDONS_BRANCH=r0.18 | ||
RUN git checkout ${TF_ADDONS_BRANCH} | ||
RUN python ./configure.py | ||
RUN bazel build build_pip_pkg | ||
RUN bazel-bin/build_pip_pkg artifacts | ||
|
||
FROM ubuntu:${UBUNTU_VERSION} AS tfa-install | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
COPY --from=tfa-build /addons/artifacts/*.whl /wheels/ | ||
RUN pip install /wheels/tensorflow_addons-*.whl | ||
|
||
RUN python3 -c "import tensorflow_addons as tfa" | ||
|
||
CMD ["python3"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
ARG UBUNTU_VERSION=latest | ||
FROM ubuntu:${UBUNTU_VERSION} AS tf-build | ||
RUN apt-get update | ||
RUN apt-get install -y python3-dev python3-pip | ||
RUN pip install -U pip numpy wheel packaging requests opt_einsum | ||
RUN pip install -U keras_preprocessing --no-deps | ||
|
||
RUN apt-get install -y apt-transport-https curl gnupg | ||
RUN curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel-archive-keyring.gpg | ||
RUN mv bazel-archive-keyring.gpg /usr/share/keyrings | ||
RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/bazel-archive-keyring.gpg] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list | ||
ARG BAZEL_VERSION=5.3.0 | ||
RUN apt-get update && apt-get install -y bazel-${BAZEL_VERSION} | ||
RUN ln -s /usr/bin/bazel-${BAZEL_VERSION} /usr/bin/bazel | ||
|
||
WORKDIR / | ||
RUN apt-get -y install git | ||
|
||
RUN git clone https://github.com/tensorflow/tensorflow.git | ||
WORKDIR /tensorflow | ||
ARG TENSORFLOW_BRANCH=r2.11 | ||
RUN git checkout ${TENSORFLOW_BRANCH} | ||
|
||
# CPU support configuration | ||
RUN ./configure | ||
|
||
# CPU only support | ||
RUN bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package | ||
|
||
# GPU support | ||
#RUN bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package | ||
|
||
# Build pip whl package | ||
RUN ./bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg | ||
|
||
FROM ubuntu:${UBUNTU_VERSION} AS tf-install | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update | ||
RUN apt-get install -y python3 python3-pip | ||
COPY --from=tf-build /tmp/tensorflow_pkg/*.whl wheels/ | ||
RUN pip install /wheels/tensorflow-*.whl | ||
|
||
RUN python3 -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))" | ||
|
||
CMD ["python3"] |