mirror of
https://github.com/GoogleCloudPlatform/vertex-ai-samples.git
synced 2026-09-28 16:11:56 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b95c6bae8f |
+25
-593
@@ -2,7 +2,7 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "KSP1duKDeaDR"
|
||||
},
|
||||
@@ -118,7 +118,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "C1ZEiJcophY0"
|
||||
},
|
||||
@@ -183,19 +183,11 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "oM1iC_MfAts1"
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Updated property [core/project].\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"PROJECT_ID = \"[your-project-id]\" # @param {type:\"string\"}\n",
|
||||
"\n",
|
||||
@@ -216,7 +208,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "RfLtjhGNmKvA"
|
||||
},
|
||||
@@ -257,7 +249,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "254614fa0c46"
|
||||
},
|
||||
@@ -277,7 +269,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "603adbbf0532"
|
||||
},
|
||||
@@ -312,7 +304,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "snBUuUamoJPz"
|
||||
},
|
||||
@@ -333,7 +325,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "412d00f1-08db-4880-8ced-52a9583757b8"
|
||||
},
|
||||
@@ -351,7 +343,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "zgVQcE0ewO8W"
|
||||
},
|
||||
@@ -363,7 +355,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "1e6e1b98-a632-44a2-afb8-fc212018ef4f"
|
||||
},
|
||||
@@ -385,28 +377,18 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "2OUg-Qf8iFta"
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Copying gs://cloud-samples-data/vertex-ai/dataset-management/datasets/bert_finetuning/wide_and_deep_trainer_container_tests_input.jsonl...\n",
|
||||
"/ [1 files][ 14.1 KiB/ 14.1 KiB] \n",
|
||||
"Operation completed over 1 objects/14.1 KiB. \n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"!gsutil cp gs://cloud-samples-data/vertex-ai/dataset-management/datasets/bert_finetuning/wide_and_deep_trainer_container_tests_input.jsonl ."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "BNPapKXviHlE"
|
||||
},
|
||||
@@ -422,291 +404,11 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "Z1Y9Bx2miJba"
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"\n",
|
||||
"\n",
|
||||
" <div id=\"df-cb0ca7a6-703c-4d60-8434-61e1187029c6\">\n",
|
||||
" <div class=\"colab-df-container\">\n",
|
||||
" <div>\n",
|
||||
"<style scoped>\n",
|
||||
" .dataframe tbody tr th:only-of-type {\n",
|
||||
" vertical-align: middle;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe tbody tr th {\n",
|
||||
" vertical-align: top;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe thead th {\n",
|
||||
" text-align: right;\n",
|
||||
" }\n",
|
||||
"</style>\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
" <th></th>\n",
|
||||
" <th>textContent</th>\n",
|
||||
" <th>classificationAnnotation</th>\n",
|
||||
" <th>dataItemResourceLabels</th>\n",
|
||||
" </tr>\n",
|
||||
" </thead>\n",
|
||||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>Cats are good pets, for they are clean and are...</td>\n",
|
||||
" <td>{'displayName': 'FirstClass', 'annotationResou...</td>\n",
|
||||
" <td>{'aiplatform.googleapis.com/ml_use': 'training'}</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>1</th>\n",
|
||||
" <td>More RVs were seen in the storage lot than at ...</td>\n",
|
||||
" <td>{'displayName': 'SecondClass', 'annotationReso...</td>\n",
|
||||
" <td>{'aiplatform.googleapis.com/ml_use': 'training'}</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>2</th>\n",
|
||||
" <td>When he asked her favorite number, she answere...</td>\n",
|
||||
" <td>{'displayName': 'FirstClass', 'annotationResou...</td>\n",
|
||||
" <td>{'aiplatform.googleapis.com/ml_use': 'training'}</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3</th>\n",
|
||||
" <td>Greetings from the real universe.</td>\n",
|
||||
" <td>{'displayName': 'SecondClass', 'annotationReso...</td>\n",
|
||||
" <td>{'aiplatform.googleapis.com/ml_use': 'training'}</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>4</th>\n",
|
||||
" <td>As he entered the church he could hear the sof...</td>\n",
|
||||
" <td>{'displayName': 'FirstClass', 'annotationResou...</td>\n",
|
||||
" <td>{'aiplatform.googleapis.com/ml_use': 'training'}</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>5</th>\n",
|
||||
" <td>They got there early, and they got really good...</td>\n",
|
||||
" <td>{'displayName': 'SecondClass', 'annotationReso...</td>\n",
|
||||
" <td>{'aiplatform.googleapis.com/ml_use': 'training'}</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>6</th>\n",
|
||||
" <td>Pink horses galloped across the sea.</td>\n",
|
||||
" <td>{'displayName': 'FirstClass', 'annotationResou...</td>\n",
|
||||
" <td>{'aiplatform.googleapis.com/ml_use': 'training'}</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>7</th>\n",
|
||||
" <td>Even though he thought the world was flat he d...</td>\n",
|
||||
" <td>{'displayName': 'SecondClass', 'annotationReso...</td>\n",
|
||||
" <td>{'aiplatform.googleapis.com/ml_use': 'training'}</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>8</th>\n",
|
||||
" <td>He wondered if she would appreciate his toenai...</td>\n",
|
||||
" <td>{'displayName': 'FirstClass', 'annotationResou...</td>\n",
|
||||
" <td>{'aiplatform.googleapis.com/ml_use': 'training'}</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>9</th>\n",
|
||||
" <td>They say people remember important moments in ...</td>\n",
|
||||
" <td>{'displayName': 'SecondClass', 'annotationReso...</td>\n",
|
||||
" <td>{'aiplatform.googleapis.com/ml_use': 'training'}</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"</div>\n",
|
||||
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-cb0ca7a6-703c-4d60-8434-61e1187029c6')\"\n",
|
||||
" title=\"Convert this dataframe to an interactive table.\"\n",
|
||||
" style=\"display:none;\">\n",
|
||||
"\n",
|
||||
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
|
||||
" width=\"24px\">\n",
|
||||
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
|
||||
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
|
||||
" </svg>\n",
|
||||
" </button>\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" <div id=\"df-3b403ec2-b2a4-4989-b4dc-ea741ab4ece2\">\n",
|
||||
" <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-3b403ec2-b2a4-4989-b4dc-ea741ab4ece2')\"\n",
|
||||
" title=\"Suggest charts.\"\n",
|
||||
" style=\"display:none;\">\n",
|
||||
"\n",
|
||||
"<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
|
||||
" width=\"24px\">\n",
|
||||
" <g>\n",
|
||||
" <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
|
||||
" </g>\n",
|
||||
"</svg>\n",
|
||||
" </button>\n",
|
||||
" </div>\n",
|
||||
"\n",
|
||||
"<style>\n",
|
||||
" .colab-df-quickchart {\n",
|
||||
" background-color: #E8F0FE;\n",
|
||||
" border: none;\n",
|
||||
" border-radius: 50%;\n",
|
||||
" cursor: pointer;\n",
|
||||
" display: none;\n",
|
||||
" fill: #1967D2;\n",
|
||||
" height: 32px;\n",
|
||||
" padding: 0 0 0 0;\n",
|
||||
" width: 32px;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .colab-df-quickchart:hover {\n",
|
||||
" background-color: #E2EBFA;\n",
|
||||
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
|
||||
" fill: #174EA6;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" [theme=dark] .colab-df-quickchart {\n",
|
||||
" background-color: #3B4455;\n",
|
||||
" fill: #D2E3FC;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" [theme=dark] .colab-df-quickchart:hover {\n",
|
||||
" background-color: #434B5C;\n",
|
||||
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
|
||||
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
|
||||
" fill: #FFFFFF;\n",
|
||||
" }\n",
|
||||
"</style>\n",
|
||||
"\n",
|
||||
" <script>\n",
|
||||
" async function quickchart(key) {\n",
|
||||
" const containerElement = document.querySelector('#' + key);\n",
|
||||
" const charts = await google.colab.kernel.invokeFunction(\n",
|
||||
" 'suggestCharts', [key], {});\n",
|
||||
" }\n",
|
||||
" </script>\n",
|
||||
"\n",
|
||||
" <script>\n",
|
||||
"\n",
|
||||
"function displayQuickchartButton(domScope) {\n",
|
||||
" let quickchartButtonEl =\n",
|
||||
" domScope.querySelector('#df-3b403ec2-b2a4-4989-b4dc-ea741ab4ece2 button.colab-df-quickchart');\n",
|
||||
" quickchartButtonEl.style.display =\n",
|
||||
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
" displayQuickchartButton(document);\n",
|
||||
" </script>\n",
|
||||
" <style>\n",
|
||||
" .colab-df-container {\n",
|
||||
" display:flex;\n",
|
||||
" flex-wrap:wrap;\n",
|
||||
" gap: 12px;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .colab-df-convert {\n",
|
||||
" background-color: #E8F0FE;\n",
|
||||
" border: none;\n",
|
||||
" border-radius: 50%;\n",
|
||||
" cursor: pointer;\n",
|
||||
" display: none;\n",
|
||||
" fill: #1967D2;\n",
|
||||
" height: 32px;\n",
|
||||
" padding: 0 0 0 0;\n",
|
||||
" width: 32px;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .colab-df-convert:hover {\n",
|
||||
" background-color: #E2EBFA;\n",
|
||||
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
|
||||
" fill: #174EA6;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" [theme=dark] .colab-df-convert {\n",
|
||||
" background-color: #3B4455;\n",
|
||||
" fill: #D2E3FC;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" [theme=dark] .colab-df-convert:hover {\n",
|
||||
" background-color: #434B5C;\n",
|
||||
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
|
||||
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
|
||||
" fill: #FFFFFF;\n",
|
||||
" }\n",
|
||||
" </style>\n",
|
||||
"\n",
|
||||
" <script>\n",
|
||||
" const buttonEl =\n",
|
||||
" document.querySelector('#df-cb0ca7a6-703c-4d60-8434-61e1187029c6 button.colab-df-convert');\n",
|
||||
" buttonEl.style.display =\n",
|
||||
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
|
||||
"\n",
|
||||
" async function convertToInteractive(key) {\n",
|
||||
" const element = document.querySelector('#df-cb0ca7a6-703c-4d60-8434-61e1187029c6');\n",
|
||||
" const dataTable =\n",
|
||||
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
|
||||
" [key], {});\n",
|
||||
" if (!dataTable) return;\n",
|
||||
"\n",
|
||||
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
|
||||
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
|
||||
" + ' to learn more about interactive tables.';\n",
|
||||
" element.innerHTML = '';\n",
|
||||
" dataTable['output_type'] = 'display_data';\n",
|
||||
" await google.colab.output.renderOutput(dataTable, element);\n",
|
||||
" const docLink = document.createElement('div');\n",
|
||||
" docLink.innerHTML = docLinkHtml;\n",
|
||||
" element.appendChild(docLink);\n",
|
||||
" }\n",
|
||||
" </script>\n",
|
||||
" </div>\n",
|
||||
" </div>\n"
|
||||
],
|
||||
"text/plain": [
|
||||
" textContent \\\n",
|
||||
"0 Cats are good pets, for they are clean and are... \n",
|
||||
"1 More RVs were seen in the storage lot than at ... \n",
|
||||
"2 When he asked her favorite number, she answere... \n",
|
||||
"3 Greetings from the real universe. \n",
|
||||
"4 As he entered the church he could hear the sof... \n",
|
||||
"5 They got there early, and they got really good... \n",
|
||||
"6 Pink horses galloped across the sea. \n",
|
||||
"7 Even though he thought the world was flat he d... \n",
|
||||
"8 He wondered if she would appreciate his toenai... \n",
|
||||
"9 They say people remember important moments in ... \n",
|
||||
"\n",
|
||||
" classificationAnnotation \\\n",
|
||||
"0 {'displayName': 'FirstClass', 'annotationResou... \n",
|
||||
"1 {'displayName': 'SecondClass', 'annotationReso... \n",
|
||||
"2 {'displayName': 'FirstClass', 'annotationResou... \n",
|
||||
"3 {'displayName': 'SecondClass', 'annotationReso... \n",
|
||||
"4 {'displayName': 'FirstClass', 'annotationResou... \n",
|
||||
"5 {'displayName': 'SecondClass', 'annotationReso... \n",
|
||||
"6 {'displayName': 'FirstClass', 'annotationResou... \n",
|
||||
"7 {'displayName': 'SecondClass', 'annotationReso... \n",
|
||||
"8 {'displayName': 'FirstClass', 'annotationResou... \n",
|
||||
"9 {'displayName': 'SecondClass', 'annotationReso... \n",
|
||||
"\n",
|
||||
" dataItemResourceLabels \n",
|
||||
"0 {'aiplatform.googleapis.com/ml_use': 'training'} \n",
|
||||
"1 {'aiplatform.googleapis.com/ml_use': 'training'} \n",
|
||||
"2 {'aiplatform.googleapis.com/ml_use': 'training'} \n",
|
||||
"3 {'aiplatform.googleapis.com/ml_use': 'training'} \n",
|
||||
"4 {'aiplatform.googleapis.com/ml_use': 'training'} \n",
|
||||
"5 {'aiplatform.googleapis.com/ml_use': 'training'} \n",
|
||||
"6 {'aiplatform.googleapis.com/ml_use': 'training'} \n",
|
||||
"7 {'aiplatform.googleapis.com/ml_use': 'training'} \n",
|
||||
"8 {'aiplatform.googleapis.com/ml_use': 'training'} \n",
|
||||
"9 {'aiplatform.googleapis.com/ml_use': 'training'} "
|
||||
]
|
||||
},
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Peek at the data.\n",
|
||||
"df = pd.DataFrame(records)\n",
|
||||
@@ -715,7 +417,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "1v7zUwoWiPl-"
|
||||
},
|
||||
@@ -741,259 +443,11 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "QUQYhwpXie_-"
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"\n",
|
||||
"\n",
|
||||
" <div id=\"df-1479f378-5477-42b8-a034-2ffa6ff5eac4\">\n",
|
||||
" <div class=\"colab-df-container\">\n",
|
||||
" <div>\n",
|
||||
"<style scoped>\n",
|
||||
" .dataframe tbody tr th:only-of-type {\n",
|
||||
" vertical-align: middle;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe tbody tr th {\n",
|
||||
" vertical-align: top;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe thead th {\n",
|
||||
" text-align: right;\n",
|
||||
" }\n",
|
||||
"</style>\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
" <th></th>\n",
|
||||
" <th>textContent</th>\n",
|
||||
" <th>classificationAnnotation</th>\n",
|
||||
" <th>dataItemResourceLabels</th>\n",
|
||||
" <th>embedding</th>\n",
|
||||
" </tr>\n",
|
||||
" </thead>\n",
|
||||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>Cats are good pets, for they are clean and are...</td>\n",
|
||||
" <td>{'displayName': 'FirstClass', 'annotationResou...</td>\n",
|
||||
" <td>{'aiplatform.googleapis.com/ml_use': 'training'}</td>\n",
|
||||
" <td>[0.037178341299295425, -0.010241042822599411, ...</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>1</th>\n",
|
||||
" <td>More RVs were seen in the storage lot than at ...</td>\n",
|
||||
" <td>{'displayName': 'SecondClass', 'annotationReso...</td>\n",
|
||||
" <td>{'aiplatform.googleapis.com/ml_use': 'training'}</td>\n",
|
||||
" <td>[-0.011439577676355839, -0.032596345990896225,...</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>2</th>\n",
|
||||
" <td>When he asked her favorite number, she answere...</td>\n",
|
||||
" <td>{'displayName': 'FirstClass', 'annotationResou...</td>\n",
|
||||
" <td>{'aiplatform.googleapis.com/ml_use': 'training'}</td>\n",
|
||||
" <td>[0.020134523510932922, -0.0022515689488500357,...</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3</th>\n",
|
||||
" <td>Greetings from the real universe.</td>\n",
|
||||
" <td>{'displayName': 'SecondClass', 'annotationReso...</td>\n",
|
||||
" <td>{'aiplatform.googleapis.com/ml_use': 'training'}</td>\n",
|
||||
" <td>[-0.016334038227796555, 0.0007779737352393568,...</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>4</th>\n",
|
||||
" <td>As he entered the church he could hear the sof...</td>\n",
|
||||
" <td>{'displayName': 'FirstClass', 'annotationResou...</td>\n",
|
||||
" <td>{'aiplatform.googleapis.com/ml_use': 'training'}</td>\n",
|
||||
" <td>[0.005115862935781479, -0.034255024045705795, ...</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"</div>\n",
|
||||
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-1479f378-5477-42b8-a034-2ffa6ff5eac4')\"\n",
|
||||
" title=\"Convert this dataframe to an interactive table.\"\n",
|
||||
" style=\"display:none;\">\n",
|
||||
"\n",
|
||||
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
|
||||
" width=\"24px\">\n",
|
||||
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
|
||||
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
|
||||
" </svg>\n",
|
||||
" </button>\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" <div id=\"df-1a15e67b-31cb-4138-bafe-7be1fd1413ef\">\n",
|
||||
" <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-1a15e67b-31cb-4138-bafe-7be1fd1413ef')\"\n",
|
||||
" title=\"Suggest charts.\"\n",
|
||||
" style=\"display:none;\">\n",
|
||||
"\n",
|
||||
"<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
|
||||
" width=\"24px\">\n",
|
||||
" <g>\n",
|
||||
" <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
|
||||
" </g>\n",
|
||||
"</svg>\n",
|
||||
" </button>\n",
|
||||
" </div>\n",
|
||||
"\n",
|
||||
"<style>\n",
|
||||
" .colab-df-quickchart {\n",
|
||||
" background-color: #E8F0FE;\n",
|
||||
" border: none;\n",
|
||||
" border-radius: 50%;\n",
|
||||
" cursor: pointer;\n",
|
||||
" display: none;\n",
|
||||
" fill: #1967D2;\n",
|
||||
" height: 32px;\n",
|
||||
" padding: 0 0 0 0;\n",
|
||||
" width: 32px;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .colab-df-quickchart:hover {\n",
|
||||
" background-color: #E2EBFA;\n",
|
||||
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
|
||||
" fill: #174EA6;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" [theme=dark] .colab-df-quickchart {\n",
|
||||
" background-color: #3B4455;\n",
|
||||
" fill: #D2E3FC;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" [theme=dark] .colab-df-quickchart:hover {\n",
|
||||
" background-color: #434B5C;\n",
|
||||
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
|
||||
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
|
||||
" fill: #FFFFFF;\n",
|
||||
" }\n",
|
||||
"</style>\n",
|
||||
"\n",
|
||||
" <script>\n",
|
||||
" async function quickchart(key) {\n",
|
||||
" const containerElement = document.querySelector('#' + key);\n",
|
||||
" const charts = await google.colab.kernel.invokeFunction(\n",
|
||||
" 'suggestCharts', [key], {});\n",
|
||||
" }\n",
|
||||
" </script>\n",
|
||||
"\n",
|
||||
" <script>\n",
|
||||
"\n",
|
||||
"function displayQuickchartButton(domScope) {\n",
|
||||
" let quickchartButtonEl =\n",
|
||||
" domScope.querySelector('#df-1a15e67b-31cb-4138-bafe-7be1fd1413ef button.colab-df-quickchart');\n",
|
||||
" quickchartButtonEl.style.display =\n",
|
||||
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
" displayQuickchartButton(document);\n",
|
||||
" </script>\n",
|
||||
" <style>\n",
|
||||
" .colab-df-container {\n",
|
||||
" display:flex;\n",
|
||||
" flex-wrap:wrap;\n",
|
||||
" gap: 12px;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .colab-df-convert {\n",
|
||||
" background-color: #E8F0FE;\n",
|
||||
" border: none;\n",
|
||||
" border-radius: 50%;\n",
|
||||
" cursor: pointer;\n",
|
||||
" display: none;\n",
|
||||
" fill: #1967D2;\n",
|
||||
" height: 32px;\n",
|
||||
" padding: 0 0 0 0;\n",
|
||||
" width: 32px;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .colab-df-convert:hover {\n",
|
||||
" background-color: #E2EBFA;\n",
|
||||
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
|
||||
" fill: #174EA6;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" [theme=dark] .colab-df-convert {\n",
|
||||
" background-color: #3B4455;\n",
|
||||
" fill: #D2E3FC;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" [theme=dark] .colab-df-convert:hover {\n",
|
||||
" background-color: #434B5C;\n",
|
||||
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
|
||||
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
|
||||
" fill: #FFFFFF;\n",
|
||||
" }\n",
|
||||
" </style>\n",
|
||||
"\n",
|
||||
" <script>\n",
|
||||
" const buttonEl =\n",
|
||||
" document.querySelector('#df-1479f378-5477-42b8-a034-2ffa6ff5eac4 button.colab-df-convert');\n",
|
||||
" buttonEl.style.display =\n",
|
||||
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
|
||||
"\n",
|
||||
" async function convertToInteractive(key) {\n",
|
||||
" const element = document.querySelector('#df-1479f378-5477-42b8-a034-2ffa6ff5eac4');\n",
|
||||
" const dataTable =\n",
|
||||
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
|
||||
" [key], {});\n",
|
||||
" if (!dataTable) return;\n",
|
||||
"\n",
|
||||
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
|
||||
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
|
||||
" + ' to learn more about interactive tables.';\n",
|
||||
" element.innerHTML = '';\n",
|
||||
" dataTable['output_type'] = 'display_data';\n",
|
||||
" await google.colab.output.renderOutput(dataTable, element);\n",
|
||||
" const docLink = document.createElement('div');\n",
|
||||
" docLink.innerHTML = docLinkHtml;\n",
|
||||
" element.appendChild(docLink);\n",
|
||||
" }\n",
|
||||
" </script>\n",
|
||||
" </div>\n",
|
||||
" </div>\n"
|
||||
],
|
||||
"text/plain": [
|
||||
" textContent \\\n",
|
||||
"0 Cats are good pets, for they are clean and are... \n",
|
||||
"1 More RVs were seen in the storage lot than at ... \n",
|
||||
"2 When he asked her favorite number, she answere... \n",
|
||||
"3 Greetings from the real universe. \n",
|
||||
"4 As he entered the church he could hear the sof... \n",
|
||||
"\n",
|
||||
" classificationAnnotation \\\n",
|
||||
"0 {'displayName': 'FirstClass', 'annotationResou... \n",
|
||||
"1 {'displayName': 'SecondClass', 'annotationReso... \n",
|
||||
"2 {'displayName': 'FirstClass', 'annotationResou... \n",
|
||||
"3 {'displayName': 'SecondClass', 'annotationReso... \n",
|
||||
"4 {'displayName': 'FirstClass', 'annotationResou... \n",
|
||||
"\n",
|
||||
" dataItemResourceLabels \\\n",
|
||||
"0 {'aiplatform.googleapis.com/ml_use': 'training'} \n",
|
||||
"1 {'aiplatform.googleapis.com/ml_use': 'training'} \n",
|
||||
"2 {'aiplatform.googleapis.com/ml_use': 'training'} \n",
|
||||
"3 {'aiplatform.googleapis.com/ml_use': 'training'} \n",
|
||||
"4 {'aiplatform.googleapis.com/ml_use': 'training'} \n",
|
||||
"\n",
|
||||
" embedding \n",
|
||||
"0 [0.037178341299295425, -0.010241042822599411, ... \n",
|
||||
"1 [-0.011439577676355839, -0.032596345990896225,... \n",
|
||||
"2 [0.020134523510932922, -0.0022515689488500357,... \n",
|
||||
"3 [-0.016334038227796555, 0.0007779737352393568,... \n",
|
||||
"4 [0.005115862935781479, -0.034255024045705795, ... "
|
||||
]
|
||||
},
|
||||
"execution_count": 15,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Peek at the data.\n",
|
||||
"df.head()"
|
||||
@@ -1010,7 +464,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "245bc8cd-038b-484a-acb2-3a705d4cc4cf"
|
||||
},
|
||||
@@ -1050,7 +504,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 17,
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "494079df-d8f6-4a6a-b26b-0b0477791adc"
|
||||
},
|
||||
@@ -1078,44 +532,22 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "50497681-6112-4147-a13e-afedb72b54f5"
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[docid:20] [0.6497225761413574] -- Hit me with your pet shark!...\n",
|
||||
"[docid:24] [0.6352805495262146] -- Today I dressed my unicorn in preparation for the race....\n",
|
||||
"[docid:30] [0.6284741163253784] -- A kangaroo is really just a rabbit on steroids....\n",
|
||||
"Latency (ms): 97.6724624633789\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"search(\"tell me about an animal\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "c814f835-3e2a-4366-a334-ccc636f00b83"
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[docid:9] [0.6281773447990417] -- They say people remember important moments in their life well, yet no one even remembers their own birth....\n",
|
||||
"[docid:19] [0.5852192640304565] -- The near-death experience brought new ideas to light....\n",
|
||||
"[docid:36] [0.5711853504180908] -- The most exciting eureka moment I've had was when I realized that the instructions on food packets were just guidelines....\n",
|
||||
"Latency (ms): 100.8751392364502\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"search(\"tell me about an important moment or event in your life\")"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user