[gemma3] Add text-only runner for gemma-3-1B-it model #16885
+281
−53
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
This PR adds support for running the Gemma-3-1B-IT text-only model on ExecuTorch with CPU backend. The new
gemma3_text_runnerprovides a lightweight alternative to the existing multimodalgemma3_e2e_runner, without requiring image processing dependencies.Dependencies
The optimum-executorch PR modifies
utils.pyto include the<end_of_turn>token (ID 106) inget_eos_idsfor Gemma models. Without this change, the text runner will not stop generation at<end_of_turn>and will continue untilmax_new_tokensis reached.Changes
New Files
examples/models/gemma3/text_runner.cpp- Text-only inference runner with:<start_of_turn>user\n...<end_of_turn>\n<start_of_turn>model\n)Modified Files
examples/models/gemma3/CMakeLists.txt- Addedgemma3_text_runnerexecutable targetexamples/models/gemma3/CMakePresets.json- Addedgemma3-text-cpubuild and workflow presetsMakefile- Addedgemma3-text-cputargetexamples/models/gemma3/README.md- Comprehensive documentation for both modelsTest Plan
Result