Commit 8f09b27
authored
Auto-enable tf2onnx large_model for models >1.5GB (keras-team#22825)
* Fix TPU test workflow job name rendering raw template expression
The job name used `format()` with a boolean expression inside, which
caused GitHub Actions to render the raw template in the checks UI.
Replace the dynamic expression with fully static `matrix.include` names
so the job name evaluates reliably to:
- 'Run tests on TPU' for single-device
- 'Run tests on multi-TPU' for multi-device
Fixes keras-team#22776
* Auto-enable tf2onnx large_model for models >1.5GB
TensorFlow GraphDef has a 2GB protobuf limit. When exporting large
models (e.g. Llama 1B, Gemma3 1B) to ONNX via tf2onnx, freezing all
variables into the graph causes import_graph_def to fail with:
RuntimeError: size too big: ... string length exceeds max size
This change estimates total weight size and passes large_model=True
to tf2onnx when the model exceeds 1.5GB, triggering external weight
storage and avoiding the protobuf limit.
Weight size is computed from model.weights metadata (shape + dtype)
without materializing tensor values, so load_weights=False is safe.
Fixes keras-team/keras-hub#23401 parent 766c0ee commit 8f09b27
1 file changed
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
| 4 | + | |
| 5 | + | |
3 | 6 | | |
4 | 7 | | |
5 | 8 | | |
| |||
99 | 102 | | |
100 | 103 | | |
101 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
102 | 129 | | |
103 | 130 | | |
104 | 131 | | |
105 | 132 | | |
106 | 133 | | |
107 | 134 | | |
108 | 135 | | |
| 136 | + | |
109 | 137 | | |
110 | 138 | | |
111 | 139 | | |
| |||
0 commit comments