File size: 4,554 Bytes
551af5c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ec48b04
551af5c
ec48b04
551af5c
 
 
 
 
 
 
 
 
ec48b04
551af5c
 
 
 
 
 
 
ec48b04
551af5c
 
 
 
 
 
 
 
 
 
 
ec48b04
551af5c
 
 
 
 
ec48b04
551af5c
 
 
ec48b04
551af5c
 
 
 
ec48b04
551af5c
 
ec48b04
551af5c
 
 
 
ec48b04
551af5c
 
ec48b04
551af5c
 
 
 
 
ec48b04
551af5c
 
 
ec48b04
551af5c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "63ab391a",
   "metadata": {},
   "source": [
    "# Intro to MLOps using ZenML\n",
    "\n",
    "## 🌍 Overview\n",
    "\n",
    "This repository is a minimalistic MLOps project intended as a starting point to learn how to put ML workflows in production. It features: \n",
    "\n",
    "Follow along this notebook to understand how you can use ZenML to productionalize your ML workflows!\n",
    "\n",
    "<img src=\"_assets/pipeline_overview.png\" width=\"50%\" alt=\"Pipelines Overview\">"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8c28b474",
   "metadata": {},
   "source": [
    "# ⌚ Step 2: Training pipeline"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "87909827",
   "metadata": {},
   "source": [
    "Lets run the training pipeline\n",
    "\n",
    "<img src=\"_assets/training_pipeline.png\" width=\"50%\" alt=\"Training pipeline\">"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fccf1bd9",
   "metadata": {},
   "outputs": [],
   "source": [
    "!python run.py --training-pipeline"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d6306f14",
   "metadata": {},
   "source": [
    "# πŸ«… Step 2: The inference pipeline"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b51f3108",
   "metadata": {},
   "source": [
    "The batch inference pipeline simply takes the model marked as `production` and runs inference on it\n",
    "with `live data`. The critical step here is the `inference_predict` step, where we load the model in memory\n",
    "and generate predictions:\n",
    "\n",
    "<img src=\"_assets/inference_pipeline.png\" width=\"45%\" alt=\"Inference pipeline\">"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9918a8a1-c569-494f-aa40-cb7bd3aaea07",
   "metadata": {},
   "outputs": [],
   "source": [
    "!python run.py --inference-pipeline"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "36140d24-a280-48eb-bb03-5e03280e128c",
   "metadata": {},
   "source": [
    "## Step 3: Deploying the pipeline to Huggingface"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "13bd8087-2ab0-4f9d-8bff-6266a05eb6e7",
   "metadata": {},
   "source": [
    "<img src=\"_assets/deployment_pipeline.png\" width=\"45%\" alt=\"Deployment pipeline\">"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8000849c-1ce8-4900-846e-3ef1873561f8",
   "metadata": {},
   "outputs": [],
   "source": [
    "!python run.py --deployment-pipeline"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "594ee4fc-f102-4b99-bdc3-2f1670c87679",
   "metadata": {},
   "source": [
    "## Congratulations!\n",
    "\n",
    "You're a legit MLOps engineer now! You trained two models, evaluated them against\n",
    "a test set, registered the best one with the ZenML model control plane,\n",
    "and served some predictions. You also learned how to iterate on your models and\n",
    "data by using some of the ZenML utility abstractions. You saw how to view your\n",
    "artifacts and models via the client as well as the ZenML Dashboard.\n",
    "\n",
    "## Further exploration\n",
    "\n",
    "This was just the tip of the iceberg of what ZenML can do; check out the [**docs**](https://docs.zenml.io/) to learn more\n",
    "about the capabilities of ZenML. For example, you might want to:\n",
    "\n",
    "- [Deploy ZenML](https://docs.zenml.io/user-guide/production-guide/connect-deployed-zenml) to collaborate with your colleagues.\n",
    "- Run the same pipeline on a [cloud MLOps stack in production](https://docs.zenml.io/user-guide/production-guide/cloud-stack).\n",
    "- Track your metrics in an experiment tracker like [MLflow](https://docs.zenml.io/stacks-and-components/component-guide/experiment-trackers/mlflow).\n",
    "\n",
    "## What next?\n",
    "\n",
    "* If you have questions or feedback... join our [**Slack Community**](https://zenml.io/slack) and become part of the ZenML family!\n",
    "* If you want to quickly get started with ZenML, check out the [ZenML Cloud](https://zenml.io/cloud)."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}