Add scripts for remote_inference#4
Open
jortiz16 wants to merge 2 commits into
Open
Conversation
chtyim
reviewed
Apr 2, 2024
| There are two scripts based whether the input data is in an object table or a native BigQuery table. | ||
|
|
||
| ## Object table script | ||
| The object table script creates a target table to store successful annotations. To do this, it calls the inference in a loop. In the first iteration, a small LIMIT is set on the inference call to quickly create a table with the desired schema. The number of rows to process for each inference call can be modified through the batch_size parameter. |
There was a problem hiding this comment.
It's not just for annotations, but for the result of the ML operation.
There was a problem hiding this comment.
nit: Use "`" to quote the batch_size to make it clear it's a code parameter.
| This script applies to the following models: | ||
| - ML.ANNOTATE_IMAGE | ||
| - ML.PROCESS_DOCUMENT | ||
| - ML.TRANSCRIBE |
There was a problem hiding this comment.
Also for the ML.GENERATE_TEXT with the vision model.
| ml_query | ||
| DEFAULT | ||
| FORMAT( | ||
| "SELECT %s, text AS content FROM `%s`", ARRAY_TO_STRING(key_columns, ','), source_table); |
There was a problem hiding this comment.
For the default, probably simpler to just have it as:
DECLARE ml_query DEFAULT "SELECT *, /* ML operation dependent field */ FROM `" || source_table || "`";
chtyim
approved these changes
Apr 2, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The README.md includes instructions to run the scripts. There are four scripts in total. Two are for object tables and the other two are for structured tables.