Commit 876717e
committed
Add shared ModelParallel distribution-test helper; refactor Gemma onto it
Adds TestCase.run_distribution_test, a shared helper used by every
model's test_distribution: sharding-spec + full-weight-coverage
assertions, a real forward/backward/optimizer step (not just build()),
and a numerical-parity + short-training-convergence check against an
undistributed twin model.
Adds a CI-safe mesh-shape sweep (test_layout_map_mesh_shapes) across
representative 2D/3D device-mesh shapes sized to mirror real
accelerator-pod topologies, using frozen realistic dimensions with a
memory-conscious scale (full production-scale dims are exercised by
the separate live-preset sweep, gated behind a per-width-class memory
estimate so it never attempts an unsafe local build).
Adds a manual live-preset sweep (test_layout_map_live_presets) that
fetches every real preset's config from the registry and validates
sharding across the same mesh-shape matrix.
conftest.py now exposes 8 virtual CPU devices to JAX so distribution
tests run instead of silently skipping on a single-device host, and
registers the multi_device pytest marker.
Gemma's existing test_distribution and test_distribution_with_lora
are refactored onto the new helper; Gemma's layout map itself is
unchanged (already correct).1 parent 8375767 commit 876717e
4 files changed
Lines changed: 679 additions & 53 deletions
File tree
- keras_hub/src
- models/gemma
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
5 | 9 | | |
6 | 10 | | |
7 | 11 | | |
| |||
95 | 99 | | |
96 | 100 | | |
97 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
98 | 106 | | |
99 | 107 | | |
100 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
299 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
300 | 306 | | |
301 | 307 | | |
302 | 308 | | |
303 | 309 | | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
304 | 315 | | |
305 | 316 | | |
306 | 317 | | |
| |||
0 commit comments