Phase 6: CoreML + TFLite export, GH Release publishing, CBRFC archive#12
Merged
Conversation
The training pipeline produced a Keras .h5 that the mobile app had no durable way to consume: the GH Actions artifact had a 7-day retention and no CoreML/TFLite conversion existed in this repo. Add an export_mobile module that converts the .h5 to .mlpackage (CoreML for iOS) and .tflite (Android) with sha256 + schema manifest, and have ml_training.yml publish a tagged GitHub Release per successful train so the mobile app has a stable fetch URL. TFLite has three conversion tiers (strict builtins -> Flex delegate -> rebuild without mask_zero) to handle the dual Embedding(mask_zero=True) + LSTM-with-initial_state graph; the winning tier is recorded in manifest.json so consumers know whether they need the select-tf-ops AAR. Also finish the CBRFC historical baseline by hitting the NWS NWPS forecast archive (api.water.noaa.gov) with a reference_time, replacing the empty stub used for any anchor < today. The LID map is externalized to a JSON file so wiring a new gauge is data, not code. docs/INFERENCE.md is the contract: input tensor shapes, scaler inversion, output decoding, Flex delegate note. Mobile devs should not need to read train.py to ship. https://claude.ai/code/session_01XfhRQmztLSqmz6qeLSi9kw
Comment on lines
+21
to
+37
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r openFlowML/requirements.txt | ||
| pip install pytest | ||
|
|
||
| - name: Run mobile export parity tests | ||
| run: python -m pytest -v tests/test_export_parity.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The training pipeline produced a Keras .h5 that the mobile app had no
durable way to consume: the GH Actions artifact had a 7-day retention and
no CoreML/TFLite conversion existed in this repo. Add an export_mobile
module that converts the .h5 to .mlpackage (CoreML for iOS) and .tflite
(Android) with sha256 + schema manifest, and have ml_training.yml publish
a tagged GitHub Release per successful train so the mobile app has a
stable fetch URL.
TFLite has three conversion tiers (strict builtins -> Flex delegate ->
rebuild without mask_zero) to handle the dual Embedding(mask_zero=True)
manifest.json so consumers know whether they need the select-tf-ops AAR.
Also finish the CBRFC historical baseline by hitting the NWS NWPS forecast
archive (api.water.noaa.gov) with a reference_time, replacing the empty
stub used for any anchor < today. The LID map is externalized to a JSON
file so wiring a new gauge is data, not code.
docs/INFERENCE.md is the contract: input tensor shapes, scaler inversion,
output decoding, Flex delegate note. Mobile devs should not need to read
train.py to ship.
https://claude.ai/code/session_01XfhRQmztLSqmz6qeLSi9kw