Skip to content

Commit

Permalink
installation instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
diyor28 committed Mar 19, 2022
1 parent 19c38d6 commit 114c638
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM python:3.9.7
ENV PYTHONUNBUFFERED=1
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential openjdk-11-jdk zip unzip wget
RUN wget https://github.com/bazelbuild/bazel/releases/download/4.2.1/bazel-4.2.1-dist.zip
RUN mkdir bazel-4.2.1mkdir bazel-4.2.1
RUN unzip -d ./bazel-4.2.1 bazel-4.2.1-dist.zip
WORKDIR /bazel-4.2.1
RUN env EXTRA_BAZEL_ARGS="--host_javabase=@local_jdk//:jdk" bash ./compile.sh
RUN cp output/bazel /usr/local/bin

WORKDIR /

RUN apt-get -y install git

RUN git clone https://github.com/tensorflow/tensorflow
WORKDIR /tensorflow
RUN git checkout r2.8

RUN pip install -U pip six 'numpy<1.19.0' wheel setuptools mock 'future>=0.17.1'
RUN pip install -U keras_applications --no-deps
RUN pip install -U keras_preprocessing --no-deps

RUN bazel build --config=opt -c opt //tensorflow/tools/pip_package:build_pip_package
RUN ./bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
RUN pip install /tmp/tensorflow_pkg/tensorflow-2.8.0-cp39-cp39-linux_aarch64.whl

CMD ["python", "-c", "\"import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))\""]
39 changes: 38 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,39 @@
# debian-arch64
# tf-docker-m1
Tensorflow prebuilt wheel for Linux running inside Docker container on Apple Silicon

### How to install

Make sure you have wheel installed
```shell
pip install wheel
```
Pick a tensorflow and python version from [here](https://github.com/diyor28/tf-docker-m1/releases/tag/v1.0.0)
and install using:
```shell
pip install https://github.com/diyor28/tf-docker-m1/releases/download/v1.0.0/tensorflow-2.8.0-cp39-cp39-linux_aarch64.whl
```

or in a `Dockerfile` using

```
RUN pip install https://github.com/diyor28/tf-docker-m1/releases/download/v1.0.0/tensorflow-2.8.0-cp39-cp39-linux_aarch64.whl
```

You can also build tensorflow from source for your platform using the `Dockerfile` included in the repository.
First clone the repository.
```shell
git clone https://github.com/diyor28/tf-docker-m1.git
```

Then run
```shell
cd tf-docker-m1/
docker build -t tensorflow-image .
```

### Supported versions

Python: v3.9
Tensorflow: v2.8

NOTE: Other versions can be built and uploaded upon request.

0 comments on commit 114c638

Please sign in to comment.