forked from BVLC/caffe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
script to upload/update model info as gist
- Loading branch information
Showing
4 changed files
with
47 additions
and
16 deletions.
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
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
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
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,38 @@ | ||
#!/bin/bash | ||
|
||
# Check for valid directory | ||
DIRNAME=$1 | ||
if [ ! -f $DIRNAME/readme.md ]; then | ||
echo "usage: upload_model_to_gist.sh <dirname>" | ||
echo " <dirname>/readme.md must exist" | ||
fi | ||
cd $DIRNAME | ||
FILES=`find . -type f -maxdepth 1 ! -name "*.caffemodel*" | xargs echo` | ||
|
||
# Check for gist tool. | ||
gist -v >/dev/null 2>&1 || { echo >&2 "I require 'gist' but it's not installed. Do 'gem install gist'."; exit 1; } | ||
|
||
NAME=`sed -n 's/^name:[[:space:]]*//p' readme.md` | ||
if [ -z "$NAME" ]; then | ||
echo " <dirname>/readme.md must contain name field in the front-matter." | ||
fi | ||
|
||
GIST=`sed -n 's/^gist_id:[[:space:]]*//p' readme.md` | ||
if [ -z "$GIST" ]; then | ||
echo "Uploading new Gist" | ||
gist -p -d "$NAME" $FILES | ||
else | ||
echo "Updating existing Gist, id $GIST" | ||
gist -u $GIST -d "$NAME" $FILES | ||
fi | ||
|
||
RESULT=$? | ||
if [ $RESULT -eq 0 ]; then | ||
echo "You've uploaded your model!" | ||
echo "Don't forget to add the gist_id field to your <dirname>/readme.md now!" | ||
echo "Run the command again after you do that, to make sure the Gist id propagates." | ||
echo "" | ||
echo "And do share your model over at https://github.com/BVLC/caffe/wiki/Model-Zoo" | ||
else | ||
echo "Something went wrong!" | ||
fi |