Skip to content

Commit 276e7e4

Browse files
TeoAlePonziorabah-khalek
authored
Added import Giskard and fixed the pip install (#1900)
* formatting fixed * added import giskard * added on tabular too * added on tabular too --------- Co-authored-by: Ponzio <matteo.dalessandro@giskard.ai> Co-authored-by: Rabah Abdul Khalek <rabah.khalek@gmail.com>
1 parent 61ac277 commit 276e7e4

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

‎docs/integrations/mlflow/mlflow-llm-example.ipynb‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
},
7171
"outputs": [],
7272
"source": [
73-
"%pip install langchain-openai openai pypdf faiss-cpu tiktoken pyngrok -q"
73+
"%pip install langchain langchain-openai openai \"pypdf<=3.17.0\" faiss-cpu tiktoken pyngrok -q"
7474
]
7575
},
7676
{
@@ -91,6 +91,7 @@
9191
"outputs": [],
9292
"source": [
9393
"import mlflow\n",
94+
"import giskard\n",
9495
"\n",
9596
"mlflow.models.list_evaluators() # ['default', 'giskard']"
9697
]

‎docs/integrations/mlflow/mlflow-tabular-example.ipynb‎

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5+
"metadata": {
6+
"collapsed": false
7+
},
58
"source": [
69
"# MLFlow Example - Tabular\n",
710
"## Detecting tabular ML models vulnerabilities in MLflow with Giskard\n",
@@ -11,17 +14,18 @@
1114
"|----------|------------------------------------------------------------------------|-----------------|\n",
1215
"| `model1` | A simple sklearn `LogisticRegression` model trained only for 5 epochs. | Titanic dataset |\n",
1316
"| `model2` | A simple sklearn `LogisticRegression` model trained for 100 epochs. | Titanic dataset |"
14-
],
15-
"metadata": {
16-
"collapsed": false
17-
}
17+
]
1818
},
1919
{
2020
"cell_type": "code",
2121
"execution_count": null,
22+
"metadata": {
23+
"collapsed": false
24+
},
2225
"outputs": [],
2326
"source": [
2427
"import mlflow\n",
28+
"import giskard\n",
2529
"\n",
2630
"from giskard import demo\n",
2731
"model1, df = demo.titanic(max_iter=5)\n",
@@ -33,13 +37,13 @@
3337
" with mlflow.start_run(run_name=model_name) as run:\n",
3438
" model_uri = mlflow.sklearn.log_model(model, model_name, pyfunc_predict_fn=\"predict_proba\").model_uri\n",
3539
" mlflow.evaluate(model=model_uri, model_type=\"classifier\", data=df, targets=\"Survived\", evaluators=\"giskard\", evaluator_config={\"model_config\": {\"classification_labels\": [\"no\", \"yes\"]}})"
36-
],
37-
"metadata": {
38-
"collapsed": false
39-
}
40+
]
4041
},
4142
{
4243
"cell_type": "markdown",
44+
"metadata": {
45+
"collapsed": false
46+
},
4347
"source": [
4448
"After completing the previous steps, you can run mlflow ui from the directory where the mlruns folder is located, which will enable you to visualize the results. By accessing http://127.0.0.1:5000, you will be presented with the interface. There, you will find the two LLMs logged as separate runs for comparison and analysis.\n",
4549
"<img src=\"../../assets/integrations/mlflow/tabular/table_view.png\">\n",
@@ -52,17 +56,14 @@
5256
"\n",
5357
"A scan summary: After each model evaluation, a scan-summary.json file is created, enabling a comparison of vulnerabilities and metrics for each model in the Artifact view.\n",
5458
"<img src=\"../../assets/integrations/mlflow/tabular/scan-summary.png\">"
55-
],
56-
"metadata": {
57-
"collapsed": false
58-
}
59+
]
5960
},
6061
{
6162
"cell_type": "markdown",
62-
"source": [],
6363
"metadata": {
6464
"collapsed": false
65-
}
65+
},
66+
"source": []
6667
}
6768
],
6869
"metadata": {

0 commit comments

Comments
 (0)