Instructions to use litert-community/Gemma3-1B-IT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT-LM
How to use litert-community/Gemma3-1B-IT with LiteRT-LM:
# LiteRT-LM runs on various platforms (Android, iOS, Windows, Linux, macOS, IoT, Web/WASM) # and supports many APIs (C++, Python, Kotlin, Swift, JavaScript, Flutter). # For platform-specific integration guides, please refer to the official developer website: # https://ai.google.dev/edge/litert-lm # To try LiteRT-LM, the easiest way is to use our CLI tool. # 1. Install the LiteRT-LM CLI tool: pip install litert-lm # 2. Download and run this model locally: # See: https://ai.google.dev/edge/litert-lm/cli litert-lm run \ --from-huggingface-repo=litert-community/Gemma3-1B-IT \ model.litertlm \ --prompt="Write me a poem"
- Notebooks
- Google Colab
- Kaggle
Error on Android Device
I am using the code from the following article:
https://medium.com/@kennethan/building-an-on-device-gemma-3-chat-app-with-flutter-baaa53de69e3
I have got the following error while running it on Android. I am using the mediapipe_core and mediapipe_genai packages on Flutter:
E/flutter ( 3568): Invalid argument(s): Couldn't resolve native function 'LlmInferenceEngine_CreateSession' in 'package:mediapipe_genai/src/io/third_party/mediapipe/generated/mediapipe_genai_bindings.dart' : No asset with id 'package:mediapipe_genai/src/io/third_party/mediapipe/generated/mediapipe_genai_bindings.dart' found. No available native assets. Attempted to fallback to process lookup. undefined symbol: LlmInferenceEngine_CreateSession.
E/flutter ( 3568):
E/flutter ( 3568): #0 Native._ffi_resolver.#ffiClosure0 (dart:ffi-patch/ffi_patch.dart)
E/flutter ( 3568): #1 Native._ffi_resolver_function (dart:ffi-patch/ffi_patch.dart:1943:20)
E/flutter ( 3568): #2 LlmInferenceEngine_CreateSession (package:mediapipe_genai/src/io/third_party/mediapipe/generated/mediapipe_genai_bindings.dart)
E/flutter ( 3568): #3 LlmInferenceExecutor.createWorker (package:mediapipe_genai/src/io/tasks/llm_inference/llm_inference_executor.dart:59:14)
E/flutter ( 3568): #4 TaskExecutor.worker (package:mediapipe_core/src/io/task_executor.dart:56:17)
E/flutter ( 3568): #5 LlmInferenceExecutor.generateResponse (package:mediapipe_genai/src/io/tasks/llm_inference/llm_inference_executor.dart:112:7)
E/flutter ( 3568): #6 _inferenceService (package:mediapipe_genai/src/io/tasks/llm_inference/llm_inference_engine.dart:238:27)
E/flutter ( 3568):
Native Assets are enabled:
$ flutter config --enable-native-assets
model resides in:
assets/gemma3-1b-it-int4.task
LlmInferenceOptions didn't work on CPU but seems to be running on GPU (initially). as soon as i type the user prompt, the app goes into loading state and error mentioned above is returned on to the console.
Probably issues on this line of code (i'm not sure though):
final stream = _llmEngine!.generateResponse(prompt);