Skip to main content

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

gemma4_e2b_text-0.1.0.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gemma4_e2b_text-0.1.0-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

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

Hashes for gemma4_e2b_text-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ca7ebd39b456b6fc76c360a915a6133adc826781b0bf8346deff5a7360cb2986
MD5 538dfd7fad1d357d528b79893d298d0c
BLAKE2b-256 311c19a1459df4c0079044d8763b566e5c8b79273e5b3c5fb5f7a341e3f2dd06

See more details on using hashes here.

Provenance

The following attestation bundles were made for gemma4_e2b_text-0.1.0.tar.gz:

Publisher: publish.yml on baluMallisetty/gemma4-e2b-text

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for gemma4_e2b_text-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 765441197adb1903f7fb1e4e2e421d0f6cb54b16ab79af8939d0fd930ee06f04
MD5 b63a680a25213cd224fd58c134066c27
BLAKE2b-256 cf1357d33b27523293b44531d2eb3c68e21601dfecbcf39422540bfbb829bc95

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page