-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Update Patents Understanding Notebook to use Batch Prediction #1609
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @holtskinner and reviewers,
I'm currently reviewing this pull request and will post my feedback in a few minutes. In the meantime, I'm providing this summary of the pull request's content to help you and other reviewers quickly understand the changes and intent.
This pull request, titled "fix: Update Patents Understanding Notebook to use Batch Prediction", aims to improve the efficiency and cost-effectiveness of the patents understanding notebook by switching from individual predictions to batch prediction using Vertex AI. The description mentions that publishing should wait until Gemini 2.0 fully supports batch prediction for optimal object detection.
Here's a summary of the changes:
gemini/use-cases/document-processing/patents_understanding.ipynb
: This Jupyter Notebook has undergone several modifications:- Lines 103-106: Added hyperlinks to Michael Munn's and Michael Sherman's GitHub profiles in the overview section.
- Lines 114-117: Updated the description to explicitly mention using "Batch Prediction for Gemini 2.0 Flash in Vertex AI" and provided a link to the relevant documentation.
- Lines 142, 202: Execution counts were updated (1 -> null, null -> 3).
- Lines 227-243: Removed unnecessary imports (
import json
,from google.genai.types import GenerateContentConfig, Part
,import pandas as pd
). - Line 288: Changed the model ID from
gemini-2.0-flash-exp
togemini-1.5-flash-002
. - Lines 317-323: Added a note indicating that the BigQuery query is limited to 5 documents for tutorial purposes.
- Lines 342-347: Added
LIMIT 5
to the BigQuery query to reduce processing time. - Line 363: Execution count updated (102 -> 43).
- Lines 478-827: The notebook was significantly restructured to incorporate batch prediction. This involved creating a BigQuery dataset and table for batch prediction requests, creating JSON requests for batch processing, submitting the batch job to Vertex AI, polling for job completion, and loading and processing the results. The original individual prediction processing was removed.
I hope this helps!
Here's a little haiku to brighten your day:
Batch jobs hum along,
Data flows, a silent stream,
Efficiency reigns.
Gemini encountered an error creating the review. You can try again by commenting |
Description
Use Batch Prediction to save on latency/processing costs and load data directly to/from BigQuery.
NOTE: Will change to Gemini 2.0 once it supports Batch Prediction to use higher quality Object Detection capabilities.