Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
3de0665
Test and push ARM build
xuhdev Jan 23, 2020
49621d6
Remove the exclusion of non-existing folders
xuhdev Jan 23, 2020
b2a4022
Remove non-existent file
xuhdev Jan 23, 2020
3996c86
Add back pip install -r requirements-test.txt
xuhdev Jan 23, 2020
5855167
Create requirements-test.txt
xuhdev Jan 23, 2020
7a2e7f8
Move pip install up
xuhdev Jan 23, 2020
512892b
Downgrade tensorflow to 1.14.0 for ARM compatibility
xuhdev Jan 23, 2020
30730dc
Update requirements.txt
xuhdev Jan 23, 2020
77bf5ad
Update requirements.txt
xuhdev Jan 23, 2020
6c82045
Install tensorflow from a given URL on Pi
xuhdev Jan 23, 2020
f0038d4
Update Dockerfile.arm32v7
xuhdev Jan 23, 2020
042ce09
our own fork of pip
xuhdev Jan 24, 2020
e5de214
tensorflow 1.13.1
xuhdev Jan 24, 2020
cf62145
Remove existing pip
xuhdev Jan 24, 2020
7b37483
60 seconds
xuhdev Jan 24, 2020
86fc556
Merge branch 'master' into xuhdev-patch-1
bdwyer2 Feb 11, 2020
eab64f3
Merge branch 'master' into xuhdev-patch-1
bdwyer2 Mar 9, 2020
d0af3c6
Merge branch 'master' into xuhdev-patch-1
bdwyer2 Mar 9, 2020
3cc2b10
Merge branch 'master' into xuhdev-patch-1
bdwyer2 Jun 11, 2020
ebf7e9e
add ARM documentation to README
bdwyer2 Jun 11, 2020
9d9cd4f
Use TF 1.14.0 for arm32v7
xuhdev Jun 11, 2020
e73f12f
Pin numba version to be 0.49.1
xuhdev Jun 11, 2020
cdd710a
Temporarily disable `-d` and see what's going on on Travis
xuhdev Jun 11, 2020
9cef4dd
Remove "-it" as well
xuhdev Jun 11, 2020
561cdf5
Figure out where libhdfs is
xuhdev Jun 11, 2020
fb121c6
Install mlocate
xuhdev Jun 11, 2020
c4d8c26
Try 1.13.1
xuhdev Jun 12, 2020
bded5a1
Revert "mlocate"
xuhdev Jun 12, 2020
a928330
Merge branch 'master' into xuhdev-patch-1
bdwyer2 Dec 9, 2020
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
39 changes: 36 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,48 @@
language: python

python:
- 3.6
- 3.7

services:
- docker

before_install:
# Replace all slashes (which are common in branch names) in VERSION with dashes for Docker compatibility
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then
VERSION=latest;
else
VERSION=${TRAVIS_BRANCH//\//-};
fi

# Default variables (used by Jenkins)
- '[[ -z "$DOCKERFILE" ]] && export DOCKERFILE=Dockerfile || /bin/true'
- '[[ -z "$IMAGE" ]] && export IMAGE=test || /bin/true'
- '[[ -z "$ARCH" ]] && export ARCH=x86_64 || /bin/true'
- '[[ -z "$VERSION" ]] && export VERSION=jenkins || /bin/true'

install:
- docker build -t max-audio-classifier .
- docker run -it -d -p 5000:5000 max-audio-classifier
- docker build -f "$DOCKERFILE" -t codait/max-audio-classifier:"$IMAGE"-"$ARCH"-"$VERSION" .
- docker run --rm -p 5000:5000 codait/max-audio-classifier:"$IMAGE"-"$ARCH"-"$VERSION"
- pip install -r requirements-test.txt

before_script:
- flake8 . --max-line-length=127
- bandit -r .
- sleep 30

script:
- pytest tests/test.py

after_success:
- if [[ "$IMAGE" != "test" && "$TRAVIS_PULL_REQUEST" == "false" ]] && [[ "$TRAVIS_BRANCH" == "master" || "$TRAVIS_BRANCH" == "$TRAVIS_TAG" ]]; then
echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin;
docker push codait/max-audio-classifier:"$IMAGE"-"$ARCH"-"$VERSION";
fi

matrix:
include:
- os: linux
env: DOCKERFILE=Dockerfile IMAGE=test ARCH=x86_64
- os: linux
arch: arm64
env: DOCKERFILE=Dockerfile.arm32v7 IMAGE=arm ARCH=arm32v7
9 changes: 6 additions & 3 deletions Dockerfile.arm32v7
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2018-2019 IBM Corp. All Rights Reserved.
# Copyright 2018-2020 IBM Corp. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

FROM quay.io/codait/max-base:arm-arm32v7-v1.3.3

ARG model_bucket=https://max-cdn.cdn.appdomain.cloud/max-audio-classifier/1.0.0
Expand All @@ -26,14 +27,16 @@ RUN apt-get update && apt-get -y install llvm-dev libatlas3-base libhdf5-dev &&
RUN wget -nv --show-progress --progress=bar:force:noscroll ${model_bucket}/${model_file} --output-document=assets/${model_file} && \
tar -x -C assets/ -f assets/${model_file} -v && rm assets/${model_file}

RUN python -m pip install https://www.piwheels.org/simple/tensorflow/tensorflow-1.13.1-cp37-none-linux_armv7l.whl

COPY requirements.txt /workspace
RUN pip install -r requirements.txt
# Skip tensorflow in requirements.txt
RUN grep -v 'tensorflow' requirements.txt | python -m pip install -r /dev/stdin

COPY . /workspace

# check file integrity
RUN sha512sum -c sha512sums.txt

EXPOSE 5000

CMD python app.py
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,16 @@ arXiv:1609.09430, 2016.

To run the docker image, which automatically starts the model serving API, run:

Intel CPUs:
```bash
$ docker run -it -p 5000:5000 quay.io/codait/max-audio-classifier
```

ARM CPUs (eg Raspberry Pi):
```bash
$ docker run -it -p 5000:5000 codait/max-audio-classifier:arm-arm32v7-latest
```

This will pull a pre-built image from the Quay.io container registry (or use an existing image if already cached locally) and run it.
If you'd rather checkout and build the model locally you can follow the [run locally](#run-locally) steps below.

Expand Down Expand Up @@ -116,6 +122,12 @@ To build the Docker image locally, run:
$ docker build -t max-audio-classifier .
```

For ARM CPUs (eg Raspberry Pi), run:

```bash
$ docker build -f Dockerfile.arm32v7 -t max-audio-classifier .
```

All required model assets will be downloaded during the build process. _Note_ that currently this Docker image is CPU
only (we will add support for GPU images later).

Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ resampy==0.2.1
pandas==0.24.2
keras==2.2.4
h5py==2.9.0
# pin numba (dependency of resampy) version to be 0.49.1, because numba 0.50.1 depends on a higher version of llvmlite that travis doesn't have: https://github.com/numba/numba/commit/c2ae57a4a3ed1687f843b724a1a160188c1db2ef
numba==0.49.1