-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Upload dataset from il sdk (#1116)
* feat: Add submit_dataset to studio client * feat: Add how-to for submitting existing datasets to studio * feat: Introduce mapper functions to avoid circular dependencies * refactor: Remove DataClient Dependency * feat: add warning to StudioDatasetRepository --------- Co-authored-by: Johannes Wesch <[email protected]>
- Loading branch information
1 parent
6642e53
commit 1b851ed
Showing
10 changed files
with
370 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
src/documentation/how_tos/studio/how_to_upload_existing_datasets_to_studio.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from uuid import uuid4\n", | ||
"\n", | ||
"from documentation.how_tos.example_data import example_data\n", | ||
"from intelligence_layer.connectors import StudioClient\n", | ||
"from intelligence_layer.evaluation.dataset.studio_dataset_repository import (\n", | ||
" StudioDatasetRepository,\n", | ||
")\n", | ||
"\n", | ||
"my_example_data = example_data()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# How to upload (existing) datasets to Studio\n", | ||
"<div class=\"alert alert-info\"> \n", | ||
"\n", | ||
"Make sure your account has permissions to use the Studio application.\n", | ||
"\n", | ||
"For an on-prem or local installation, please contact the corresponding team.\n", | ||
"</div>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"\n", | ||
"0. Extract `Dataset` and `Examples` from your `DatasetRepository`.\n", | ||
"\n", | ||
"1. Initialize a `StudioClient` with a project.\n", | ||
" - Use an existing project or create a new one with the `StudioClient.create_project` function.\n", | ||
" \n", | ||
"2. Create a `StudioDatasetRepository` and create a new `Dataset` via `StudioDatasetRepository.create_dataset`, which will automatically upload this new `Dataset` to Studio.\n", | ||
"\n", | ||
"### Example" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Step 0\n", | ||
"existing_dataset_repo = my_example_data.dataset_repository\n", | ||
"\n", | ||
"existing_dataset = existing_dataset_repo.dataset(dataset_id=my_example_data.dataset.id)\n", | ||
"assert existing_dataset, \"Make sure your dataset still exists.\"\n", | ||
"\n", | ||
"existing_examples = existing_dataset_repo.examples(\n", | ||
" existing_dataset.id, input_type=str, expected_output_type=str\n", | ||
")\n", | ||
"\n", | ||
"# Step 1\n", | ||
"project_name = str(uuid4())\n", | ||
"studio_client = StudioClient(project=project_name)\n", | ||
"my_project = studio_client.create_project(project=project_name)\n", | ||
"\n", | ||
"# Step 2\n", | ||
"studio_dataset_repo = StudioDatasetRepository(studio_client=studio_client)\n", | ||
"\n", | ||
"studio_dataset = studio_dataset_repo.create_dataset(\n", | ||
" examples=existing_examples,\n", | ||
" dataset_name=existing_dataset.name,\n", | ||
" labels=existing_dataset.labels,\n", | ||
" metadata=existing_dataset.metadata,\n", | ||
")" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "intelligence-layer-aL2cXmJM-py3.11", | ||
"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.11.8" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.