Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-litertlm-native-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
Copy-Item C:\LiteRT-LM\bazel-bin\c\libLiteRtLm.dylib artifacts\LiteRtLm.dll
Copy-Item StreamProxy.dll artifacts\
$prebuilt = 'C:\LiteRT-LM\prebuilt\windows_x86_64'
foreach ($base in @('libGemmaModelConstraintProvider','libLiteRt','libLiteRtTopKWebGpuSampler','libLiteRtWebGpuAccelerator')) {
foreach ($base in @('libGemmaModelConstraintProvider','libLiteRt','libLiteRtTopKWebGpuSampler','libLiteRtWebGpuAccelerator','libwebgpu_dawn')) {
$src = "$prebuilt\$base.dll"
if (Test-Path $src) {
Copy-Item $src "artifacts\$base.dll"
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/build-litertlm-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ jobs:
cp /tmp/LiteRT-LM/bazel-bin/c/libLiteRtLm.dylib artifacts/libLiteRtLm.so
cp /tmp/libStreamProxy.so artifacts/
cp /tmp/LiteRT-LM/prebuilt/linux_x86_64/*.so artifacts/ 2>/dev/null || true
# v0.14.0 Dawn split — libLiteRtWebGpuAccelerator.so now hard-links the
# separate libwebgpu_dawn.so. Set $ORIGIN rpath so each lib resolves its
# flat-layout siblings from its own directory at dlopen time.
sudo apt-get update -qq && sudo apt-get install -y -qq patchelf
chmod u+w artifacts/*.so # git-lfs prebuilt .so are read-only; patchelf edits in place
for f in artifacts/*.so; do patchelf --set-rpath '$ORIGIN' "$f"; done
ls -lh artifacts/

- uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -111,6 +117,12 @@ jobs:
cp /tmp/LiteRT-LM/bazel-bin/c/libLiteRtLm.dylib artifacts/libLiteRtLm.so
cp /tmp/libStreamProxy.so artifacts/
cp /tmp/LiteRT-LM/prebuilt/linux_arm64/*.so artifacts/ 2>/dev/null || true
# v0.14.0 Dawn split — libLiteRtWebGpuAccelerator.so now hard-links the
# separate libwebgpu_dawn.so. Set $ORIGIN rpath so each lib resolves its
# flat-layout siblings from its own directory at dlopen time.
sudo apt-get update -qq && sudo apt-get install -y -qq patchelf
chmod u+w artifacts/*.so # git-lfs prebuilt .so are read-only; patchelf edits in place
for f in artifacts/*.so; do patchelf --set-rpath '$ORIGIN' "$f"; done
ls -lh artifacts/

- uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -193,7 +205,7 @@ jobs:
Copy-Item C:\LiteRT-LM\bazel-bin\c\libLiteRtLm.dylib artifacts\LiteRtLm.dll
Copy-Item StreamProxy.dll artifacts\
$prebuilt = 'C:\LiteRT-LM\prebuilt\windows_x86_64'
foreach ($base in @('libGemmaModelConstraintProvider','libLiteRt','libLiteRtTopKWebGpuSampler','libLiteRtWebGpuAccelerator')) {
foreach ($base in @('libGemmaModelConstraintProvider','libLiteRt','libLiteRtTopKWebGpuSampler','libLiteRtWebGpuAccelerator','libwebgpu_dawn')) {
$src = "$prebuilt\$base.dll"
if (Test-Path $src) {
# Keep original name for PE imports
Expand Down
8 changes: 4 additions & 4 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
- **ModelSource**: Type-safe sealed class (`NetworkSource`, `AssetSource`, `BundledSource`, `FileSource`). See `packages/flutter_gemma/lib/core/domain/`
- **Install vs Runtime separation**: Installation stores identity (modelType + fileType), runtime accepts config (maxTokens, backend, etc.) via `RuntimeConfig`
- **Engine selection by file extension** (via `canHandle`): `.task`/`.bin`/`.tflite` → MediaPipe, `.litertlm` → LiteRT-LM
- **All five platforms (Android/iOS/macOS/Linux/Windows)**: Dart → `dart:ffi` → LiteRT-LM C API (inference, in `flutter_gemma_litertlm`) + LiteRT C API (embeddings, in `flutter_gemma_embeddings`). Native prebuilts fetched at build time via each package's `hook/build.dart` (Native Assets) from GitHub release `native-v0.12.0-a`. The cycle-fix `stage()` in the hooks is **Apple-only** (Xcode `directoryTreeSignature` cycle; staging on Windows splits companion DLLs and hangs cancel/close).
- **All five platforms (Android/iOS/macOS/Linux/Windows)**: Dart → `dart:ffi` → LiteRT-LM C API (inference, in `flutter_gemma_litertlm`) + LiteRT C API (embeddings, in `flutter_gemma_embeddings`). Native prebuilts fetched at build time via each package's `hook/build.dart` (Native Assets) from GitHub release `native-v0.14.0`. The cycle-fix `stage()` in the hooks is **Apple-only** (Xcode `directoryTreeSignature` cycle; staging on Windows splits companion DLLs and hangs cancel/close).

### Supported Models

Expand Down Expand Up @@ -136,9 +136,9 @@ Core has NO pigeon (dropped at the 1.0 cut; its value types are hand-written in
- **Dart SDK**: `>=3.12.0 <4.0.0`
- **iOS**: Minimum 16.0
- **MediaPipe Web**: v0.10.27, Android/iOS: v0.10.33
- **LiteRT-LM**: native libs from `native-v0.13.1-a` GitHub Release. Android tarball bundles the Qualcomm QNN dispatch stack and Windows tarball bundles Intel NPU dispatch (`LiteRtDispatch.dll` + OpenVino runtime + TBB) for `PreferredBackend.npu` (Qualcomm Snapdragon / Intel LunarLake/PantherLake). MTP (speculative decoding) support for Gemma 4 (#318 MTP crash fixed). (native-v0.13.1-a restores the NPU dispatch libs accidentally omitted from native-v0.13.1 — #155.)
- **LiteRT-LM**: native libs from `native-v0.14.0` GitHub Release. Android tarball bundles the Qualcomm QNN dispatch stack and Windows tarball bundles Intel NPU dispatch (`LiteRtDispatch.dll` + OpenVino runtime + TBB) for `PreferredBackend.npu` (Qualcomm Snapdragon / Intel LunarLake/PantherLake). v0.14.0: native per-session sampler (opaque session-config) + #214 GPU output-garbage fix; Dawn split static→dynamic (Linux/Windows bundle `libwebgpu_dawn`). Windows discrete GPU (WebGPU/Dawn) regressed upstream — use CPU/NPU on Windows (LiteRT-LM #2957).
- **large_file_handler**: `^0.5.0` (core dep; 0.5.0 declares all 6 platforms — needed for pana platform support + the dart2wasm-clean web graph)
- **Current Version**: core `flutter_gemma` `1.3.1`, `flutter_gemma_rag_sqlite` `1.1.0`, `flutter_gemma_rag_qdrant` `1.1.0`; `flutter_gemma_litertlm` `1.0.4`, `flutter_gemma_mediapipe` `1.0.4`, `flutter_gemma_embeddings` `1.0.1`; `flutter_gemma_agent` `0.1.0`, `flutter_gemma_builtin_ai` `0.1.0` (new)
- **Current Version**: core `flutter_gemma` `1.3.2`, `flutter_gemma_rag_sqlite` `1.1.0`, `flutter_gemma_rag_qdrant` `1.1.0`; `flutter_gemma_litertlm` `1.2.0`, `flutter_gemma_mediapipe` `1.0.4`, `flutter_gemma_embeddings` `1.0.3`; `flutter_gemma_agent` `0.1.0`, `flutter_gemma_builtin_ai` `0.1.0`
- **0.15.2**: embedding unified on LiteRT C API via Dart FFI on all native platforms (Android + iOS + Desktop). Drops `localagents-rag` JVM dep on Android and the separate TFLite C 0.12.7 tarball on Desktop; `TensorFlowLiteC` pod no longer needed on iOS. Single source of truth for `TaskType.prefix` in Dart, fixes cross-platform embedding drift (#264).

## Platform-Specific Setup
Expand Down Expand Up @@ -175,7 +175,7 @@ window.LlmInference = LlmInference;

### Desktop (macOS/Windows/Linux)
- Architecture: Dart → `dart:ffi` → LiteRT-LM C API (no JVM, no gRPC)
- Native libs fetched at build time by each package's `hook/build.dart` from `native-v0.12.0-a` GitHub release; SHA256-verified, bundled via Native Assets
- Native libs fetched at build time by each package's `hook/build.dart` from `native-v0.14.0` GitHub release; SHA256-verified, bundled via Native Assets
- Desktop uses `.litertlm` format only (not `.task`)
- Windows GPU requires `dxil.dll` + `dxcompiler.dll` (DirectXShaderCompiler runtime) — bundled in the Windows native archive
- Windows NPU (`PreferredBackend.npu`) requires Intel LunarLake/PantherLake silicon — `LiteRtDispatch.dll` + OpenVino runtime + TBB bundled in the Windows native archive (0.15.1+)
Expand Down
4 changes: 4 additions & 0 deletions packages/flutter_gemma/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.3.2
- Docs: add community models to the README model list (SmolLM3-3B, Phi-4-mini-reasoning, Qwen2-VL, SmolVLM2, LLaVA-OneVision).
- Docs: bump web `@litert-lm/core` setup snippet to 0.14.0.

## 1.3.1
- Fix multi-GB background_downloader temp-file leak on Android (#383).
- Deterministic download task IDs (sha256 of path triple) — stable across restarts and signed-URL rotation (#383).
Expand Down
Loading
Loading