Skip to content

Commit 11f7568

Browse files
Remove Vertex LLM Inference Integration Test (#36172)
* Move Vertex LLM Inference IT Test to new Endpoint * trigger python postcommit * Remove LLM IT test, add note to example * remove unused var * Remove unused import * Update sdks/python/apache_beam/examples/inference/vertex_ai_llm_text_classification.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * linting * Soften disclaimer language a bit, add call-out to README --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 8fd07a4 commit 11f7568

4 files changed

Lines changed: 17 additions & 18 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"comment": "Modify this file in a trivial way to cause this test suite to run.",
3-
"modification": 29
3+
"modification": 30
44
}
55

sdks/python/apache_beam/examples/inference/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,12 @@ Each line represents a prediction of the flower type along with the confidence i
856856

857857
## Text classifcation with a Vertex AI LLM
858858

859+
**NOTE**
860+
Google has deprecated PaLM LLMs like text-bison and no longer supports querying them on Vertex AI endpoints. Separately, the use of the Vertex AI Predict API is
861+
not supported for Gemini models in favor of use of the google-genai API. As a result, this example no longer works as-written. To perform inference with
862+
Gemini models deployed on Google infrastructure, please see the `GeminiModelHandler` (in `apache_beam.ml.inference.gemini_inference`) and the
863+
[`gemini_text_classification.py` example](./gemini_text_classification.py). For custom LLMs, you may still follow this design pattern.
864+
859865
[`vertex_ai_llm_text_classification.py`](./vertex_ai_llm_text_classification.py) contains an implementation for a RunInference pipeline that performs image classification using a model hosted on Vertex AI (based on https://cloud.google.com/vertex-ai/docs/tutorials/image-recognition-custom).
860866

861867
The pipeline reads image urls, performs basic preprocessing to convert them into a List of floats, passes the masked sentence to the Vertex AI implementation of RunInference, and then writes the predictions to a text file.

sdks/python/apache_beam/examples/inference/vertex_ai_llm_text_classification.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@
2121
model can be generated by fine tuning the text-bison model or another similar
2222
model (see
2323
https://cloud.google.com/vertex-ai/docs/generative-ai/models/tune-models#supervised-fine-tuning)
24+
25+
**NOTE**
26+
Google has deprecated PaLM LLMs and no longer supports querying them on
27+
Vertex AI endpoints. Separately, the use of the Vertex AI Predict API is not
28+
supported for Gemini models in favor of use of the google-genai API. As a
29+
result, this example no longer works as-written. To perform inference with
30+
Gemini models deployed on Google infrastructure, please see the
31+
`GeminiModelHandler` (in `apache_beam.ml.inference.gemini_inference`) and the
32+
`gemini_text_classification.py` example. For custom LLMs, you may still follow
33+
this design pattern.
2434
"""
2535

2636
import argparse

sdks/python/apache_beam/ml/inference/vertex_ai_inference_it_test.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,13 @@
2929
# pylint: disable=ungrouped-imports
3030
try:
3131
from apache_beam.examples.inference import vertex_ai_image_classification
32-
from apache_beam.examples.inference import vertex_ai_llm_text_classification
3332
except ImportError as e:
3433
raise unittest.SkipTest(
3534
"Vertex AI model handler dependencies are not installed")
3635

3736
_INPUT = "gs://apache-beam-ml/testing/inputs/vertex_images/*/*.jpg"
3837
_OUTPUT_DIR = "gs://apache-beam-ml/testing/outputs/vertex_images"
3938
_FLOWER_ENDPOINT_ID = "5384055553544683520"
40-
_LLM_ENDPOINT_ID = "9157860935048626176"
4139
_ENDPOINT_PROJECT = "apache-beam-testing"
4240
_ENDPOINT_REGION = "us-central1"
4341
_ENDPOINT_NETWORK = "projects/844138762903/global/networks/beam-test-vpc"
@@ -65,21 +63,6 @@ def test_vertex_ai_run_flower_image_classification(self):
6563
test_pipeline.get_full_options_as_args(**extra_opts))
6664
self.assertEqual(FileSystems().exists(output_file), True)
6765

68-
@pytest.mark.vertex_ai_postcommit
69-
def test_vertex_ai_run_llm_text_classification(self):
70-
output_file = '/'.join([_OUTPUT_DIR, str(uuid.uuid4()), 'output.txt'])
71-
72-
test_pipeline = TestPipeline(is_integration_test=True)
73-
extra_opts = {
74-
'output': output_file,
75-
'endpoint_id': _LLM_ENDPOINT_ID,
76-
'endpoint_project': _ENDPOINT_PROJECT,
77-
'endpoint_region': _ENDPOINT_REGION
78-
}
79-
vertex_ai_llm_text_classification.run(
80-
test_pipeline.get_full_options_as_args(**extra_opts))
81-
self.assertEqual(FileSystems().exists(output_file), True)
82-
8366

8467
if __name__ == '__main__':
8568
logging.getLogger().setLevel(logging.DEBUG)

0 commit comments

Comments
 (0)