You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by jr...@apache.org on 2024/08/15 13:42:41 UTC
(beam) branch master updated: copy editing the Gemma notebook (#32188)
This is an automated email from the ASF dual-hosted git repository.
jrmccluskey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new 8171e8c29a0 copy editing the Gemma notebook (#32188)
8171e8c29a0 is described below
commit 8171e8c29a0c13e7ada3b184689ba82ea0042b19
Author: Rebecca Szper <98...@users.noreply.github.com>
AuthorDate: Thu Aug 15 06:42:34 2024 -0700
copy editing the Gemma notebook (#32188)
---
.../beam-ml/gemma_2_sentiment_and_summarization.ipynb | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/examples/notebooks/beam-ml/gemma_2_sentiment_and_summarization.ipynb b/examples/notebooks/beam-ml/gemma_2_sentiment_and_summarization.ipynb
index b45d9d7aea9..61bba5f10cc 100644
--- a/examples/notebooks/beam-ml/gemma_2_sentiment_and_summarization.ipynb
+++ b/examples/notebooks/beam-ml/gemma_2_sentiment_and_summarization.ipynb
@@ -123,11 +123,11 @@
"1. Read the review data from Pub/Sub, the event messaging source. This data contains the chat ID and the chat history as a JSON payload. This payload is processed in the pipeline.\n",
"1. Pass the text from the messages to Gemma with a prompt.\n",
"1. The pipeline requests that the model complete the following two tasks:\n",
- " * Attach a sentiment score to the message, by using one of the following three values: `1` for a positive chat, `0` for a neutral chat, and `-1` for a negative chat.\n",
- " * Provide a one-sentence summary of the chat.\n",
+ " * Attach a sentiment score to the message, by using one of the following three values: `1` for a positive chat, `0` for a neutral chat, and `-1` for a negative chat.\n",
+ " * Provide a one-sentence summary of the chat.\n",
"1. The pipeline branches, depending on the sentiment score:\n",
- " * If the score is `1` or `0`, the chat and its summarization are sent to a data analytics system for storage and future analysis.\n",
- " * If the score is `-1`, the Gemma model drafts a response. This response and the chat information are sent to an event messaging system that connects the pipeline and other applications. This step allows a person to review the content of the response. "
+ " * If the score is `1` or `0`, the chat and its summarization are sent to a data analytics system for storage and future analysis.\n",
+ " * If the score is `-1`, the Gemma model drafts a response. This response and the chat information are sent to an event messaging system that connects the pipeline and other applications. This step allows a person to review the content of the response. "
]
},
{
@@ -342,7 +342,7 @@
"id": "0gicDesYWdbu"
},
"source": [
- "Set pipeline options and provide the input Pub/Sub topic. The options that are commented out enable running the pipeline on Google Cloud Dataflow."
+ "Set pipeline options and provide the input Pub/Sub topic. The options that are commented out enable running the pipeline on Dataflow."
]
},
{
@@ -377,7 +377,7 @@
"id": "g8sWSMRmW-Ab"
},
"source": [
- "Define a custom model handler that will load the Gemma model and handle inference calls."
+ "Define a custom model handler that loads the Gemma model and handles inference calls."
]
},
{
@@ -453,7 +453,7 @@
"id": "cSbAFPXmXPMc"
},
"source": [
- "We definte a prompt template to format a given input as well as instruct the model on the task being asked of it. This block also has an example input to the model."
+ "Define a prompt template. The template formats inputs and instructs the model on the task. This block also contains an example input to the model."
]
},
{
@@ -493,7 +493,7 @@
"id": "8UFfKvSeYn0b"
},
"source": [
- "Define pre and post-processing functions. `CreatePrompt` creates a key-value pair of the chat ID and the formatted prompt. `extract_model_reply` parses the response, extracting the JSON string we requested from the model; however, the LLM is not *guaranteed* to return a JSON-formatted object, so we also reaise an exception if the reply is malformed. This helper is then used in the `SentimentAnalysis` `DoFn` to split out the sentiment score as well as the summary of the text. The [...]
+ "Define pre- and post-processing functions. The `CreatePrompt` class creates a key-value pair that contains the chat ID and the formatted prompt. The `extract_model_reply` function parses the response, extracting the JSON string requested from the model. The LLM is not guaranteed to return a JSON-formatted object. If the reply is malformed, the code produces an exception. This helper is used in the `SentimentAnalysis` class `DoFn` to split out the sentiment score and the summary [...]
]
},
{
@@ -559,7 +559,7 @@
"id": "Yj9aQ0q8YLOn"
},
"source": [
- "Finally, execute the pipeline using the code below. To use the example chat input created earlier instead of a custom Pub/Sub source, use `chats = p | beam.Create([chat])` instead of the Pub/Sub read."
+ "To run the pipeline, use the following code. To use the example chat input created previously, instead of a custom Pub/Sub source, use `chats = p | beam.Create([chat])` instead of the Pub/Sub read."
]
},
{