Add PEFT audio LoRA sidecar converter#2384
Open
psymon-ai wants to merge 1 commit into
Open
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
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.
Summary
Adds a deterministic PEFT Audio LoRA -> LiteRT-LM LoRA sidecar converter.
This is intended as a small first step toward a public Gemma audio LoRA
deployment path. It does not claim end-to-end Gemma Audio LoRA support yet; it
only adds the sidecar compiler and validation gates needed by a future
LoRA-ready audio graph/runtime path.
What changed
audio_lora_converter.pyto compile PEFT safetensors adapters into theLiteRT-LM LoRA sidecar TFLite format.
audio_lora_converter_cli.pyas a Bazel CLI entry point.audio_towerPEFT keys to LiteRT-LM audio LoRAtensor names, for example:
alpha / rankinto eachlora_Btensor because the currentsidecar format stores rank metadata but not a separate alpha value.
unmatched unless callers intentionally filter to audio tensors with
--peft_key_regex.@flatbuffers//:runtime_pytarget and includes a small schema-specificTFLite reader/writer for the fields it needs.
runtime/util/lora_utilso audio LoRA input names are recognized bythe existing LoRA-name utility.
LoraDatatest that reads a sidecar generated by this converter.Tests
bazel test --nocache_test_results \ //python/litert_lm_builder:audio_lora_converter_test \ //runtime/util:lora_util_test \ //runtime/util:lora_data_testAll three tests pass locally.
I also checked that the Bazel CLI entry point imports cleanly without any
manual import fallback:
Verification
Local verification environment:
Observed Bazel result:
I also validated the converter against a real Gemma audio PEFT adapter and a
LoRA-ready audio graph:
The generated sidecar matched the existing reference warm sidecar byte-for-byte.
Out of scope
The converter expects a target audio encoder graph that already exposes
LiteRT-LM audio LoRA input names. Runtime binding and LoRA-ready Gemma audio
graph export should be handled in follow-up PRs.