Skip to content

Commit

Permalink
Merge pull request #300 from wyouhei/kfp_walkthrough_vertex_pytorch
Browse files Browse the repository at this point in the history
ADD: kfp_walkthrough_vertex using pytorch
  • Loading branch information
takumiohym authored Mar 16, 2023
2 parents 3a8f62b + 5332dce commit a1cebe1
Show file tree
Hide file tree
Showing 4 changed files with 1,608 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ kernels: \
reinforcement_learning_kernel \
uncertainty_aware_models_kernel \
tf_recommenders_kernel \
object_detection_kernel
object_detection_kernel \
pytorch_kfp_kernel

.PHONY: clean
clean:
Expand Down Expand Up @@ -53,3 +54,7 @@ tf_recommenders_kernel:
.PHONY: object_detection_kernel
object_detection_kernel:
./kernels/object_detection.sh

.PHONY: pytorch_kfp_kernel
pytorch_kfp_kernel:
./kernels/pytorch_kfp.sh
38 changes: 38 additions & 0 deletions kernels/pytorch_kfp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash
#
# To build the kernel: ./kernels/pytorch_kfp.sh
# To remove the kernel: ./kernels/pytorch_kfp.sh remove
#
# This scripts will create a ipython kernel named $MODULE
# populated with the reqs in ./notebooks/$MODULE/requirements.txt


MODULE=kubeflow_pipelines\/walkthrough
ENVNAME=pytorch_kfp_kernel
REPO_ROOT_DIR="$(dirname $(cd $(dirname $BASH_SOURCE) && pwd))"

# Cleaning up the kernel and exiting if first arg is 'remove'
if [ "$1" == "remove" ]; then
echo Removing kernel $ENVNAME
jupyter kernelspec remove $ENVNAME
rm -r "$REPO_ROOT_DIR/notebooks/$MODULE/$ENVNAME"
exit 0
fi

cd $REPO_ROOT_DIR/notebooks/$MODULE

# Setup virtual env and kernel
echo creating $ENVNAME at $(pwd)
python3 -m venv $ENVNAME

# Registering the venv as an ipython kernel
source $ENVNAME/bin/activate
pip install -U pip
pip install ipykernel
python -m ipykernel install --user --name=$ENVNAME

# Install Pytorch and its dependencies
pip install torch==1.11.0 torchtext==0.12.0 --extra-index-url https://download.pytorch.org/whl/cpu
pip install -r pytorch_kfp_requirements.txt

deactivate
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
torch==1.11.0
torch-model-archiver==0.7.0
pandas==1.3.5
google-cloud-aiplatform[prediction]==1.19.0
google-cloud-bigquery-storage==2.13.2
pyarrow==5.0.0
fsspec==2022.11.0
gcsfs==2022.11.0

Large diffs are not rendered by default.

0 comments on commit a1cebe1

Please sign in to comment.