Skip to content

Commit aba093d

Browse files
authored
Fix PostCommit Python Dependency and PreCommit Python ML tests (#34559)
1 parent b366f80 commit aba093d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

sdks/python/apache_beam/ml/rag/chunking/langchain_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def test_huggingface_tokenizer_splitter(self):
167167
def check_token_lengths(chunks):
168168
for chunk in chunks:
169169
# Verify each chunk's token length is within limits
170-
num_tokens = len(tokenizer.encode(chunk.content.text))
170+
num_tokens = len(tokenizer.tokenize(chunk.content.text))
171171
if not num_tokens <= 10:
172172
raise BeamAssertException(
173173
f"Chunk has {num_tokens} tokens, expected <= 10")

sdks/python/tox.ini

+6
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ commands =
105105

106106
[testenv:py{39,310,311}-ml]
107107
# Don't set TMPDIR to avoid "AF_UNIX path too long" errors in certain tests.
108+
deps =
109+
accelerate>=1.6.0
108110
setenv =
109111
extras = test,gcp,dataframe,ml_test
110112
commands =
@@ -115,6 +117,8 @@ commands =
115117
[testenv:py312-ml]
116118
# many packages do not support py3.12
117119
# Don't set TMPDIR to avoid "AF_UNIX path too long" errors in certain tests.
120+
deps =
121+
accelerate>=1.6.0
118122
setenv =
119123
extras = test,gcp,dataframe,p312_ml_test
120124
commands =
@@ -466,6 +470,7 @@ deps =
466470
448: torch>=2.0.0,<2.1.0
467471
latest: transformers>=4.48.0
468472
latest: torch>=2.0.0
473+
latest: accelerate>=1.6.0
469474
tensorflow==2.12.0
470475
protobuf==4.25.5
471476
extras = test,gcp,ml_test
@@ -494,6 +499,7 @@ commands =
494499
[testenv:py{39,310}-embeddings]
495500
deps =
496501
sentence-transformers==3.3.1
502+
accelerate>=1.6.0
497503
passenv = HF_INFERENCE_TOKEN
498504
extras = test,gcp
499505
commands =

0 commit comments

Comments
 (0)