Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update a sample notebook. #155

Merged
merged 2 commits into from
Nov 9, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 59 additions & 8 deletions samples/notebooks/KubeFlow Pipeline Using TFX OSS Components.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
"outputs": [],
"source": [
"# Install Pipeline SDK\n",
"!pip3 install https://storage.googleapis.com/ml-pipeline/release/0.1.1/kfp.tar.gz --upgrade"
"!pip3 install https://storage.googleapis.com/ml-pipeline/release/0.1.1/kfp.tar.gz --upgrade\n",
" \n",
"# Component building requires this package. For now you need to install it explicitly.\n",
"!pip3 install kubernetes"
]
},
{
Expand Down Expand Up @@ -84,15 +87,63 @@
"# Note that this notebook should be running in JupyterHub in the same cluster as the pipeline system.\n",
"# Otherwise it will fail to talk to the pipeline system.\n",
"client = kfp.Client()\n",
"exp = client.create_experiment(name='demo_exp')\n",
"# See Screenshot 1"
"exp = client.create_experiment(name='demo')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Test Run a Pipeline"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Copying gs://ml-pipeline-playground/coin.tar.gz...\n",
"/ [1 files][ 978.0 B/ 978.0 B] \n",
"Operation completed over 1 objects/978.0 B. \n"
]
}
],
"source": [
"# Download a pipeline package\n",
"!gsutil cp gs://ml-pipeline-playground/coin.tar.gz ."
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"Job link <a href=\"/pipeline/#/runs/details/97280443-e3ae-11e8-860c-42010a800274\" target=\"_blank\" >here</a>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"run = client.run_pipeline(exp.id, 'coin', 'coin.tar.gz')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Define a Pipeline with OSS TFX components\n",
"## Define a Pipeline\n",
"\n",
"Authoring a pipeline is just like authoring a normal Python function. The pipeline function describes the topology of the pipeline. Each step in the pipeline is typically a ContainerOp --- a simple class or function describing how to interact with a docker container image. In the below pipeline, all the container images referenced in the pipeline are already built. The pipeline starts with a TFDV step which is used to infer the schema of the data. Then it uses TFT to transform the data for training. After a single node training step, it analyze the test data predictions and generate a feature slice metrics view using a TFMA component. At last, it deploys the model to TF-Serving inside the same cluster."
]
Expand Down Expand Up @@ -270,12 +321,13 @@
}
],
"source": [
"# Compile it into a tar package.\n",
"compiler.Compiler().compile(taxi_cab_classification, 'tfx.tar.gz')\n",
"\n",
"# Submit a run.\n",
"run = client.run_pipeline(exp.id, 'tfx', 'tfx.tar.gz',\n",
" params={'output': OUTPUT_DIR,\n",
" 'project': PROJECT_NAME})\n",
"# See Screenshot 2"
" 'project': PROJECT_NAME})"
]
},
{
Expand Down Expand Up @@ -583,8 +635,7 @@
"run = client.run_pipeline(exp.id, 'my-tfx', 'my-tfx.tar.gz',\n",
" params={'output': OUTPUT_DIR,\n",
" 'project': PROJECT_NAME,\n",
" 'model': 'mytaxi.beta'})\n",
"# See screenshot 3"
" 'model': 'mytaxi.beta'})"
]
},
{
Expand Down