-
Notifications
You must be signed in to change notification settings - Fork 5
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
Showing
2 changed files
with
66 additions
and
1 deletion.
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,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])))\""] |
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 |
---|---|---|
@@ -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. |