Codex commited on
Commit
d98fafa
Β·
1 Parent(s): 549e008

Document multimodal TranslateGemma artifact

Browse files
Files changed (2) hide show
  1. CLAUDE.md +5 -1
  2. README.md +11 -3
CLAUDE.md CHANGED
@@ -6,6 +6,9 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
6
 
7
  Python toolkit that converts Google's TranslateGemma 4B IT model (HuggingFace) into on-device inference bundles for Android. Google's official TFLite files only support WebGPU β€” this project produces CPU/XNNPACK-compatible `.litertlm` (LiteRT-LM) and `.task` (MediaPipe) files with proper KV-cache prefill/decode signatures.
8
 
 
 
 
9
  ## Common Commands
10
 
11
  ### Single quantization conversion (produces `.task`)
@@ -109,6 +112,7 @@ In Google AI Edge Gallery **Prompt Lab** mode, paste this as the System Prompt w
109
  - `conv-venv/` β€” virtualenv with all deps (`litert-torch==0.8.0`, `mediapipe`, `ai_edge_torch`, `transformers`)
110
  - `/tmp/litert-lm-pkg/` β€” manually assembled package from cloned LiteRT-LM repo with compiled FlatBuffer (`flatc -p --gen-onefile`) and proto (`protoc`) Python bindings; required by `bundle_litertlm.py` at runtime; NOT persistent across reboots
111
  - `/tmp/litert-lm/` β€” cloned `google-ai-edge/LiteRT-LM` repo (schema source for rebuilding the package)
112
- - Conversion requires ~128 GB RAM; 4B model loads ~46 GB
 
113
  - `translategemma-4b-it/tokenizer.model` is the SentencePiece binary used by both `.task` and `.litertlm` bundlers; `ensure_tokenizer_model()` auto-converts from `tokenizer.json` if missing
114
  - HuggingFace repo: `barakplasma/translategemma-4b-it-android-task-quantized`; upload token in `HF_TOKEN` env var
 
6
 
7
  Python toolkit that converts Google's TranslateGemma 4B IT model (HuggingFace) into on-device inference bundles for Android. Google's official TFLite files only support WebGPU β€” this project produces CPU/XNNPACK-compatible `.litertlm` (LiteRT-LM) and `.task` (MediaPipe) files with proper KV-cache prefill/decode signatures.
8
 
9
+ The primary Hugging Face app artifact is the multimodal image+text LiteRT-LM bundle:
10
+ `artifacts/int4-multimodal/translategemma-4b-it-int4-multimodal.litertlm` (~2.76 GB). It supports structured text translation and image translation through LiteRT-LM vision, and is intended for PrivateAITranslate. If this file is absent from the Hugging Face repo, the app download URL for the multimodal model will 404.
11
+
12
  ## Common Commands
13
 
14
  ### Single quantization conversion (produces `.task`)
 
112
  - `conv-venv/` β€” virtualenv with all deps (`litert-torch==0.8.0`, `mediapipe`, `ai_edge_torch`, `transformers`)
113
  - `/tmp/litert-lm-pkg/` β€” manually assembled package from cloned LiteRT-LM repo with compiled FlatBuffer (`flatc -p --gen-onefile`) and proto (`protoc`) Python bindings; required by `bundle_litertlm.py` at runtime; NOT persistent across reboots
114
  - `/tmp/litert-lm/` β€” cloned `google-ai-edge/LiteRT-LM` repo (schema source for rebuilding the package)
115
+ - Multimodal conversion observed peak RSS around 73.9 GiB; require 96 GB minimum RAM, with 128 GB preferred. Ideal builder is a Vast.ai PyTorch image or Ubuntu-based NVIDIA/PyTorch image rather than a bare CUDA runtime image.
116
+ - CPU real-device validation has passed on Pixel 10 and Galaxy S22 / S22 Ultra-class targets. GPU initialization currently fails during validation and should be considered experimental and not validated.
117
  - `translategemma-4b-it/tokenizer.model` is the SentencePiece binary used by both `.task` and `.litertlm` bundlers; `ensure_tokenizer_model()` auto-converts from `tokenizer.json` if missing
118
  - HuggingFace repo: `barakplasma/translategemma-4b-it-android-task-quantized`; upload token in `HF_TOKEN` env var
README.md CHANGED
@@ -19,7 +19,7 @@ On-device translation model for Android using [Google AI Edge](https://ai.google
19
  Converts [google/translategemma-4b-it](https://huggingface.co/google/translategemma-4b-it) (55 languages, 4B params)
20
  into formats that run locally on Android without internet or cloud APIs.
21
 
22
- Google only publishes WebGPU-only TFLite files. This repo bridges that gap with CPU/XNNPACK-compatible `.litertlm` bundles (LiteRT-LM format) with embedded chat template.
23
 
24
  ---
25
 
@@ -29,9 +29,11 @@ Google only publishes WebGPU-only TFLite files. This repo bridges that gap with
29
  |------|------|-------|
30
  | `artifacts/int4-generic/translategemma-4b-it-int4-generic.litertlm` | ~2 GB | INT4 blockwise quant β€” faster, lower RAM |
31
  | `artifacts/dynamic_int8-generic/translategemma-4b-it-dynamic_int8-generic.litertlm` | ~4 GB | Dynamic INT8 β€” better quality |
32
- | `artifacts/int4-multimodal/translategemma-4b-it-int4-multimodal.litertlm` | ~2.6 GB | INT4 multimodal bundle with image translation support |
33
 
34
- **Start with INT4** if you're unsure β€” it loads faster and uses less RAM. Use dynamic_int8 for better translation quality.
 
 
35
 
36
  ---
37
 
@@ -69,6 +71,10 @@ Use standard ISO 639-1 language codes: `en`, `he`, `fr`, `es`, `de`, `ar`, `zh`,
69
 
70
  Plain text (no tags) is also accepted β€” the model will attempt translation based on context.
71
 
 
 
 
 
72
  ---
73
 
74
  ## Device Requirements
@@ -80,6 +86,8 @@ Plain text (no tags) is also accepted β€” the model will attempt translation bas
80
  | OS | Android 10+ |
81
  | Runtime | Google AI Edge Gallery or LiteRT-LM SDK |
82
 
 
 
83
  ---
84
 
85
  ## What's Different From Google's Official Files
 
19
  Converts [google/translategemma-4b-it](https://huggingface.co/google/translategemma-4b-it) (55 languages, 4B params)
20
  into formats that run locally on Android without internet or cloud APIs.
21
 
22
+ Google only publishes WebGPU-only TFLite files. This repo bridges that gap with CPU/XNNPACK-compatible `.litertlm` bundles (LiteRT-LM format) with embedded chat template, including a multimodal image+text Android bundle for PrivateAITranslate.
23
 
24
  ---
25
 
 
29
  |------|------|-------|
30
  | `artifacts/int4-generic/translategemma-4b-it-int4-generic.litertlm` | ~2 GB | INT4 blockwise quant β€” faster, lower RAM |
31
  | `artifacts/dynamic_int8-generic/translategemma-4b-it-dynamic_int8-generic.litertlm` | ~4 GB | Dynamic INT8 β€” better quality |
32
+ | `artifacts/int4-multimodal/translategemma-4b-it-int4-multimodal.litertlm` | ~2.76 GB | INT4 multimodal image+text bundle for structured text translation and LiteRT-LM vision image translation |
33
 
34
+ **Start with INT4** if you're unsure β€” it loads faster and uses less RAM. Use dynamic_int8 for better text translation quality.
35
+
36
+ The multimodal artifact is the bundle expected by PrivateAITranslate for image translation. If `artifacts/int4-multimodal/translategemma-4b-it-int4-multimodal.litertlm` is not present in this Hugging Face repo, the app download URL for that model will return 404.
37
 
38
  ---
39
 
 
71
 
72
  Plain text (no tags) is also accepted β€” the model will attempt translation based on context.
73
 
74
+ ### Image translation
75
+
76
+ The multimodal `.litertlm` bundle uses LiteRT-LM vision support for image+text translation flows in PrivateAITranslate. It is intended for structured text translation and image translation, not general image captioning.
77
+
78
  ---
79
 
80
  ## Device Requirements
 
86
  | OS | Android 10+ |
87
  | Runtime | Google AI Edge Gallery or LiteRT-LM SDK |
88
 
89
+ CPU real-device validation passed on Pixel 10 and Galaxy S22 / S22 Ultra-class targets. GPU execution currently fails initialization in validation and should be treated as experimental and not validated.
90
+
91
  ---
92
 
93
  ## What's Different From Google's Official Files