Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make transfer learning work #2541

Merged
merged 3 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Make JSON-able a configuration depending on the databackend
- Restore some training test cases
- Simple querying shell
- Fix existing templates

#### New Features & Functionality

Expand Down
5 changes: 5 additions & 0 deletions superduper/components/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1305,6 +1305,11 @@ def predict(self, *args, **kwargs) -> t.Any:
logging.info(f'Predicting with model {self.model}')
return self.models[self.model].predict(*args, **kwargs)

@override
def fit(self, *args, **kwargs) -> t.Any:
logging.info(f'Fitting with model {self.model}')
return self.models[self.model].fit(*args, **kwargs)

@override
def predict_batches(self, dataset) -> t.List:
logging.info(f'Predicting with model {self.model}')
Expand Down
46 changes: 32 additions & 14 deletions templates/multimodal_image_search/build.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"source": [
"from superduper import superduper\n",
"\n",
"db = superduper('mongomock:///test_db')"
"db = superduper('mongomock:///test_db')\n"
]
},
{
Expand All @@ -51,7 +51,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"id": "0828031a",
"metadata": {},
"outputs": [],
Expand All @@ -66,12 +66,12 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"id": "44a702b1-faf9-4edb-8a55-efc4add84a83",
"metadata": {},
"outputs": [],
"source": [
"data = [{'img': d} for d in data[:100]]"
"data = [{'img': d} for d in data[:10]]"
]
},
{
Expand All @@ -92,7 +92,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"id": "5375ff04-8b6d-40b0-a8b2-6aa124636871",
"metadata": {},
"outputs": [],
Expand All @@ -104,7 +104,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"id": "489a19c2-c673-4bf9-9bea-f4bb279fc462",
"metadata": {},
"outputs": [],
Expand All @@ -124,7 +124,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"id": "8751ede0-4b9f-4f92-b4ec-f6b0e0740c30",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -168,7 +168,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"id": "12e75fab-8504-4d17-a7d9-f98667a5d6aa",
"metadata": {},
"outputs": [],
Expand All @@ -187,7 +187,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"id": "66ee3ff4-880e-477b-bbdf-5b8d89c56de2",
"metadata": {},
"outputs": [],
Expand All @@ -197,7 +197,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"id": "4cede653",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -277,7 +277,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 12,
"id": "ce565823-4655-488c-8684-2240107fa30d",
"metadata": {},
"outputs": [],
Expand All @@ -288,16 +288,26 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 15,
"id": "d8059626-dff8-4fe0-b872-97b8eb8b1b01",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"{'img': <PIL.PngImagePlugin.PngImageFile image mode=RGB size=500x338>}"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# <tab: Image>\n",
"from IPython.display import display\n",
"search_image = data[0]\n",
"display(search_image)\n",
"item = Document({indexing_key: search_image})"
"item = Document(search_image)"
]
},
{
Expand Down Expand Up @@ -364,6 +374,14 @@
"\n",
"template.export('.')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "759db69c-c3e6-47e5-af6d-e089c1e8ad4e",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
Loading
Loading