-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add how-to for submitting existing datasets to studio
- Loading branch information
1 parent
53a335a
commit dc16df4
Showing
3 changed files
with
78 additions
and
1 deletion.
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
77 changes: 77 additions & 0 deletions
77
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,77 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from uuid import uuid4\n", | ||
"\n", | ||
"from intelligence_layer.connectors import StudioClient\n", | ||
"from intelligence_layer.evaluation import InMemoryDatasetRepository" | ||
] | ||
}, | ||
{ | ||
"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", | ||
"2. Submit your `Dataset`along with the corresponding `Examples` with the client.\n", | ||
"\n", | ||
"### Example" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Step 0\n", | ||
"\n", | ||
"existing_dataset_repo = InMemoryDatasetRepository()\n", | ||
"existing_dataset = existing_dataset_repo.dataset(dataset_id=\"my_existing_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_id = studio_client.submit_dataset(\n", | ||
" dataset=existing_dataset, examples=existing_examples\n", | ||
")" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"language_info": { | ||
"name": "python" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
File renamed without changes.