Downloads · 30 days
0
AsadIsmail/gemma-4-E4B-it-ternary
gemma-4-E4B-it-ternary is a image-text-to-text model from AsadIsmail. Use it for the image-text-to-text task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as gemma.
Ternary-quantized version of google/gemma-4-E4B-it, produced with ternary-quant.
Downloads · 30 days
0
Access
Public
Updated Apr 27, 2026
Repo size
4.4 GB
Likes
3
Public
Click a slice to open those files.
.npz4.4 GB · 100%
From the Hugging Face model README
Ternary-quantized version of google/gemma-4-E4B-it, produced with ternary-quant.
Gemma 4-E4B is Google's multimodal model that processes both images and text. This ternary-quantized version retains multimodal capabilities while reducing model size through a HuggingFace-native, component-aware PTQ workflow.
| Metric | Value |
|---|---|
| Scheme | tritplane3 (3-plane progressive ternary) |
| Components quantized | text_backbone, multimodal_connector (342 linear layers) |
| Vision encoder | Kept in FP16 (preserving image understanding quality) |
| Group size | 32 |
| Calibration iterations | 10 |
| Stored size | 4234 MB (~4.2 GB) |
| FP16 size | ~16 GB |
| Compression ratio | ~3.8x |
from ternary_quant.inference import load_ternary_model
# Load model (auto-detects best device: CUDA > MPS > CPU)
model, processor = load_ternary_model(
"AsadIsmail/gemma-4-E4B-it-ternary",
runtime_mode="metal" # Use "cached" for NVIDIA GPU or CPU
)
# Image understanding
from PIL import Image
image = Image.open("photo.jpg")
inputs = processor(text="Describe this image", images=image, return_tensors="pt")
inputs = {k: v.to(model.device) for k, v in inputs.items()}
outputs = model.generate(**inputs, max_new_tokens=256)
print(processor.decode(outputs[0], skip_special_tokens=True))
| Runtime | Min RAM | Speed | Notes |
|---|---|---|---|
metal (Apple Silicon) | ~8 GB | Good | Native Metal kernels |
cached (any device) | ~12 GB | Fastest | Dequantizes once at load |
triton_memory (NVIDIA) | ~6 GB | Moderate | Packed ternary in VRAM |
pip install ternary-quant
ternary-quant quantize-broad google/gemma-4-E4B-it \
--output ./gemma-4-E4B-it-ternary \
--components text_backbone multimodal_connector \
--scheme tritplane3 \
--dtype float16 \
--eval
See github.com/Asad-Ismail/ternary-models for the full collection of ternary-quantized multimodal models.
@software{ternary_quant,
author = {Ismail, Asad},
title = {ternary-quant: Post-training ternary quantization for HuggingFace generative models},
url = {https://github.com/Asad-Ismail/ternary-quant},
year = {2026}
}