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.
Metadata
Release files for gemma4-e2b-text 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gemma4_e2b_text-0.1.0.tar.gz | 16.2 kB | With provenance | Details for gemma4_e2b_text-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gemma4_e2b_text-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for gemma4_e2b_text-0.1.0-py3-none-any.whl |
Total release size: 30.1 kB
Release files / gemma4_e2b_text-0.1.0.tar.gz
| Download URL | gemma4_e2b_text-0.1.0.tar.gz |
|---|---|
| Size | 16.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca7ebd39b456b6fc76c360a915a6133adc826781b0bf8346deff5a7360cb2986
|
|
BLAKE2b-256 checksum How to use checksums |
311c19a1459df4c0079044d8763b566e5c8b79273e5b3c5fb5f7a341e3f2dd06
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.
Transparency logRelease files / gemma4_e2b_text-0.1.0-py3-none-any.whl
| Download URL | gemma4_e2b_text-0.1.0-py3-none-any.whl |
|---|---|
| Size | 14.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
765441197adb1903f7fb1e4e2e421d0f6cb54b16ab79af8939d0fd930ee06f04
|
|
BLAKE2b-256 checksum How to use checksums |
cf1357d33b27523293b44531d2eb3c68e21601dfecbcf39422540bfbb829bc95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.
Transparency logSecurity for gemma4-e2b-text 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for gemma4_e2b_text-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.