Repository navigation
Add LiteRT-LM snippets for the litert-lm skill - #1340
Open
john-rocky wants to merge 4 commits into
Open
john-rocky wants to merge 4 commits into
john-rocky wants to merge 4 commits into
Conversation
Two regions hold the code of Step 5 and Step 6 of the litert-lm skill, unchanged from the skill's SKILL.md in android/skills at commit 7f7b2173, apart from the imports. Another region holds a small function that returns the absolute path of model.litertlm in the app's filesDir, where the skill's Step 3 puts the file with adb. A fourth region holds a small function that builds a ConversationConfig with Step 5's system instruction and the SamplerConfig values from the text after Step 5's block.
|
Here is the summary of changes. You are about to add 4 region tags.
This comment is generated by snippet-bot.
|
This branch has not been deployed
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 Kotlin snippets for the litert-lm skill to the
aimodule.Two regions hold code from the skill unchanged, with the imports of that code at the top of
LiteRtLmSkillSnippets.kt:android_litert_lm_skill_viewmodel: Step 5's block.android_litert_lm_skill_screen: Step 6's block.Two regions hold small functions for what the skill describes in its text:
android_litert_lm_skill_model_path: returns the absolute path ofmodel.litertlmin the app'sfilesDir, where the skill's Step 3 puts the file withadb.android_litert_lm_skill_sampler: builds aConversationConfigwith Step 5's system instruction and theSamplerConfigfrom the text after Step 5's block.As suggested in the review of #1186, the imports and the dependency lines this PR adds have no region tags. Step 1's Gradle and manifest blocks stay in the skill.
This PR adds
com.google.ai.edge.litertlm:litertlm-android0.20.0 togradle/libs.versions.tomlandai/build.gradle.kts. My other pull request, #1336, adds its LiteRT dependency lines at the same places in both files. A plain merge of the two branches conflicts in both files. Whichever of the two merges first, I'll update the other one.Testing
ChatViewModelTestis the litert-lm skill's device test in google-ai-edge/litert-samples. I ported its 20 tests onto theChatViewModelinLiteRtLmSkillSnippets.kt. I added two tests, one for each small function. On a Pixel 8a, all 22 passed with the CPU backend and again with the GPU backend, usingQwen3-0.6B.litertlmfrom litert-community/Qwen3-0.6B. The test code is not part of this pull request../gradlew :ai:assembleDebugalso succeeds on a local merge of this PR and #1336's head commit bcf4a06, with both sets of dependency lines kept.