spyx.experimental.litert: TFLite/LiteRT export of spiking step functions#46
Closed
kmheckel wants to merge 1 commit into
Closed
spyx.experimental.litert: TFLite/LiteRT export of spiking step functions#46kmheckel wants to merge 1 commit into
kmheckel wants to merge 1 commit into
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…nctions Export a spiking model's single-timestep (x, state) -> (out, new_state) forward to a TFLite flatbuffer via jax2tf -> tf.lite.TFLiteConverter, so a phone runs the temporal loop on-device (the recurrence stays in app code; the model is a small feed-forward step). tensorflow/jax2tf imported lazily — importing the module needs no TF; conversion needs 'pip install tensorflow', phone inference only tflite-runtime. - to_litert(model, input_shape, *, batch, dtype) -> bytes + a LiteRTStepSignature describing the flattened state I/O for on-device threading. - Verified: the TFLite interpreter output matches the JAX single step (zero AND nonzero state, atol 1e-4). - TensorFlow is NOT declared as a spyx extra on purpose: it's a heavyweight conversion-only tool, and pinning it drags the universal lock (e.g. h5py) to tf-compatible versions that break newer Python. Users install it themselves. Experimental / unstable API. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
3f1e19e to
241757a
Compare
Owner
Author
|
Shelving for now — ONNX (#48) covers the universal deployment story (phones via ONNX Runtime Mobile + servers + edge, plus the native-Loop full-temporal export). LiteRT remains valuable specifically for best-in-class Android NPU performance (Google's forward path vs ONNX's deprecated-NNAPI route), so keeping the branch |
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.
Adds a LiteRT export leg (the commodity-phone counterpart to
spyx.nir's neuromorphic leg).to_litert(model, input_shape, ...)exports a spiking model's single-timestep(x, state) -> (out, new_state)forward to a TFLite flatbuffer viajax2tf→tf.lite.TFLiteConverter. The recurrence stays in on-device app code (the phone runs the loop, threading state) — the exported model is a small feed-forward step, which is exactly what runs cheaply on phone CPU/DSP/NPU for always-on sensing.tf.lite.Interpreteroutput numerically matches the JAX single step for zero and nonzero state (atol 1e-4).import spyx.experimental.litertneeds no TF; conversion needsspyx[litert], phone inference onlytflite-runtime/ai-edge-litert.[litert]optional extra added; the CItyjob syncs explicit extras (quant+loaders) rather than--all-extrasso it doesn't pull tensorflow.Experimental / unstable API. Pairs with the ternary-LLM QAT PR as the two edge-efficiency LOEs.
🤖 Generated with Claude Code