TranslateGemma 4B IT (llamafile runtimes)
Packaged .llamafile runtimes for local TranslateGemma text translation, image translation, and official messages-json inference.
This repository republishes multiple packaged TranslateGemma .llamafile runtimes in a single Hugging Face model repo.
- Latest updated SKU in this build:
q8_0_vision
Sources
- Official base model: google/translategemma-4b-it
- GGUF source repo: mradermacher/translategemma-4b-it-GGUF
- Example GGUF source file:
translategemma-4b-it.Q8_0.gguf - Upstream license:
gemma
Runtime Engine
- llamafile release:
v0.10.4-dev - llama.cpp commit:
c5a778891 - Packaging tool repo: xzhih/llamafile
- Packaging tool branch:
translategemma
Available Runtimes
| ID | Quantization | Modalities | Recommended | File |
|---|---|---|---|---|
| q4_k_m | Q4_K_M | text | yes | translategemma-4b-it.Q4_K_M.llamafile |
| q6_k | Q6_K | text | no | translategemma-4b-it.Q6_K.llamafile |
| q8_0 | Q8_0 | text | no | translategemma-4b-it.Q8_0.llamafile |
| q8_0_vision | Q8_0 | text, vision | yes | translategemma-4b-it.Q8_0.mmproj-Q8_0.llamafile |
Note
Each packaged .llamafile already embeds its model. Vision SKUs also embed mmproj-Q8_0, so you should not pass -m or --mmproj when running them.
q8_0_visionis the supported image translation runtime in this SKU set.- Lower-quant vision runtimes are intentionally omitted because dense UI screenshots can return incomplete output.
Usage
Replace the runtime paths below with any file from the runtime table above. The examples below use one packaged runtime path from this repo.
Do not pass -m; just run the packaged file directly.
Download
hf download xzhih/translategemma-4b-it-llamafile translategemma-4b-it.Q8_0.mmproj-Q8_0.llamafile --local-dir .
TEXT_RUNTIME="./translategemma-4b-it.Q4_K_M.llamafile"
chmod +x "$TEXT_RUNTIME"
Text Translation
TEXT_RUNTIME="./translategemma-4b-it.Q4_K_M.llamafile"
sh "$TEXT_RUNTIME" --translate-text "Hello, world." --source-lang en --target-lang zh-CN
sh "$TEXT_RUNTIME" --translate-text "Settings > General" --source-lang en --target-lang zh-CN \
--translation-instruction "Use Mainland China UI wording. Keep product names in English."
Official Messages JSON
TEXT_RUNTIME="./translategemma-4b-it.Q4_K_M.llamafile"
sh "$TEXT_RUNTIME" --translate-messages-json "$(cat <<'JSON'
[
{
"role": "user",
"content": [
{
"type": "text",
"source_lang_code": "en",
"target_lang_code": "zh-CN",
"text": "Hello, world."
}
]
}
]
JSON
)"
TranslateGemma HTTP Server
TEXT_RUNTIME="./translategemma-4b-it.Q4_K_M.llamafile"
sh "$TEXT_RUNTIME" --server --host 127.0.0.1 --port 8080
In another terminal:
curl http://127.0.0.1:8080/health
curl http://127.0.0.1:8080/v1/models
curl http://127.0.0.1:8080/v1/translate \
-H 'Content-Type: application/json' \
-d "$(cat <<'JSON'
{
"text": "Settings > General",
"source_lang": "en",
"target_lang": "zh-CN",
"translation_instruction": "Use Mainland China UI wording. Keep product names in English."
}
JSON
)"
curl http://127.0.0.1:8080/v1/translate/messages \
-H 'Content-Type: application/json' \
-d "$(cat <<'JSON'
{
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"source_lang_code": "en",
"target_lang_code": "zh-CN",
"text": "Hello, world."
}
]
}
],
"translation_instruction": "Keep product names in English."
}
JSON
)"
Image Translation
VISION_RUNTIME="./translategemma-4b-it.Q8_0.mmproj-Q8_0.llamafile"
sh "$VISION_RUNTIME" --translate-image ./IMG_8477.PNG --source-lang en --target-lang zh-CN \
--translation-instruction "Use Mainland China mobile app terminology."
For --translate-messages-json, image entries must use the official type: "image" shape and a local file path or data URI in url.
VISION_RUNTIME="./translategemma-4b-it.Q8_0.mmproj-Q8_0.llamafile"
sh "$VISION_RUNTIME" --translate-messages-json "$(cat <<'JSON'
[
{
"role": "user",
"content": [
{
"type": "image",
"source_lang_code": "en",
"target_lang_code": "zh-CN",
"url": "./IMG_8477.PNG"
}
]
}
]
JSON
)"
Notes
This repository republishes the upstream model as a packaged .llamafile with an embedded mmproj-Q8_0 projector. This is the recommended image translation runtime in the current SKU set.
- Downloads last month
- 11