Skip to content

Commit

Permalink
Make the model names unique and fix the tox package deps for tensorfl…
Browse files Browse the repository at this point in the history
…ow tests (#33216)

* make the model names unique

* fixed lint

* pin keras==3.6.0

* pin keras==2.12.0

* pin tf_keras==2.18.0

* pin tensorflow==2.18.0

* use 1 worker for pytest

* Fixed the tensorflow version
  • Loading branch information
liferoad authored Nov 27, 2024
1 parent 159c830 commit 5a6c902
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .github/trigger_files/beam_PostCommit_Python_Dependency.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"comment": "Modify this file in a trivial way to cause this test suite to run",
"modification": 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import shutil
import tempfile
import unittest
import uuid
from typing import Any
from typing import Dict
from typing import Iterable
Expand Down Expand Up @@ -127,7 +128,7 @@ def test_predict_tensor(self):

def test_predict_tensor_with_batch_size(self):
model = _create_mult2_model()
model_path = os.path.join(self.tmpdir, 'mult2.keras')
model_path = os.path.join(self.tmpdir, f'mult2_{uuid.uuid4()}.keras')
tf.keras.models.save_model(model, model_path)
with TestPipeline() as pipeline:

Expand Down Expand Up @@ -173,7 +174,7 @@ def fake_batching_inference_fn(

def test_predict_tensor_with_large_model(self):
model = _create_mult2_model()
model_path = os.path.join(self.tmpdir, 'mult2.keras')
model_path = os.path.join(self.tmpdir, f'mult2_{uuid.uuid4()}.keras')
tf.keras.models.save_model(model, model_path)
with TestPipeline() as pipeline:

Expand Down Expand Up @@ -220,7 +221,7 @@ def fake_batching_inference_fn(

def test_predict_numpy_with_batch_size(self):
model = _create_mult2_model()
model_path = os.path.join(self.tmpdir, 'mult2_numpy.keras')
model_path = os.path.join(self.tmpdir, f'mult2_{uuid.uuid4()}.keras')
tf.keras.models.save_model(model, model_path)
with TestPipeline() as pipeline:

Expand Down Expand Up @@ -263,7 +264,7 @@ def fake_batching_inference_fn(

def test_predict_numpy_with_large_model(self):
model = _create_mult2_model()
model_path = os.path.join(self.tmpdir, 'mult2_numpy.keras')
model_path = os.path.join(self.tmpdir, f'mult2_{uuid.uuid4()}.keras')
tf.keras.models.save_model(model, model_path)
with TestPipeline() as pipeline:

Expand Down
5 changes: 3 additions & 2 deletions sdks/python/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,9 @@ deps =
tensorflow>=2.12rc1,<2.13
# Help pip resolve conflict with typing-extensions for old version of TF https://github.com/apache/beam/issues/30852
pydantic<2.7
protobuf==4.25.5
extras = test,gcp,ml_test
extras = test,gcp
commands_pre =
pip install -U 'protobuf==4.25.5'
commands =
# Log tensorflow version for debugging
/bin/sh -c "pip freeze | grep -E tensorflow"
Expand Down

0 comments on commit 5a6c902

Please sign in to comment.