Created
December 24, 2019 14:13
-
-
Save rodrigofp-cit/bda6e3942fedf6e9f4b8dba10bafb229 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
PROJECT_ID=<PROJECT_ID> | |
BUCKET_NAME="${PROJECT_ID}-black-friday-demo-bucket" | |
MODEL_NAME=black_friday_forecast | |
REGION=us-central1 | |
VERSION='v'`date '+%Y%m%d_%H%M%S'` | |
MODEL_PATH=gs://$BUCKET_NAME/models/$VERSION/model | |
PACKAGE_PATH=gs://$BUCKET_NAME/models/$VERSION/package/black_friday_forecast-0.0.1.tar.gz | |
# Package solution | |
python setup.py sdist | |
# Upload code to GCS | |
gsutil cp ./dist/black_friday_forecast-0.0.1.tar.gz $PACKAGE_PATH | |
# Upload model to GCS | |
gsutil cp ./models/model.joblib $MODEL_PATH/model.joblib | |
# Create model if it doesn't exist | |
gcloud ai-platform models create $MODEL_NAME --regions $REGION --project $PROJECT_ID | |
# Create a version | |
gcloud --quiet beta ai-platform versions create $VERSION \ | |
--model $MODEL_NAME \ | |
--origin $MODEL_PATH \ | |
--runtime-version 1.15 \ | |
--python-version 2.7 \ | |
--framework SCIKIT_LEARN \ | |
--package-uris $PACKAGE_PATH \ | |
--project $PROJECT_ID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment