Skip to content

Commit

Permalink
minor fixes to notebooks
Browse files Browse the repository at this point in the history
Signed-off-by: Fotis Nikolaidis <[email protected]>
  • Loading branch information
fnikolai committed Dec 3, 2023
1 parent 6fd8f74 commit 1f9af17
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 64 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ test_notebooks: ## Test notebooks (argument: NOTEBOOKS=<test|dir>)
@echo "Notebook Path: $(NOTEBOOKS)"

@if [ -n "${NOTEBOOKS}" ]; then \
pytest --nbval ${NOTEBOOKS}; \
pytest --nbval-lax ${NOTEBOOKS}; \
fi


Expand Down
8 changes: 2 additions & 6 deletions examples/multimodal_image_search_clip.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@
"cell_type": "markdown",
"id": "40272d6a2681c8e8",
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
}
"collapsed": false
},
"source": [
"## Prerequisites\n",
Expand Down Expand Up @@ -104,7 +101,7 @@
"outputs": [],
"source": [
"!curl -O https://superduperdb-public.s3.eu-west-1.amazonaws.com/coco_sample.zip\n",
"!unzip coco_sample.zip"
"!unzip -f coco_sample.zip"
]
},
{
Expand All @@ -117,7 +114,6 @@
"from superduperdb import Document\n",
"from superduperdb.ext.pillow import pil_image as i\n",
"import glob\n",
"import random\n",
"\n",
"# Use glob to get a list of image file paths in the 'images_small' directory\n",
"images = glob.glob('images_tiny/*.jpg')\n",
Expand Down
69 changes: 27 additions & 42 deletions examples/question_the_docs.ipynb

Large diffs are not rendered by default.

89 changes: 75 additions & 14 deletions examples/sandbox-example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,27 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "5355a5ac-6452-4a89-b0d9-fe18cb993fdd",
"metadata": {},
"outputs": [],
"metadata": {
"ExecuteTime": {
"end_time": "2023-12-03T00:13:57.783125835Z",
"start_time": "2023-12-03T00:13:56.700300107Z"
}
},
"outputs": [
{
"ename": "AssertionError",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001B[0;31m---------------------------------------------------------------------------\u001B[0m",
"\u001B[0;31mAssertionError\u001B[0m Traceback (most recent call last)",
"Cell \u001B[0;32mIn[1], line 9\u001B[0m\n\u001B[1;32m 6\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01msuperduperdb\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m CFG\n\u001B[1;32m 8\u001B[0m \u001B[38;5;66;03m# check that config has been properly set-up\u001B[39;00m\n\u001B[0;32m----> 9\u001B[0m \u001B[38;5;28;01massert\u001B[39;00m CFG\u001B[38;5;241m.\u001B[39mdata_backend \u001B[38;5;241m==\u001B[39m \u001B[38;5;124m'\u001B[39m\u001B[38;5;124mmongodb://superduper:superduper@mongodb:27017/test_db\u001B[39m\u001B[38;5;124m'\u001B[39m\n",
"\u001B[0;31mAssertionError\u001B[0m: "
]
}
],
"source": [
"import os\n",
"\n",
Expand All @@ -113,7 +130,12 @@
"cell_type": "code",
"execution_count": null,
"id": "ed9bfd66-6771-476e-ae44-360c05aa69ed",
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2023-12-03T00:13:57.784130263Z",
"start_time": "2023-12-03T00:13:57.783877029Z"
}
},
"outputs": [],
"source": [
"from superduperdb.backends.mongodb import Collection\n",
Expand All @@ -136,7 +158,11 @@
"cell_type": "code",
"execution_count": null,
"id": "bae34017-6259-42df-beae-1191ea0f6374",
"metadata": {},
"metadata": {
"ExecuteTime": {
"start_time": "2023-12-03T00:13:57.784872242Z"
}
},
"outputs": [],
"source": [
"!curl -O https://superduperdb-public.s3.eu-west-1.amazonaws.com/pymongo.json\n",
Expand All @@ -161,7 +187,11 @@
"cell_type": "code",
"execution_count": null,
"id": "726143ee-61f1-4353-806b-a9c9384b569d",
"metadata": {},
"metadata": {
"ExecuteTime": {
"start_time": "2023-12-03T00:13:57.785785759Z"
}
},
"outputs": [],
"source": [
"from superduperdb import Document\n",
Expand All @@ -184,7 +214,11 @@
"cell_type": "code",
"execution_count": null,
"id": "e6847b06-cf2e-4134-89df-9651f7fc8604",
"metadata": {},
"metadata": {
"ExecuteTime": {
"start_time": "2023-12-03T00:13:57.786751582Z"
}
},
"outputs": [],
"source": [
"import sentence_transformers\n",
Expand Down Expand Up @@ -212,7 +246,11 @@
"cell_type": "code",
"execution_count": null,
"id": "fdcbcc3f-f817-49dc-912c-aeb7c0f1916d",
"metadata": {},
"metadata": {
"ExecuteTime": {
"start_time": "2023-12-03T00:13:57.787530354Z"
}
},
"outputs": [],
"source": [
"from superduperdb import Listener, VectorIndex\n",
Expand Down Expand Up @@ -243,7 +281,11 @@
"cell_type": "code",
"execution_count": null,
"id": "fbd3d575-709f-4b8a-bdda-dad21799a65b",
"metadata": {},
"metadata": {
"ExecuteTime": {
"start_time": "2023-12-03T00:13:57.788284643Z"
}
},
"outputs": [],
"source": [
"jobs[0].watch()"
Expand All @@ -261,7 +303,11 @@
"cell_type": "code",
"execution_count": null,
"id": "98ec7560-99d9-401b-971c-e87bcde48e78",
"metadata": {},
"metadata": {
"ExecuteTime": {
"start_time": "2023-12-03T00:13:57.789613615Z"
}
},
"outputs": [],
"source": [
"db.execute(doc_collection.find_one())"
Expand All @@ -282,7 +328,10 @@
"execution_count": null,
"id": "d4b96bdb-2b99-4a09-82a0-ad9f337d2d41",
"metadata": {
"scrolled": true
"scrolled": true,
"ExecuteTime": {
"start_time": "2023-12-03T00:13:57.789633296Z"
}
},
"outputs": [],
"source": [
Expand Down Expand Up @@ -326,7 +375,11 @@
"cell_type": "code",
"execution_count": null,
"id": "5bc61e63-abd9-4556-90a4-cdcbf5b10978",
"metadata": {},
"metadata": {
"ExecuteTime": {
"start_time": "2023-12-03T00:13:57.830389175Z"
}
},
"outputs": [],
"source": [
"import pymongo\n",
Expand Down Expand Up @@ -366,7 +419,11 @@
"cell_type": "code",
"execution_count": null,
"id": "b2df24bb-b394-4c14-99bf-c1dde1a486c0",
"metadata": {},
"metadata": {
"ExecuteTime": {
"start_time": "2023-12-03T00:13:57.830461965Z"
}
},
"outputs": [],
"source": [
"db.metadata.show_jobs()"
Expand All @@ -385,7 +442,11 @@
"cell_type": "code",
"execution_count": null,
"id": "2dd970cd-f01e-4105-85d6-1f39682c1e02",
"metadata": {},
"metadata": {
"ExecuteTime": {
"start_time": "2023-12-03T00:13:57.830491870Z"
}
},
"outputs": [],
"source": [
"db.execute(doc_collection.count_documents({'_outputs': {'$exists': 1}}))"
Expand Down
2 changes: 1 addition & 1 deletion examples/sql-example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
"!curl -O https://superduperdb-public.s3.eu-west-1.amazonaws.com/captions_tiny.json\n",
"\n",
"# Unzip the contents of coco_sample.zip\n",
"!unzip coco_sample.zip\n",
"!unzip -f coco_sample.zip\n",
"\n",
"# Create a directory named 'data/coco'\n",
"!mkdir -p data/coco\n",
Expand Down

0 comments on commit 1f9af17

Please sign in to comment.