Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

armhf support #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions function/Dockerfile.armhf
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
ARG RASPBIAN_VERSION=stretch
FROM resin/rpi-raspbian:$RASPBIAN_VERSION

# update apt
RUN apt-get update \
&& apt-get install -y --no-install-recommends apt-utils \
# install necessary build tools \
&& apt-get -qy install build-essential cmake pkg-config unzip wget make \
# install necessary libraries \
&& apt-get -qy install \
libgtk2.0-dev \
libgtk-3-dev \
libatlas-base-dev \
gfortran \
python2.7-dev \
python3-dev \
python-pip \
python-numpy \
python3-pip \
python3-numpy \
python3-markdown \
python3-networkx \
python3-h5py \
python3-lxml \
python3-matplotlib \
python3-protobuf \
python3-dateutil \
python3-scipy \
python3-six \
libraspberrypi0 \
python-setuptools \
python3-setuptools \
# cleanup apt. \
&& apt-get purge -y --auto-remove \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /root/

COPY requirements.txt ./

RUN pip3 install -r requirements.txt

RUN wget https://storage.googleapis.com/download.tensorflow.org/deps/pi/2018_03_22/tensorflow-1.6.0-cp35-none-any.whl
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we && these instructions for fewer layers with rm tensorflow-1.6.0-cp35-none-any.whl being part of that same block?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the pip req install is so tightly coupled to tensorflow, probably better to also group the installation of the wheel file itself too (the layer right after L43 as well..).

RUN pip3 install tensorflow-1.6.0-cp35-none-any.whl

ENV TF_CPP_MIN_LOG_LEVEL=3
COPY *.py ./

RUN python3 ./pre_download.py

RUN curl -sSL https://github.com/openfaas/faas/releases/download/0.7.0/fwatchdog-armhf > /usr/bin/fwatchdog \
&& chmod +x /usr/bin/fwatchdog

ENV write_debug="true"
ENV fprocess="python3 index.py"

CMD ["fwatchdog"]
2 changes: 1 addition & 1 deletion function/inception.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,5 +585,5 @@ def invoke(body):
########################################################################

if __name__ == '__main__':
print(invoke())
print(invoke(os.path.join(data_dir, 'cropped_panda.jpg')))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this change get made?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when testing inception.py to make sure tensorflow worked, i wanted to run 'python3 inception.py', but the old version didn't supply a body arg so it crashed.


6 changes: 0 additions & 6 deletions function/pre_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,7 @@
# Copyright 2016 by Magnus Erik Hvass Pedersen
#
########################################################################
import json
import numpy as np
import tensorflow as tf
import download
from cache import cache
import os
import sys

########################################################################
# Various directories and file-names.
Expand Down
24 changes: 17 additions & 7 deletions function/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,27 @@
# want to install the CPU or GPU version of TensorFlow.
#
################################################################
# Wheel needs to be installed directly for tensorflow installation to work
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes may break the regular x86_64 version, what if we added a new requirements-armhf.txt file?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes good catch. we'll need that

wheel


# Basic packages used in many of the tutorials.
# using apt for some like numpy and scipy, others skipping for the inception POC

numpy
scipy
jupyter
matplotlib
Pillow
scikit-learn
# numpy
# scipy
# jupyter
# matplotlib
# Pillow
# scikit-learn

################################################################
# TensorFlow can be installed either as CPU or GPU versions.
# You select which one to install by (un)commenting these lines.

tensorflow # CPU Version of TensorFlow.
# install with wheel file inside Dockerfile.armhf instead

# tensorflow # CPU Version of TensorFlow.
# tensorflow-gpu # GPU version of TensorFlow.

# Builder API for TensorFlow used in many of the tutorials.
Expand All @@ -43,3 +50,6 @@ prettytensor
http_parser

requests

# version locked tensorflow dependency
grpcio==1.9.1