gemma4-e2b-text
A one-command, local, text-only Python interface to Google’s quantized Gemma 4 E2B model using LiteRT-LM.
Install
After the first PyPI release:
py -m pip install gemma4-e2b-text
No Hugging Face command or separate model package is required. On first use, the library downloads two assets from this repository's GitHub Release, assembles the official model directly in the local cache, verifies its SHA-256, and then runs locally. Later uses work offline.
To download and verify the model before running any prompt:
gemma4-e2b --download-only
Interrupted downloads resume automatically.
Python API
from gemma4_e2b_text import Gemma4
with Gemma4(backend="cpu") as model:
response = model.generate(
"Florida is a state in which country? Answer in one word."
)
print(response)
For a single call:
from gemma4_e2b_text import generate
print(generate("Write one sentence about Florida."))
Command line
gemma4-e2b "What is the capital of France?"
gemma4-e2b --backend gpu
gemma4-e2b --download-only
With no prompt, the command starts a stateful interactive chat. CPU is the default. GPU automatically enables LiteRT-LM multi-token prediction; NPU is available where the installed runtime and hardware support it.
Model download and cache
The official CPU-compatible model is 2,588,147,712 bytes (2.41 GiB). GitHub Release assets must each be under 2 GiB, so the release contains two equal 1,294,073,856-byte parts. The library appends both parts into one temporary model and only moves it into place after this official SHA-256 passes:
181938105e0eefd105961417e8da75903eacda102c4fce9ce90f50b97139a63c
Default cache locations:
- Windows:
%LOCALAPPDATA%\gemma4-e2b-text\models - macOS:
~/Library/Caches/gemma4-e2b-text/models - Linux:
${XDG_CACHE_HOME:-~/.cache}/gemma4-e2b-text/models
Set GEMMA4_E2B_CACHE_DIR to select another cache directory. Set
GEMMA4_E2B_MODEL to use an existing .litertlm file and skip downloading.
The 0.8–0.84 GB number published for text-only operation is a working-memory footprint made possible by memory mapping; it is not the download size.
Platform support
The LiteRT-LM 0.16.1 Python wheels currently cover Windows x86-64, Linux x86-64/aarch64, macOS arm64, and Android x86-64/arm64 with Python 3.10+. Hardware-specific availability may change upstream.
Source checkout and tests
PYTHONPATH=src python -m unittest discover -s tests -v
python -m pip wheel . --no-deps --no-build-isolation -w dist
Maintainers publish the model assets with the manual Publish model assets
GitHub Actions workflow. It downloads the pinned official artifact, verifies
it, creates the two release parts plus a manifest, and publishes tag
model-v0.1.0. See RELEASING.md.
License and safety
The project and upstream model are Apache-2.0 licensed. See MODEL_NOTICE.md
for provenance and the pinned hash. This is an independent community package,
not a Google product. Generated text can be inaccurate; validate important
outputs and follow the upstream Gemma responsible-use guidance.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gemma4_e2b_text-0.1.0.tar.gz.
File metadata
- Download URL: gemma4_e2b_text-0.1.0.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca7ebd39b456b6fc76c360a915a6133adc826781b0bf8346deff5a7360cb2986
|
|
| MD5 |
538dfd7fad1d357d528b79893d298d0c
|
|
| BLAKE2b-256 |
311c19a1459df4c0079044d8763b566e5c8b79273e5b3c5fb5f7a341e3f2dd06
|
Provenance
The following attestation bundles were made for gemma4_e2b_text-0.1.0.tar.gz:
Publisher:
publish.yml on baluMallisetty/gemma4-e2b-text
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gemma4_e2b_text-0.1.0.tar.gz -
Subject digest:
ca7ebd39b456b6fc76c360a915a6133adc826781b0bf8346deff5a7360cb2986 - Sigstore transparency entry: 2568974635
- Sigstore integration time:
-
Permalink:
baluMallisetty/gemma4-e2b-text@af56255120d5d639260410e6b8a27d65315d4a23 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/baluMallisetty
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@af56255120d5d639260410e6b8a27d65315d4a23 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file gemma4_e2b_text-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gemma4_e2b_text-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
765441197adb1903f7fb1e4e2e421d0f6cb54b16ab79af8939d0fd930ee06f04
|
|
| MD5 |
b63a680a25213cd224fd58c134066c27
|
|
| BLAKE2b-256 |
cf1357d33b27523293b44531d2eb3c68e21601dfecbcf39422540bfbb829bc95
|
Provenance
The following attestation bundles were made for gemma4_e2b_text-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on baluMallisetty/gemma4-e2b-text
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gemma4_e2b_text-0.1.0-py3-none-any.whl -
Subject digest:
765441197adb1903f7fb1e4e2e421d0f6cb54b16ab79af8939d0fd930ee06f04 - Sigstore transparency entry: 2568974651
- Sigstore integration time:
-
Permalink:
baluMallisetty/gemma4-e2b-text@af56255120d5d639260410e6b8a27d65315d4a23 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/baluMallisetty
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@af56255120d5d639260410e6b8a27d65315d4a23 -
Trigger Event:
workflow_dispatch
-
Statement type: