PROJECT_ID=REPLACE_WITH_YOUR_PROJECT_ID
docker run \
-e "GOOGLE_CLOUD_PROJECT=${PROJECT_ID}" \
-v ~/.config/gcloud:/root/.config/gcloud \
-it gcr.io/ml-pipeline/ml-pipeline-gcp:latest \
kfp_component.google.ml_engine deploy \
--model-uri gs://REPLACE_WITH_YOUR_OUTPUT_BUCKET \
--project-id $PROJECT_ID \
--model-id xgboost_model \
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
from kfp import dsl, gcp, compiler, components | |
deployer_component = components.load_component_from_url('https://raw.githubusercontent.com/kubeflow/pipelines/b850360cd6388cce127b8d079c2c6e7d54519ef2/components/gcp/ml_engine/deploy/component.yaml') | |
def xgboost_component( | |
output_location, | |
training_data, | |
validation_data, | |
data_type, | |
target_column, |
gcloud ai-platform jobs submit training my_xgboost_job \
--stream-logs \
--scale-tier CUSTOM \
--master-machine-type n1-standard-8 \
--master-image-uri gcr.io/aihub-c2t-containers/kfp-components/trainer/dist_xgboost:latest \
-- \
--output-location gs://REPLACE_WITH_YOUR_OUTPUT_BUCKET \
--training-data gs://aihub-c2t-containers-public/release-0.2.0/kfp-components/trainer/dist_xgboost/data/csv/iris/train.csv \
--validation-data gs://aihub-c2t-containers-public/release-0.2.0/kfp-components/trainer/dist_xgboost/data/csv/iris/valid.csv \
docker run \
-v "${PWD}":/local-drive \
-it gcr.io/aihub-c2t-containers/kfp-components/trainer/dist_xgboost:latest \
--output-location /local-drive/xgboost-output \
--training-data gs://aihub-c2t-containers-public/release-0.2.0/kfp-components/trainer/dist_xgboost/data/csv/iris/train.csv \
--validation-data gs://aihub-c2t-containers-public/release-0.2.0/kfp-components/trainer/dist_xgboost/data/csv/iris/valid.csv \
--target-column target \
--data-type csv \
--number-of-classes 3 \
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
wget http://www.image-net.org/challenges/LSVRC/2012/nnoupb/ILSVRC2012_img_train.tar | |
wget http://www.image-net.org/challenges/LSVRC/2012/nnoupb/ILSVRC2012_img_val.tar | |
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
#!/bin/bash | |
# gcloud builds submit --config cloudbuild.yaml . | |
# docker run -v `pwd`:/workspace -w /workspace -it refresh-metadata | |
# gcloud components install docker-credential-gcr | |
# docker-credential-gcr configure-docker | |
# gcloud components install cloud-build-local | |
rm -fr /workspace/* |
- install and enable datalab as pip package https://github.com/googledatalab/pydatalab
- enable per notebook:
%load_ext google.datalab.kernel
- alternative, enable globally in ipython_config.py:
c = get_config()
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
$ python -m venv projectname | |
$ source projectname/bin/activate | |
(venv) $ pip install ipykernel | |
(venv) $ ipython kernel install --user --name=projectname |
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
!pip3 install datalab | |
from google.datalab.ml import TensorBoard | |
TensorBoard().start('./model_dir/') | |
for pid in TensorBoard.list()['pid']: | |
TensorBoard().stop(pid) | |
print('Stopped TensorBoard with pid {}'.format(pid)) |
NewerOlder