Skip to content

Commit 7202173

Browse files
committed
Mark phi3 real multi-device tests with @pytest.mark.multi_device
test_distribution and test_layout_map_mesh_shapes both construct a real DeviceMesh/ModelParallel and need multiple simulated devices to mean anything, but neither carried the multi_device marker that PR keras-team#2809's dedicated CI job filters on. Without it, that job silently collects zero tests from this model. test_layout_map_live_presets already had the marker and stays excluded by design (kaggle_key_required + extra_large). For test_layout_map_mesh_shapes, the marker must go directly on the function, below @parameterized.named_parameters (not above it) -- absl.testing.parameterized's generated per-case methods only pick up pytestmark via functools.wraps when the mark decorates the original function itself; decorating the _ParameterizedTestIter object produced by named_parameters(...) does not propagate pytestmark to the expanded test cases. Verified empirically: outermost placement collected 0 of 12 parameterized cases under the marker filter, innermost placement collected all 12.
1 parent 356e1d4 commit 7202173

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

keras_hub/src/models/phi3/phi3_backbone_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ def test_saved_model(self):
147147
input_data=self.input_data,
148148
)
149149

150+
@pytest.mark.multi_device
150151
def test_distribution(self):
151152
# Note (preserved from the pre-refactor manual test): the default
152153
# test config's num_key_value_heads=2 divides the pinned 2-device
@@ -230,6 +231,7 @@ def test_all_presets(self):
230231
for dims in (PHI3_MINI_DIMS, PHI3_SMALL_GQA_DIMS)
231232
for shape in CAPPED_MESH_SHAPES
232233
)
234+
@pytest.mark.multi_device
233235
def test_layout_map_mesh_shapes(self, dims, mesh_shape):
234236
if keras.backend.backend() != "jax":
235237
self.skipTest("`ModelParallel` testing requires the Jax backend.")

0 commit comments

Comments
 (0)