Skip to content

Commit a4dc473

Browse files
committed
Cherrypick #37725
1 parent 762b8e3 commit a4dc473

4 files changed

Lines changed: 35 additions & 27 deletions

File tree

sdks/python/apache_beam/ml/rag/embeddings/vertex_ai_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
"""Tests for apache_beam.ml.rag.embeddings.vertex_ai."""
1818

19+
import pytest
1920
import shutil
2021
import tempfile
2122
import unittest
@@ -52,6 +53,7 @@ def chunk_approximately_equals(expected, actual):
5253
all(isinstance(x, float) for x in actual.embedding.dense_embedding))
5354

5455

56+
@pytest.mark.vertex_ai_postcommit
5557
@unittest.skipIf(
5658
not VERTEX_AI_AVAILABLE, "Vertex AI dependencies not available")
5759
class VertexAITextEmbeddingsTest(unittest.TestCase):

sdks/python/apache_beam/ml/transforms/embeddings/vertex_ai_test.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
import unittest
2121
import uuid
2222

23+
import pytest
24+
2325
import apache_beam as beam
2426
from apache_beam.ml.inference.base import RunInference
2527
from apache_beam.ml.transforms import base
@@ -58,6 +60,7 @@
5860
model_name: str = "text-embedding-005"
5961

6062

63+
@pytest.mark.vertex_ai_postcommit
6164
@unittest.skipIf(
6265
VertexAITextEmbeddings is None, 'Vertex AI Python SDK is not installed.')
6366
class VertexAIEmbeddingsTest(unittest.TestCase):
@@ -261,6 +264,7 @@ def test_mltransform_to_ptransform_with_vertex(self):
261264
ptransform_list[i]._model_handler._underlying.model_name, model_name)
262265

263266

267+
@pytest.mark.vertex_ai_postcommit
264268
@unittest.skipIf(
265269
VertexAIImageEmbeddings is None, 'Vertex AI Python SDK is not installed.')
266270
class VertexAIImageEmbeddingsTest(unittest.TestCase):
@@ -308,6 +312,7 @@ def _make_text_chunk(input: str) -> Chunk:
308312
return Chunk(content=Content(text=input))
309313

310314

315+
@pytest.mark.vertex_ai_postcommit
311316
@unittest.skipIf(
312317
VertexAIMultiModalEmbeddings is None,
313318
'Vertex AI Python SDK is not installed.')

sdks/python/test-suites/tox/py310/build.gradle

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -49,29 +49,9 @@ project.tasks.register("postCommitPyDep") {}
4949
// For versions that we would like to prioritize for testing,
5050
// for example versions released in a timeframe of last 1-2 years.
5151

52-
toxTask "testPy310pyarrow-9", "py310-pyarrow-9", "${posargs}"
53-
test.dependsOn "testPy310pyarrow-9"
54-
postCommitPyDep.dependsOn "testPy310pyarrow-9"
55-
56-
toxTask "testPy310pyarrow-10", "py310-pyarrow-10", "${posargs}"
57-
test.dependsOn "testPy310pyarrow-10"
58-
postCommitPyDep.dependsOn "testPy310pyarrow-10"
59-
60-
toxTask "testPy310pyarrow-11", "py310-pyarrow-11", "${posargs}"
61-
test.dependsOn "testPy310pyarrow-11"
62-
postCommitPyDep.dependsOn "testPy310pyarrow-11"
63-
64-
toxTask "testPy310pyarrow-12", "py310-pyarrow-12", "${posargs}"
65-
test.dependsOn "testPy310pyarrow-12"
66-
postCommitPyDep.dependsOn "testPy310pyarrow-12"
67-
68-
toxTask "testPy310pyarrow-13", "py310-pyarrow-13", "${posargs}"
69-
test.dependsOn "testPy310pyarrow-13"
70-
postCommitPyDep.dependsOn "testPy310pyarrow-13"
71-
72-
toxTask "testPy310pyarrow-14", "py310-pyarrow-14", "${posargs}"
73-
test.dependsOn "testPy310pyarrow-14"
74-
postCommitPyDep.dependsOn "testPy310pyarrow-14"
52+
toxTask "testPy310pyarrow-6", "py310-pyarrow-6", "${posargs}"
53+
test.dependsOn "testPy310pyarrow-6"
54+
postCommitPyDep.dependsOn "testPy310pyarrow-6"
7555

7656
toxTask "testPy310pyarrow-15", "py310-pyarrow-15", "${posargs}"
7757
test.dependsOn "testPy310pyarrow-15"
@@ -89,6 +69,26 @@ toxTask "testPy310pyarrow-18", "py310-pyarrow-18", "${posargs}"
8969
test.dependsOn "testPy310pyarrow-18"
9070
postCommitPyDep.dependsOn "testPy310pyarrow-18"
9171

72+
toxTask "testPy310pyarrow-19", "py310-pyarrow-19", "${posargs}"
73+
test.dependsOn "testPy310pyarrow-19"
74+
postCommitPyDep.dependsOn "testPy310pyarrow-19"
75+
76+
toxTask "testPy310pyarrow-20", "py310-pyarrow-20", "${posargs}"
77+
test.dependsOn "testPy310pyarrow-20"
78+
postCommitPyDep.dependsOn "testPy310pyarrow-20"
79+
80+
toxTask "testPy310pyarrow-21", "py310-pyarrow-21", "${posargs}"
81+
test.dependsOn "testPy310pyarrow-21"
82+
postCommitPyDep.dependsOn "testPy310pyarrow-21"
83+
84+
toxTask "testPy310pyarrow-22", "py310-pyarrow-22", "${posargs}"
85+
test.dependsOn "testPy310pyarrow-22"
86+
postCommitPyDep.dependsOn "testPy310pyarrow-22"
87+
88+
toxTask "testPy310pyarrow-23", "py310-pyarrow-23", "${posargs}"
89+
test.dependsOn "testPy310pyarrow-23"
90+
postCommitPyDep.dependsOn "testPy310pyarrow-23"
91+
9292
// Create a test task for each supported minor version of pandas
9393
toxTask "testPy310pandas-14", "py310-pandas-14", "${posargs}"
9494
test.dependsOn "testPy310pandas-14"

sdks/python/tox.ini

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -515,13 +515,14 @@ commands =
515515
[testenv:py{310,311}-transformers-{428,447,448,latest}]
516516
deps =
517517
# Environment dependencies are defined in the `setenv` section and installed in the `commands` section.
518-
extras = test,gcp,ml_test
518+
pip_pre = False
519+
extras = test
519520
setenv =
520521
COMMON_DEPS = tensorflow==2.12.0 protobuf==4.25.5 pip==25.0.1
521522
# sentence-transformers 2.2.2 is the latest version that supports transformers 4.28.x
522523
428: DEPS = sentence-transformers==2.2.2 'transformers>=4.28.0,<4.29.0' 'torch>=1.9.0,<1.14.0'
523524
447: DEPS = 'transformers>=4.47.0,<4.48.0' 'torch>=1.9.0,<1.14.0'
524-
455: DEPS = 'transformers>=4.55.0,<4.56.0' 'torch>=2.0.0,<2.1.0'
525+
448: DEPS = 'transformers>=4.48.0,<4.49.0' 'torch>=1.9.0,<1.14.0'
525526
latest: DEPS = 'transformers>=4.55.0' 'torch>=2.0.0' 'accelerate>=1.6.0'
526527
commands =
527528
/bin/sh -c "pip install .[{extras}] {env:DEPS} {env:COMMON_DEPS}"
@@ -561,7 +562,7 @@ commands =
561562
/bin/sh -c "pip freeze | grep -E google-cloud-aiplatform"
562563
/bin/sh -c "pip freeze | grep -E transformers"
563564
# Allow exit code 5 (no tests run) so that we can run this command safely on arbitrary subdirectories.
564-
/bin/sh -c 'pytest apache_beam/ml/transforms/embeddings -o junit_suite_name={envname} --junitxml=pytest_{envname}.xml -n 6 {posargs}; ret=$?; [ $ret = 5 ] && exit 0 || exit $ret'
565+
/bin/sh -c 'pytest apache_beam/ml/transforms/embeddings -o junit_suite_name={envname} --junitxml=pytest_{envname}.xml -n 6 -m "not vertex_ai_postcommit" {posargs}; ret=$?; [ $ret = 5 ] && exit 0 || exit $ret'
565566

566567

567568
[testenv:py{310,311}-TFHubEmbeddings-{014,015}]
@@ -579,7 +580,7 @@ commands =
579580
# Log aiplatform and its dependencies version for debugging
580581
/bin/sh -c "pip freeze | grep -E tensorflow"
581582
# Allow exit code 5 (no tests run) so that we can run this command safely on arbitrary subdirectories.
582-
bash {toxinidir}/scripts/run_pytest.sh {envname} 'apache_beam/ml/transforms/embeddings'
583+
bash {toxinidir}/scripts/run_pytest.sh {envname} 'apache_beam/ml/transforms/embeddings' "-m not(vertex_ai_postcommit)"
583584

584585
[testenv:py{310,312}-dill]
585586
extras = test,dill

0 commit comments

Comments
 (0)