Skip to content

Instantly share code, notes, and snippets.

@crawles
Last active February 26, 2018 11:20
Show Gist options
  • Save crawles/4546865d557dd6f8d998d5e442ee06e0 to your computer and use it in GitHub Desktop.
Save crawles/4546865d557dd6f8d998d5e442ee06e0 to your computer and use it in GitHub Desktop.
# def ml-engine function
submitMLEngineJob() {
gcloud ml-engine jobs submit training $JOBNAME \
--package-path=$(pwd)/mnist_classifier/trainer \
--module-name trainer.task \
--region $REGION \
--staging-bucket=gs://$BUCKET \
--scale-tier=BASIC \
--runtime-version=1.4 \
-- \
--outdir $OUTDIR \
--hidden_units $net \
--num_steps 1000 \
$batchNorm
}
# launch jobs in parallel
export PYTHONPATH=${PYTHONPATH}:${PWD}/mnist_classifier
for batchNorm in '' '--use_batch_normalization'
do
net=''
for layer in 500 400 300 200 100 50 25;
do
net=$net$layer
netname=${net//,/_}${batchNorm/--use_batch_normalization/_bn}
JOBNAME=mnist$netname_$(date -u +%y%m%d_%H%M%S)
OUTDIR=gs://${BUCKET}/mnist_models/mnist_model$netname/trained_model
echo $OUTDIR $REGION $JOBNAME
gsutil -m rm -rf $OUTDIR
submitMLEngineJob
net=$net,
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment