Skip to content

Commit

Permalink
make sure models exist
Browse files Browse the repository at this point in the history
  • Loading branch information
bourdakos1 committed Mar 31, 2020
1 parent f5dd3bc commit 61f00b7
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ jobs:
install: curl -sL https://ibm.biz/idt-installer | bash
script: pushd docs && ./deploy.sh && popd
- stage: test
script: pushd trainer && make classification && popd
script: pushd trainer && make test_classification && popd
- stage: test
script: pushd trainer && make object_detection && popd
script: pushd trainer && make test_object_detection && popd
- stage: deploy
script: skip
deploy:
Expand Down
1 change: 1 addition & 0 deletions trainer/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
test_cache
tmp

_site
.sass-cache
Expand Down
15 changes: 14 additions & 1 deletion trainer/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,19 @@ lint:
python -m flake8 src


.PHONY: test_classification
test_classification: build
rm -rf tmp
@docker run -v `pwd`/tmp:/result_dir -a stdin -a stdout -a stderr -i -t --privileged trainer ./cache.sh $(S3_ID) $(S3_KEY) $(CLASSIFCATION_BUCKET) $(STEPS)
./test/ensure_models_exist.sh `pwd`/tmp


.PHONY: test_object_detection
test_object_detection: build
rm -rf tmp
@docker run -v `pwd`/tmp:/result_dir -a stdin -a stdout -a stderr -i -t --privileged trainer ./cache.sh $(S3_ID) $(S3_KEY) $(LOCALIZATION_BUCKET) $(STEPS)
./test/ensure_models_exist.sh `pwd`/tmp

################################################################################
# Convert
################################################################################
Expand Down Expand Up @@ -123,6 +136,6 @@ cache_classification:
@docker run -v `pwd`/test_cache/classifcation:/result_dir/model -a stdin -a stdout -a stderr -i -t --privileged trainer ./cache.sh $(S3_ID) $(S3_KEY) $(CLASSIFCATION_BUCKET) $(STEPS)


.PHONY: _cache_object_detection
.PHONY: cache_object_detection
cache_object_detection:
@docker run -v `pwd`/test_cache/object_detection:/result_dir/model -a stdin -a stdout -a stderr -i -t --privileged trainer ./cache.sh $(S3_ID) $(S3_KEY) $(LOCALIZATION_BUCKET) $(STEPS)
37 changes: 37 additions & 0 deletions trainer/test/ensure_models_exist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

CORE_ML=$1/model_ios/Model.mlmodel
TF_LITE=$1/model_android/model.tflite
TF_JS=$1/model_web/model.json

if [ -f "$CORE_ML" ]; then
echo "✅ Core ML"
else
echo "❌ Core ML"
fi

if [ -f "$TF_LITE" ]; then
echo "✅ TensorFlow Lite"
else
echo "❌ TensorFlow Lite"
fi

if [ -f "$TF_JS" ]; then
echo "✅ TensorFlow.js"
else
echo "❌ TensorFlow.js"
fi


# Fail....
if [ ! -f "$CORE_ML" ]; then
exit 1
fi

if [ ! -f "$TF_LITE" ]; then
exit 1
fi

if [ ! -f "$TF_JS" ]; then
exit 1
fi

0 comments on commit 61f00b7

Please sign in to comment.