Skip to content

Commit

Permalink
Colab standardize restarts (#305)
Browse files Browse the repository at this point in the history
copy/paste 3 json blocks into colabs for "search" and "gemini" for
runtime restart standardization.

I spot-checked 2 of the colabs and they are working correctly.

Want to land this PR before editing more of the colabs.

Related to issue #280

---------

Co-authored-by: Holt Skinner <13262395+holtskinner@users.noreply.github.com>
Co-authored-by: Holt Skinner <holtskinner@google.com>
  • Loading branch information
3 people committed Jan 5, 2024
1 parent b454019 commit 2d77dde
Show file tree
Hide file tree
Showing 16 changed files with 636 additions and 277 deletions.
1 change: 1 addition & 0 deletions .gitleaksignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/github/workspace/gemini/use-cases/education/use_cases_for_education.ipynb:aws-access-token:2788
48 changes: 39 additions & 9 deletions embeddings/intro-textemb-vectorsearch.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -345,27 +345,57 @@
{
"cell_type": "markdown",
"metadata": {
"id": "uqWjsicWVM2v"
"id": "R5Xep4W9lq-Z"
},
"source": [
"To use the newly installed packages in this Jupyter runtime, we need to restart the runtime. You can do this by running the cell below, which will restart the current kernel."
"### Restart current runtime\n",
"\n",
"To use the newly installed packages in this Jupyter runtime, you must restart the runtime. You can do this by running the cell below, which will restart the current kernel."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "i6VvjArI_zIS"
},
"outputs": [],
"source": [
"# restart kernel after installs so that your environment can access the new packages\n",
"execution_count": 2,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "XRvKdaPDTznN",
"outputId": "154a71b5-f302-4f53-ed2f-b3e5fef9195b"
},
"outputs": [
{
"data": {
"text/plain": [
"{'status': 'ok', 'restart': True}"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Restart kernel after installs so that your environment can access the new packages\n",
"import IPython\n",
"import time\n",
"\n",
"app = IPython.Application.instance()\n",
"app.kernel.do_shutdown(True)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "SbmM4z7FOBpM"
},
"source": [
"<div class=\"alert alert-block alert-warning\">\n",
"<b>⚠️ The kernel is going to restart. Please wait until it is finished before continuing to the next step. ⚠️</b>\n",
"</div>\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {
Expand Down
44 changes: 37 additions & 7 deletions embeddings/vector-search-quickstart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -153,27 +153,57 @@
{
"cell_type": "markdown",
"metadata": {
"id": "Ga5MMFwHnn0l"
"id": "R5Xep4W9lq-Z"
},
"source": [
"To use the newly installed packages in this Jupyter runtime, we need to restart the runtime. You can do this by running the cell below, which will restart the current kernel."
"### Restart current runtime\n",
"\n",
"To use the newly installed packages in this Jupyter runtime, you must restart the runtime. You can do this by running the cell below, which will restart the current kernel."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "UvGpAY5pRaQ5"
},
"outputs": [],
"execution_count": 2,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "XRvKdaPDTznN",
"outputId": "154a71b5-f302-4f53-ed2f-b3e5fef9195b"
},
"outputs": [
{
"data": {
"text/plain": [
"{'status': 'ok', 'restart': True}"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Restart kernel after installs so that your environment can access the new packages\n",
"import IPython\n",
"import time\n",
"\n",
"app = IPython.Application.instance()\n",
"app.kernel.do_shutdown(True)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "SbmM4z7FOBpM"
},
"source": [
"<div class=\"alert alert-block alert-warning\">\n",
"<b>⚠️ The kernel is going to restart. Please wait until it is finished before continuing to the next step. ⚠️</b>\n",
"</div>\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {
Expand Down
77 changes: 43 additions & 34 deletions gemini/function-calling/intro_function_calling.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -133,49 +133,58 @@
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "j7UyNVSiyQ96"
},
"source": [
"### Restart current runtime\n",
"cell_type": "markdown",
"metadata": {
"id": "R5Xep4W9lq-Z"
},
"source": [
"### Restart current runtime\n",
"\n",
"To use the newly installed packages in this Jupyter runtime, it is recommended to restart the runtime. Run the following cell to restart the current kernel.\n",
"\n",
"The restart process might take a minute or so.\n"
]
"To use the newly installed packages in this Jupyter runtime, you must restart the runtime. You can do this by running the cell below, which will restart the current kernel."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "YmY9HVVGSBW5"
},
"outputs": [],
"source": [
"cell_type": "code",
"execution_count": 2,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "XRvKdaPDTznN",
"outputId": "154a71b5-f302-4f53-ed2f-b3e5fef9195b"
},
"outputs": [
{
"data": {
"text/plain": [
"{'status': 'ok', 'restart': True}"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Restart kernel after installs so that your environment can access the new packages\n",
"import IPython\n",
"import time\n",
"\n",
"app = IPython.Application.instance()\n",
"app.kernel.do_shutdown(True)"
]
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"After the restart is complete, continue to the next step.\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "EXQZrM5hQeKb"
},
"source": [
"<div class=\"alert alert-block alert-warning\">\n",
"<b>⚠️ Wait for the kernel to finish restarting before you continue. ⚠️</b>\n",
"</div>\n"
]
"cell_type": "markdown",
"metadata": {
"id": "SbmM4z7FOBpM"
},
"source": [
"<div class=\"alert alert-block alert-warning\">\n",
"<b>⚠️ The kernel is going to restart. Please wait until it is finished before continuing to the next step. ⚠️</b>\n",
"</div>\n",
"\n"
]
},
{
"cell_type": "markdown",
Expand Down
44 changes: 26 additions & 18 deletions gemini/getting-started/intro_gemini_python.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -150,47 +150,55 @@
{
"cell_type": "markdown",
"metadata": {
"id": "j7UyNVSiyQ96"
"id": "R5Xep4W9lq-Z"
},
"source": [
"### Restart current runtime\n",
"\n",
"To use the newly installed packages in this Jupyter runtime, it is recommended to restart the runtime. Run the following cell to restart the current kernel.\n",
"\n",
"The restart process might take a minute or so.\n"
"To use the newly installed packages in this Jupyter runtime, you must restart the runtime. You can do this by running the cell below, which will restart the current kernel."
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {
"id": "YmY9HVVGSBW5",
"tags": []
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "XRvKdaPDTznN",
"outputId": "154a71b5-f302-4f53-ed2f-b3e5fef9195b"
},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"{'status': 'ok', 'restart': True}"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Restart kernel after installs so that your environment can access the new packages\n",
"import IPython\n",
"import time\n",
"\n",
"app = IPython.Application.instance()\n",
"app.kernel.do_shutdown(True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"After the restart is complete, continue to the next step.\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "EXQZrM5hQeKb"
"id": "SbmM4z7FOBpM"
},
"source": [
"<div class=\"alert alert-block alert-warning\">\n",
"<b>⚠️ Wait for the kernel to finish restarting before you continue. ⚠️</b>\n",
"</div>\n"
"<b>⚠️ The kernel is going to restart. Please wait until it is finished before continuing to the next step. ⚠️</b>\n",
"</div>\n",
"\n"
]
},
{
Expand Down
73 changes: 43 additions & 30 deletions gemini/responsible-ai/gemini_safety_ratings.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -128,45 +128,58 @@
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Restart current runtime\n",
"\n",
"To use the newly installed packages in this Jupyter runtime, it is recommended to restart the runtime. Run the following cell to restart the current kernel.\n",
"cell_type": "markdown",
"metadata": {
"id": "R5Xep4W9lq-Z"
},
"source": [
"### Restart current runtime\n",
"\n",
"The restart process might take a minute or so.\n"
]
"To use the newly installed packages in this Jupyter runtime, you must restart the runtime. You can do this by running the cell below, which will restart the current kernel."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"cell_type": "code",
"execution_count": 2,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "XRvKdaPDTznN",
"outputId": "154a71b5-f302-4f53-ed2f-b3e5fef9195b"
},
"outputs": [
{
"data": {
"text/plain": [
"{'status': 'ok', 'restart': True}"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Restart kernel after installs so that your environment can access the new packages\n",
"import IPython\n",
"import time\n",
"\n",
"app = IPython.Application.instance()\n",
"app.kernel.do_shutdown(True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"After the restart is complete, continue to the next step.\n"
]
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-warning\">\n",
"<b>⚠️ Wait for the kernel to finish restarting before you continue. ⚠️</b>\n",
"</div>\n"
]
"cell_type": "markdown",
"metadata": {
"id": "SbmM4z7FOBpM"
},
"source": [
"<div class=\"alert alert-block alert-warning\">\n",
"<b>⚠️ The kernel is going to restart. Please wait until it is finished before continuing to the next step. ⚠️</b>\n",
"</div>\n",
"\n"
]
},
{
"cell_type": "markdown",
Expand Down
Loading

0 comments on commit 2d77dde

Please sign in to comment.