You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by da...@apache.org on 2023/04/14 15:51:14 UTC
[beam] 01/01: Add outputs to custom inference notebook
This is an automated email from the ASF dual-hosted git repository.
damccorm pushed a commit to branch users/damccorm/outputs
in repository https://gitbox.apache.org/repos/asf/beam.git
commit f3263bdf61d861ca7409f1b30a962ed9ad1e4b78
Author: Danny McCormick <da...@google.com>
AuthorDate: Fri Apr 14 11:51:03 2023 -0400
Add outputs to custom inference notebook
---
.../notebooks/beam-ml/run_custom_inference.ipynb | 68 ++++++++++++++++------
1 file changed, 51 insertions(+), 17 deletions(-)
diff --git a/examples/notebooks/beam-ml/run_custom_inference.ipynb b/examples/notebooks/beam-ml/run_custom_inference.ipynb
index 33402dd324f..316f459d314 100644
--- a/examples/notebooks/beam-ml/run_custom_inference.ipynb
+++ b/examples/notebooks/beam-ml/run_custom_inference.ipynb
@@ -96,7 +96,9 @@
},
{
"cell_type": "markdown",
- "metadata": {},
+ "metadata": {
+ "id": "7f841596-f217-46d2-b64e-1952db4de4cc",
+ },
"source": [
"## Learn about `spaCy`\n",
"\n",
@@ -108,7 +110,9 @@
{
"cell_type": "code",
"execution_count": 3,
- "metadata": {},
+ "metadata": {
+ "id": "7f841596-f217-46d2-b64e-1952db4de4cd",
+ },
"outputs": [],
"source": [
"import spacy\n",
@@ -119,7 +123,9 @@
{
"cell_type": "code",
"execution_count": 4,
- "metadata": {},
+ "metadata": {
+ "id": "7f841596-f217-46d2-b64e-1952db4de4ce",
+ },
"outputs": [],
"source": [
"# Add text strings.\n",
@@ -132,7 +138,9 @@
{
"cell_type": "code",
"execution_count": 5,
- "metadata": {},
+ "metadata": {
+ "id": "7f841596-f217-46d2-b64e-1952db4de4cf",
+ },
"outputs": [],
"source": [
"# Check which entities spaCy can recognize.\n",
@@ -142,7 +150,9 @@
{
"cell_type": "code",
"execution_count": 6,
- "metadata": {},
+ "metadata": {
+ "id": "7f841596-f217-46d2-b64e-1952db4de4d0",
+ },
"outputs": [
{
"name": "stdout",
@@ -163,7 +173,9 @@
{
"cell_type": "code",
"execution_count": 7,
- "metadata": {},
+ "metadata": {
+ "id": "7f841596-f217-46d2-b64e-1952db4de4d1",
+ },
"outputs": [
{
"data": {
@@ -207,7 +219,9 @@
{
"cell_type": "code",
"execution_count": 8,
- "metadata": {},
+ "metadata": {
+ "id": "7f841596-f217-46d2-b64e-1952db4de4e0",
+ },
"outputs": [
{
"data": {
@@ -254,7 +268,9 @@
},
{
"cell_type": "markdown",
- "metadata": {},
+ "metadata": {
+ "id": "7f841596-f217-46d2-b64e-1952db4de4e1",
+ },
"source": [
"## Create a model handler\n",
"\n",
@@ -264,7 +280,9 @@
{
"cell_type": "code",
"execution_count": 9,
- "metadata": {},
+ "metadata": {
+ "id": "7f841596-f217-46d2-b64e-1952db4de4e2",
+ },
"outputs": [
{
"data": {
@@ -304,7 +322,9 @@
{
"cell_type": "code",
"execution_count": 10,
- "metadata": {},
+ "metadata": {
+ "id": "7f841596-f217-46d2-b64e-1952db4de4e3",
+ },
"outputs": [],
"source": [
"# Define `SpacyModelHandler` to load the model and perform the inference.\n",
@@ -369,7 +389,9 @@
{
"cell_type": "code",
"execution_count": 11,
- "metadata": {},
+ "metadata": {
+ "id": "7f841596-f217-46d2-b64e-1952db4de4e4",
+ },
"outputs": [
{
"name": "stdout",
@@ -394,7 +416,9 @@
},
{
"cell_type": "markdown",
- "metadata": {},
+ "metadata": {
+ "id": "7f841596-f217-46d2-b64e-1952db4de4e5",
+ },
"source": [
"## Use `KeyedModelHandler` to handle keyed data\n",
"\n",
@@ -404,7 +428,9 @@
{
"cell_type": "code",
"execution_count": 12,
- "metadata": {},
+ "metadata": {
+ "id": "7f841596-f217-46d2-b64e-1952db4de4e6",
+ },
"outputs": [],
"source": [
"# You can use these text strings with keys to distinguish examples.\n",
@@ -417,7 +443,9 @@
{
"cell_type": "code",
"execution_count": 13,
- "metadata": {},
+ "metadata": {
+ "id": "7f841596-f217-46d2-b64e-1952db4de4e7",
+ },
"outputs": [],
"source": [
"from apache_beam.runners.interactive.interactive_runner import InteractiveRunner\n",
@@ -441,7 +469,9 @@
{
"cell_type": "code",
"execution_count": 14,
- "metadata": {},
+ "metadata": {
+ "id": "7f841596-f217-46d2-b64e-1952db4de4e8",
+ },
"outputs": [
{
"data": {
@@ -480,7 +510,9 @@
{
"cell_type": "code",
"execution_count": 15,
- "metadata": {},
+ "metadata": {
+ "id": "7f841596-f217-46d2-b64e-1952db4de4e9",
+ },
"outputs": [
{
"data": {
@@ -547,7 +579,9 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "id": "7f841596-f217-46d2-b64e-1952db4de4f0",
+ },
"outputs": [],
"source": []
}