Skip to content

Commit

Permalink
reset the jupyters
Browse files Browse the repository at this point in the history
  • Loading branch information
raminmohammadi committed Sep 15, 2024
1 parent 2eecf1c commit eb7de4b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 126 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ __pycache__/
# Distribution / packaging
.Python
build/
mlruns/
develop-eggs/
dist/
downloads/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,9 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Elasticnet model (alpha=0.500000, l2_ratio=0.500000):\n",
" RMSE: 0.7931640229276851\n",
" MAE: 0.6271946374319586\n",
" R2: 0.10862644997792614\n"
]
}
],
"outputs": [],
"source": [
"with mlflow.start_run():\n",
" lr = ElasticNet(alpha=alpha, l1_ratio=l1_ratio, random_state=42)\n",
Expand Down Expand Up @@ -114,74 +103,27 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"inputs: \n",
" ['fixed acidity': double, 'volatile acidity': double, 'citric acid': double, 'residual sugar': double, 'chlorides': double, 'free sulfur dioxide': double, 'total sulfur dioxide': double, 'density': double, 'pH': double, 'sulphates': double, 'alcohol': double]\n",
"outputs: \n",
" [Tensor('float64', (-1,))]\n",
"params: \n",
" None"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"signature"
]
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'file'"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"tracking_url_type_store"
]
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[2023-09-27 20:54:45 -0400] [342474] [INFO] Starting gunicorn 21.2.0\n",
"[2023-09-27 20:54:45 -0400] [342474] [INFO] Listening at: http://127.0.0.1:5001 (342474)\n",
"[2023-09-27 20:54:45 -0400] [342474] [INFO] Using worker: sync\n",
"[2023-09-27 20:54:45 -0400] [342475] [INFO] Booting worker with pid: 342475\n",
"[2023-09-27 20:54:45 -0400] [342476] [INFO] Booting worker with pid: 342476\n",
"[2023-09-27 20:54:45 -0400] [342477] [INFO] Booting worker with pid: 342477\n",
"[2023-09-27 20:54:45 -0400] [342478] [INFO] Booting worker with pid: 342478\n",
"^C\n",
"[2023-09-27 20:56:11 -0400] [342474] [INFO] Handling signal: int\n",
"[2023-09-27 20:56:11 -0400] [342478] [INFO] Worker exiting (pid: 342478)\n",
"[2023-09-27 20:56:11 -0400] [342477] [INFO] Worker exiting (pid: 342477)\n",
"[2023-09-27 20:56:11 -0400] [342475] [INFO] Worker exiting (pid: 342475)\n",
"[2023-09-27 20:56:11 -0400] [342476] [INFO] Worker exiting (pid: 342476)\n"
]
}
],
"outputs": [],
"source": [
"!mlflow ui --port=5001"
]
Expand Down Expand Up @@ -210,7 +152,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"version": "3.9.13"
}
},
"nbformat": 4,
Expand Down
72 changes: 13 additions & 59 deletions Labs/Experiment_Tracking_Labs/Mlflow_Labs/Lab1/serving.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"id": "6fcbde98-775d-477b-a2cd-a4d932c87032",
"metadata": {},
"outputs": [],
Expand All @@ -55,7 +55,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 2,
"id": "de1041eb-81df-4e8b-b195-c8162e299f3a",
"metadata": {},
"outputs": [],
Expand All @@ -78,19 +78,10 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"id": "66310822-7bd4-407f-ae39-d8918032e431",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/ramin/anaconda3/lib/python3.9/site-packages/_distutils_hack/__init__.py:33: UserWarning: Setuptools is replacing distutils.\n",
" warnings.warn(\"Setuptools is replacing distutils.\")\n"
]
}
],
"outputs": [],
"source": [
"with mlflow.start_run():\n",
" # Create and train a linear regression model\n",
Expand Down Expand Up @@ -180,30 +171,12 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"id": "fe3d4386-6672-416d-a039-72176c64c728",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2023/09/27 20:59:18 INFO mlflow.pyfunc: To install the dependencies that were used to train the model, run the following command: '%pip install -r /home/ramin/Documents/Teaching/IE7374-MLOPS/Labs/Mlflow_Labs/mlruns/0/b2b3ad10af1a4fc7a8387f810251093e/artifacts/model/requirements.txt'.\n"
]
},
{
"data": {
"text/plain": [
"'/home/ramin/Documents/Teaching/IE7374-MLOPS/Labs/Mlflow_Labs/mlruns/0/b2b3ad10af1a4fc7a8387f810251093e/artifacts/model/requirements.txt'"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"# mlflow.pyfunc.get_model_dependencies('mlruns/0/b2b3ad10af1a4fc7a8387f810251093e/artifacts/model')"
"# mlflow.pyfunc.get_model_dependencies('mlruns/0/74d97798ba234bee8a24c54ddda2e29f/artifacts/model')"
]
},
{
Expand Down Expand Up @@ -237,7 +210,7 @@
},
"outputs": [],
"source": [
"!mlflow models serve --env-manager=local -m mlruns/0/b2b3ad10af1a4fc7a8387f810251093e/artifacts/model -h 127.0.0.1 -p 5001"
"!mlflow models serve --env-manager=local -m mlruns/0/74d97798ba234bee8a24c54ddda2e29f/artifacts/model -h 127.0.0.1 -p 5001"
]
},
{
Expand All @@ -251,42 +224,23 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"id": "2319aa69-4b0c-4c18-b8d0-358fff9990a0",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(89, 10)"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"X_test.shape"
]
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"id": "96f162c7-f96e-48dd-b5b6-932dbaed9b81",
"metadata": {
"scrolled": true,
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'predictions': [139.547558403796, 179.5172083534279, 134.03875571890103, 291.4170292522083, 123.78965872239598, 92.17234650105036, 258.232388989213, 181.33732057060715, 90.22411310941453, 108.63375858007923, 94.13865743638848, 168.43486357975485, 53.504788796095596, 206.6308165929642, 100.12925868961597, 130.66657085052714, 219.53071499182573, 250.7803234033336, 196.36883460186402, 218.57511814821788, 207.35050181974754, 88.4834094142032, 70.43285917378932, 188.95914235039007, 154.886816196898, 159.36170121791906, 188.31263362697564, 180.39094032857133, 47.99046560870016, 108.97453871427206, 174.77897632897384, 86.36406655640143, 132.9576121467635, 184.53819482628643, 173.83220911339018, 190.35858491915604, 124.41561760139213, 119.6511065607128, 147.95168682418483, 59.05405241472812, 71.62331856151582, 107.68284703885509, 165.45365458042076, 155.00975931051346, 171.0479909563818, 61.457613561017894, 71.66672580728223, 114.96732205941949, 51.579755230423885, 167.57599528011522, 152.52291954830028, 62.95568515225264, 103.49741722264709, 109.20751488540836, 175.6411842576666, 154.6029624181131, 94.41704365715881, 210.74209144739245, 120.25662049594234, 77.61585398627129, 187.9320399528739, 206.49337473788225, 140.63167075673582, 105.59678022893402, 130.70432535999663, 202.1853453667185, 171.1303950081213, 164.91423047268822, 124.72472568780734, 144.81030894117254, 181.99635451907636, 199.41369641711736, 234.21436187590186, 145.95665512205622, 79.86703276235616, 157.36941274964417, 192.74412541087804, 208.89814031629626, 158.5872255494477, 206.02195855372946, 107.4797167461347, 140.93598906417054, 54.82129331926056, 55.9257319471196, 115.01180017858908, 78.9558418752068, 81.56087284620637, 54.37997255644882, 166.25435180326872]}\n"
]
}
],
"outputs": [],
"source": [
"import requests\n",
"import json\n",
Expand Down Expand Up @@ -347,7 +301,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"version": "3.9.13"
}
},
"nbformat": 4,
Expand Down

0 comments on commit eb7de4b

Please sign in to comment.