Skip to content

Commit

Permalink
🔥 ready for 0.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
htahir1 committed Apr 14, 2022
1 parent 06db28b commit eb8b877
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 46 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,7 @@ dmypy.json
.pyre/

*.zen/
.idea/

# for wandb
mlruns
9 changes: 4 additions & 5 deletions 00 - Basics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"source": [
"!rm -rf .zen\n",
"!zenml init\n",
"!zenml stack set local_stack"
"!zenml stack set default"
]
},
{
Expand Down Expand Up @@ -163,8 +163,7 @@
"metadata": {},
"outputs": [],
"source": [
"pipelines = repo.get_pipelines()\n",
"p = pipelines[-1]\n",
"p = repo.get_pipeline('my_pipeline')\n",
"p"
]
},
Expand Down Expand Up @@ -248,7 +247,7 @@
"source": [
"@step\n",
"def c() -> int:\n",
" return 10"
" return 11"
]
},
{
Expand All @@ -274,7 +273,7 @@
" PipelineRunLineageVisualizer,\n",
")\n",
"\n",
"latest_run = repo.get_pipelines()[-1].runs[-1]\n",
"latest_run = repo.get_pipeline('my_pipeline').runs[-1]\n",
"PipelineRunLineageVisualizer().visualize(latest_run)"
]
}
Expand Down
76 changes: 41 additions & 35 deletions 01 - Building a ML(Ops) pipeline.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@
"outputs": [],
"source": [
"!rm -rf .zen\n",
"!zenml init\n",
"!zenml stack set default"
"!zenml init"
]
},
{
Expand All @@ -78,6 +77,37 @@
"!zenml integration install sklearn dash evidently mlflow -f"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Add a Model Deployer to your Stack"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Register the MLflow model deployer\n",
"!zenml model-deployer register mlflow --type=mlflow\n",
"\n",
"# Create a new stack with MLflow deployer in it\n",
"!zenml stack register local_with_mlflow -m default -a default -o default -d mlflow"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Set it as the active stack\n",
"!zenml stack set local_with_mlflow\n",
"!zenml stack describe"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -165,7 +195,6 @@
" y_train: np.ndarray,\n",
") -> ClassifierMixin:\n",
" \"\"\"Train another simple sklearn classifier for the digits dataset.\"\"\"\n",
" print(\"test\")\n",
" model = SVC(gamma=0.001)\n",
" model.fit(X_train, y_train)\n",
" return model"
Expand Down Expand Up @@ -258,8 +287,7 @@
"from zenml.repository import Repository\n",
"\n",
"repo = Repository()\n",
"pipelines = repo.get_pipelines()\n",
"p = pipelines[-1]\n",
"p = repo.get_pipeline('digits_pipeline')\n",
"run = p.runs[-1]\n",
"steps = run.steps\n",
"s = steps[-1]\n",
Expand Down Expand Up @@ -675,8 +703,8 @@
"\n",
"with MLFlowEnvironment() as env:\n",
" env.tracking_uri\n",
" !mlflow ui --backend-store-uri {env.tracking_uri} --port 4998\n",
" "
" !mlflow ui --backend-store-uri {env.tracking_uri} --port 4997\n",
" print(env.tracking_uri)"
]
},
{
Expand Down Expand Up @@ -753,7 +781,7 @@
"from zenml.integrations.mlflow.mlflow_environment import MLFlowEnvironment\n",
"\n",
"with MLFlowEnvironment() as env:\n",
" !mlflow ui --backend-store-uri {env.tracking_uri} --port 4998"
" !mlflow ui --backend-store-uri {env.tracking_uri} --port 4997"
]
},
{
Expand Down Expand Up @@ -803,30 +831,6 @@
" model_deployer(deployment_decision, model)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Add a Model Deployer to your Stack"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Register the MLflow model deployer\n",
"!zenml model-deployer register mlflow --type=mlflow\n",
"\n",
"# Create a new stack with MLflow deployer in it\n",
"!zenml stack register local_with_mlflow -m default -a default -o default -d mlflow\n",
"\n",
"# Set it as the active stack\n",
"!zenml stack set local_with_mlflow\n",
"!zenml stack describe"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -908,6 +912,8 @@
"metadata": {},
"outputs": [],
"source": [
"from zenml.repository import Repository\n",
"\n",
"repo = Repository()\n",
"p = repo.get_pipeline('continuous_deployment_pipeline_notebook')\n",
"last_run = p.runs[-1]\n",
Expand All @@ -924,10 +930,10 @@
"model_deployer = repo.active_stack.model_deployer\n",
"services = model_deployer.find_model_server(\n",
" pipeline_name=\"continuous_deployment_pipeline_notebook\",\n",
" pipeline_step_name=\"model_deployer\",\n",
" pipeline_step_name=\"mlflow_model_deployer_step\",\n",
" running=True,\n",
")\n",
"service = services[0]\n"
"service = services[0]"
]
},
{
Expand Down Expand Up @@ -1156,7 +1162,7 @@
" prediction_service_loader=prediction_service_loader(\n",
" PredictionServiceLoaderStepConfig(\n",
" pipeline_name=\"continuous_deployment_pipeline_notebook\",\n",
" step_name=\"model_deployer\",\n",
" step_name=\"mlflow_model_deployer_step\",\n",
" model_name=\"model\",\n",
" )\n",
" ),\n",
Expand Down
20 changes: 14 additions & 6 deletions 02 - Transitioning To Production.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,20 @@
"![All](_assets/integrations_all.png \"All\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![All](_assets/seldon.png \"Seldon Model Deployer.png\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!zenml integration install kubeflow seldon aws -f"
"!zenml integration install kubeflow seldon s3 -f"
]
},
{
Expand Down Expand Up @@ -142,7 +149,7 @@
"source": [
"Now we want to transition to a kubeflow stack that will look a little bit like this. Note that for kubeflow pipelines we also need a registry where the docker images for each step are registered. \n",
"\n",
"![KubeflowStack](_assets/aws_stack_redesigned.png \"KubeflowStack\")\n",
"![KubeflowStack](_assets/aws_stack_seldon.png \"KubeflowStack\")\n",
"\n",
"But we have good news! You barely have to do anything to transition."
]
Expand Down Expand Up @@ -283,14 +290,16 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"# Register container registry\n",
"!zenml container-registry register ecr_registry --type=default --uri={ECR_REGISTRY_NAME}\n",
"\n",
"# Register orchestrator (Kubeflow on AWS)\n",
"!zenml orchestrator register eks_orchestrator --type=kubeflow \n",
"!zenml orchestrator register eks_orchestrator --type=kubeflow\n",
"\n",
"# Register metadata store and artifact store\n",
"!zenml metadata-store register kubeflow_metadata_store --type=kubeflow\n",
Expand Down Expand Up @@ -349,9 +358,8 @@
},
"outputs": [],
"source": [
"\n",
"# Let's train within kubeflow pipelines - this will deploy the pipeline\n",
"!python run.py --deploy --predict # --interval-second=300"
"!python run.py --deploy # --interval-second=300"
]
},
{
Expand Down
Binary file added _assets/aws_stack_seldon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _assets/seldon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit eb8b877

Please sign in to comment.