This lab/project shows:
- how to use KALE and KServe in a project.
- You should have Kubeflow Environment (Easiest Way: Using MiniKF)
-
Create a new notebook server pod and connect:
-
Run Terminal to download examples:
-
Clone Kale Examples:
git clone https://github.com/kubeflow-kale/kale
-
Open the ipynb file (kale/examples/serving/sklearn/iris.ipynb)
-
Run the cell "pip install -r requirements.txt" to install requirements
-
Then, after installing required packages, restart the kernel.
-
Open the KALE section from left and enable KALE
-
After opening KALE feature, it is seen that each cells are tagged with steps (e.g. imports, pipeline-parameters, etc.)
-
Use "gcr.io/arrikto/jupyter-kale-py36:develop-l0-release-1.2-pre-295-g622fe91aca" as docker image if you encounter with another image.
-
Before compiling, add tagging to "serving_model", this enables to create model in Kubeflow.
-
Run "Compile and Run" to create Kubeflow pipeline from the notebook (this is KALE feature)
-
It creates pipeline:
-
When monitoring pods in K8s, it can be seen that pods are running and completed for each step.
-
For each task details can be viewed.
-
For each step logs and data are stored in ROK and Minio (if MiniKF is used).
-
After running pipeline, it can be seen the result parameters (accuracy)
-
KServe creates model:
-
From model section, detail information can be reachable:
-
From Experiment Section, models' results can be seen (e.g. accuracy, f1, etc.):
-
Open launcher:
-
Run Terminal:
-
Run following commands to create JSON file to send the model.
cat <<EOF > "./iris-input.json"
{
"instances": [
[6.8, 2.8, 4.8, 1.4],
[6.0, 3.4, 4.5, 1.6]
]
}
EOF
- Run curl command to send JSON file to the model.
- This "http://iris-pipeline-xchh4-3630146895-2r0st.kubeflow-user.svc.cluster.local/v1/models/iris-pipeline-xchh4-3630146895-2r0st:predict" is written in the model URL internal, please have a look in the model to get correct path.
curl -v http://iris-pipeline-xchh4-3630146895-2r0st.kubeflow-user.svc.cluster.local/v1/models/iris-pipeline-xchh4-3630146895-2r0st:predict -d @./iris-input.json