Closed CadillacBurgess1 closed 1 month ago
Here is the summary of changes.
This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run
label or use the checkbox below:
The issue was importing the preview resource. When I first created this sample it was working using the preview namespace (which as fine when I first started working on this sample), but the samples and testing in the batch predict folder uses the aiplatform namespace. Both aiplatform and vertexai.preview have a BatchPredictionJob class and they work a little different. I updated my sample to use the BatchPredictionJob class in the aiplatform namespace.
The issue was importing the preview resource. When I first created this sample it was working using the preview namespace (which as fine when I first started working on this sample), but the samples and testing in the batch predict folder uses the aiplatform namespace. Both aiplatform and vertexai.preview have a BatchPredictionJob class and they work a little different. I updated my sample to use the BatchPredictionJob class in the aiplatform namespace.
I think this sample should be using the vertexai.preview
BatchPredictionJob
class as it is intended for use with Gemini. (Different than other batch prediction samples for non-Gemini models)
I'll defer to the Vertex AI SDK product team @Ark-kun (or other)
This notebook from @gericdong also uses the vertexai.preview
space
https://github.com/GoogleCloudPlatform/generative-ai/pull/1138/files
Looks like you're getting an error in the tests:
ValueError: Please either specify output_uri_prefix or set staging_bucket in vertexai.init().
Errors for Py 3.11
File "/workspace/generative_ai/.nox/py-3-11/lib/python3.11/site-packages/vertexai/batch_prediction/_batch_prediction.py", line 180, in submit
if output_uri_prefix.startswith("gs://"):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/typing.py", line 1294, in __getattr__
return getattr(self.__origin__, attr)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/typing.py", line 453, in __getattr__
raise AttributeError(item)
AttributeError: startswith
Errors for Py 3.8
File "/workspace/generative_ai/batch_predict/batch_gemini_predict.py", line 51, in batch_gemini_prediction
batch_prediction_job = BatchPredictionJob.submit(
File "/workspace/generative_ai/.nox/py-3-8/lib/python3.8/site-packages/vertexai/batch_prediction/_batch_prediction.py", line 180, in submit
if output_uri_prefix.startswith("gs://"):
File "/usr/local/lib/python3.8/typing.py", line 759, in __getattr__
return getattr(self.__origin__, attr)
AttributeError: '_SpecialForm' object has no attribute 'startswith'
Checking on the samples.
closing and opening new PR due to noise
Description
Fixes #
Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.
Checklist
nox -s py-3.9
(see Test Environment Setup)nox -s lint
(see Test Environment Setup)