Downloads · 30 days
25
36% of all-time downloads
soyrsoyr/granite-vision-4.1-0.2B-tiny
granite-vision-4.1-0.2B-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 ibm-granite/granite-vision-4.1-4b created for testing and development.
Downloads · 30 days
25
36% of all-time downloads
All-time downloads
70
Public
Parameters
162M
325 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors325 MB · 98%
From the Hugging Face model README
This is a tiny version of ibm-granite/granite-vision-4.1-4b created for testing and development.
A small, fast stand-in for the granite4_vision architecture, useful for:
Granite4VisionForConditionalGeneration model path, including
the SigLIP vision tower + deepstack projectorsWeights 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 | 40 | 4 |
| text_config.hidden_size | 2560 | 1024 |
| text_config.intermediate_size | 8192 | 2048 |
| text_config.num_attention_heads | 40 | 8 |
| text_config.num_key_value_heads | 8 | 2 |
| vision_config.num_hidden_layers | 27 | 4 |
| vision_config.hidden_size | 1152 | 384 |
| vision_config.intermediate_size | 4304 | 768 |
| vision_config.num_attention_heads | 16 | 4 |
| spatial_target_layers | [12, 15, 18, 21] | [0, 1, 2, 3] |
| deepstack_layer_map | [(-19,9),(-13,6),(-7,3),(-1,0)] | [(-4,3),(-3,2),(-2,1),(-1,0)] |
The full 100,352-token vocabulary is retained.
Single safetensors file (model.safetensors). Key naming matches the original
checkpoint format (model.language_model.*, model.vision_tower.vision_model.*
(SigLIP), model.layerwise_projectors.*, model.spatial_projectors.*,
model.image_newline). Module-path structure was verified equal to the base
checkpoint's safetensors header.
from transformers import AutoModelForImageTextToText, AutoProcessor
model = AutoModelForImageTextToText.from_pretrained(
"soyrsoyr/granite-vision-4.1-0.2B-tiny", device_map="auto"
)
processor = AutoProcessor.from_pretrained("soyrsoyr/granite-vision-4.1-0.2B-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]))
This is a multimodal ...ForConditionalGeneration model, so AutoModelForCausalLM
does not resolve it. Pass AutoModelForImageTextToText to
load_offloaded_model — the class you pass must match the class you call, since
that is where device_map="auto_offload" support is injected:
from transformers import AutoModelForImageTextToText
from compressed_tensors.offload import load_offloaded_model
from compressed_tensors.distributed import init_dist
init_dist()
with load_offloaded_model(model_class=AutoModelForImageTextToText):
model = AutoModelForImageTextToText.from_pretrained(
"soyrsoyr/granite-vision-4.1-0.2B-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); the text tower
and SigLIP vision tower were shrunk and any all-zero / non-finite / extreme
param was fixed after init_weights()validate_tiny_model.pyspatial_target_layers and
deepstack_layer_map reference specific vision/text layer indices; they were
remapped to the reduced depths so they stay valid at 4 vision / 4 text layers.SiglipVisionModel
on save (model.vision_tower.*), but the published checkpoint and vLLM's
loader expect the nested model.vision_tower.vision_model.* layout. A
conversion step restores the nesting so the checkpoint loads cleanly in both
transformers (via SiglipVisionModel.base_model_prefix) and vLLM.tie_word_embeddings=True: lm_head shares embed_tokens and is not stored
as a separate tensor.Validation output: Success: 1.3236008882522583 <= 10.0