Add optimized/tflite: portable CPU (LiteRT / TFLite) release#61
Merged
Conversation
Mirrors optimized/mlx and optimized/tensorRT — a LiteRT/TFLite CPU release of the SA3 pipeline. Auto-downloads the fp32 .tflite models from HuggingFace (stabilityai/stable-audio-3-optimized/tflite/*) via scripts/weights.py, exactly like the MLX release. CLI (scripts/sa3_tflite.py) matches the sa3_mlx / sa3_trt flag names and modes: text-to-audio, audio-to-audio (--init-audio), inpainting (--inpaint-range), and CFG (--cfg + --negative-prompt + --apg), plus --threads. - Baked-I/O variable-length graphs (conditioner + patch/unpatch in-graph). The DiT is variable-batch, so CFG runs cond+uncond as one batch=2 invoke by default (--cfg-batched; ~7-29% faster on Apple-Silicon AMX) or sequential batch=1 (--no-cfg-batched, like TensorRT); bit-identical either way. - Monotonic-rebuild pingpong schedule (matches the MLX/TRT audio-to-audio fix). - SentencePiece tokenizer bundled (models/tokenizer.model, 4 MB) since the .tflite T5Gemma is encoder-only. - SAME-L chunked decode (chunk=64, overlap=8); SAME-S decodes whole. install.sh / bootstrap.sh / the ./sa3 wrapper mirror the MLX release.
e0d4614 to
06e6418
Compare
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.
Portable CPU (LiteRT / TFLite) release of the SA3 pipeline, parallel to
optimized/mlxandoptimized/tensorRT. Runs anywhereai_edge_litertruns (macOS / Linux, x86 / ARM, via the XNNPACK delegate).What's here
scripts/sa3_tflite.py— CLI matching thesa3_mlx/sa3_trtflag names and modes: text-to-audio, audio-to-audio (--init-audio), inpainting (--inpaint-range), CFG (--cfg+--negative-prompt+--apg), plus--threadsand--cfg-batched.scripts/weights.py— lazy HuggingFace auto-download (sameensure_local+ symlink-from-cache pattern as MLX), pulling the fp32.tflitemodels fromstabilityai/stable-audio-3-optimized/tflite/*.models/defs/tflite_pipeline.py— tokenizer + T5Gemma wrapper + pingpong sampler.models/tokenizer.model— bundled SentencePiece (4 MB); the.tfliteT5Gemma is encoder-only, so the tokenizer ships in-repo (cf. the TensorRT release bundlingtokenizer.json).install.sh/bootstrap.sh/sa3wrapper /install.py— mirror the MLX release (uv-based; portable, no Apple-Silicon gate).Notes
--cfg-batched; ~7-29% faster on Apple-Silicon AMX) or sequential batch=1 (--no-cfg-batched, like TensorRT) — bit-identical.sa3-a2a-monotonic-schedule).All fp32 except T5Gemma (fp16). Models are already live on HF. Tested end-to-end (HF download to 20 s generation, healthy audio; audio-to-audio verified).