Downloads · 30 days
30
5% of all-time downloads
soyrsoyr/gemma-4-unified-0.8B-tiny
gemma-4-unified-0.8B-tiny is a image-text-to-text model from soyrsoyr. 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.
This is a tiny version of google/gemma-4-12B-it created for testing and development.
Downloads · 30 days
30
5% of all-time downloads
All-time downloads
579
Public
Parameters
798M
1.6 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1.6 GB · 98%
From the Hugging Face model README
This is a tiny version of google/gemma-4-12B-it created for testing and development.
A small, fast stand-in for the gemma4_unified architecture, useful for:
Gemma4UnifiedForConditionalGeneration model pathWeights are random (then briefly fine-tuned on a toy corpus), so generations are not meaningful, this model is for plumbing, not output quality.
The following parameters were reduced from the original model:
| Parameter | Original | Tiny |
|---|---|---|
| text_config.num_hidden_layers | 48 | 6 |
| text_config.hidden_size | 3840 | 2048 |
| text_config.intermediate_size | 15360 | 1536 |
Layer type patterns are preserved: the sliding/full attention mix is kept as
5× sliding_attention + 1× full_attention. Attention shape is unchanged
(16 heads, 8 KV heads, head_dim 256), and the full 262,144-token vocabulary is
retained. The vision (gemma4_unified_vision) and audio towers are left at base
size; they are small relative to the shared token embedding.
Single safetensors file (model.safetensors). Key naming matches the original
checkpoint format (model.language_model.*, model.embed_vision.*,
model.embed_audio.*, model.vision_embedder.*). Module-path structure was
verified equal to the base checkpoint's safetensors header.
from transformers import AutoModelForImageTextToText, AutoProcessor
model = AutoModelForImageTextToText.from_pretrained(
"soyrsoyr/gemma-4-unified-0.8B-tiny", device_map="auto"
)
processor = AutoProcessor.from_pretrained("soyrsoyr/gemma-4-unified-0.8B-tiny")
input_ids = processor.tokenizer("According to all known laws", return_tensors="pt").input_ids.to(model.device)
output = model.generate(input_ids, max_new_tokens=20)
print(processor.tokenizer.decode(output[0]))
AutoModelForCausalLM resolves this architecture (transformers maps
gemma4_unified into the causal-LM auto-class), so the default
load_offloaded_model() pattern works directly:
from transformers import AutoModelForCausalLM
from compressed_tensors.offload import load_offloaded_model
from compressed_tensors.distributed import init_dist
init_dist()
with load_offloaded_model(): # patches AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained(
"soyrsoyr/gemma-4-unified-0.8B-tiny",
device_map="auto_offload", # weights on CPU/disk, GPU for activations
)
This model was created using the llm-compressor create-tiny-model claude skill.
inspect_config.pysave_tiny_model.py, adapted for the
multimodal class (AutoModelForImageTextToText.from_config); only the text
tower was shrunk and any all-zero / non-finite / extreme param was fixed after
init_weights()validate_tiny_model.pyembed_vision.multimodal_embedder.embedding_projection) reads
text_config.hidden_size for its output dim, so it auto-aligns to the reduced
2048 hidden. vision_config.output_proj_dims / mm_embed_dim are
intentionally left unchanged — editing them flips the modeling code to a
different (flattened vision_embedder) module tree that no longer matches the
original checkpoint layout.tie_word_embeddings=True: lm_head shares embed_tokens and is not stored
as a separate tensor.Validation output: Success: 1.0278589725494385 <= 10.0