Image-Text-to-Text
Transformers
Safetensors
gemma4
quantization
nvfp4
conversational
compressed-tensors
Instructions to use yasu-oh/gemma-4-E2B-it-qat-NVFP4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use yasu-oh/gemma-4-E2B-it-qat-NVFP4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="yasu-oh/gemma-4-E2B-it-qat-NVFP4") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("yasu-oh/gemma-4-E2B-it-qat-NVFP4") model = AutoModelForMultimodalLM.from_pretrained("yasu-oh/gemma-4-E2B-it-qat-NVFP4", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use yasu-oh/gemma-4-E2B-it-qat-NVFP4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "yasu-oh/gemma-4-E2B-it-qat-NVFP4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yasu-oh/gemma-4-E2B-it-qat-NVFP4", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/yasu-oh/gemma-4-E2B-it-qat-NVFP4
- SGLang
How to use yasu-oh/gemma-4-E2B-it-qat-NVFP4 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "yasu-oh/gemma-4-E2B-it-qat-NVFP4" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yasu-oh/gemma-4-E2B-it-qat-NVFP4", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "yasu-oh/gemma-4-E2B-it-qat-NVFP4" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yasu-oh/gemma-4-E2B-it-qat-NVFP4", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use yasu-oh/gemma-4-E2B-it-qat-NVFP4 with Docker Model Runner:
docker model run hf.co/yasu-oh/gemma-4-E2B-it-qat-NVFP4
metadata
library_name: transformers
license: apache-2.0
license_link: https://ai.google.dev/gemma/docs/gemma_4_license
pipeline_tag: image-text-to-text
base_model:
- google/gemma-4-E2B-it-qat-q4_0-unquantized
datasets:
- CohereLabs/aya_dataset
- interstellarninja/hermes_reasoning_tool_use
tags:
- quantization
- nvfp4
gemma-4-E2B-it-qat-NVFP4
An NVFP4-quantized version of google/gemma-4-E2B-it-qat-q4_0-unquantized.
This model was independently quantized to NVFP4 W4A4 using LLM Compressor and saved in the compressed-tensors format.
Model Details
- Base model: google/gemma-4-E2B-it-qat-q4_0-unquantized
- Architecture: Gemma4ForConditionalGeneration
- Quantization: NVFP4 W4A4
- Serialization format: nvfp4-pack-quantized
- Compression backend: compressed-tensors
- Calibration samples: 1,024
- Maximum calibration sequence length: 8,192 tokens
Calibration Data
The following datasets were used for calibration:
The calibration dataset consists of:
- 512 general multilingual instruction samples from Aya
- 512 reasoning and tool-use conversation samples from Hermes
Quantization Configuration
default_stage:
default_modifiers:
GPTQModifier:
config_groups:
group_0:
targets: [Linear]
weights:
num_bits: 4
type: float
symmetric: true
group_size: 16
strategy: tensor_group
block_structure: null
dynamic: false
actorder: static
scale_dtype: torch.float8_e4m3fn
zp_dtype: null
observer: imatrix_mse
observer_kwargs: {strict: true}
input_activations:
num_bits: 4
type: float
symmetric: true
group_size: 16
strategy: tensor_group
block_structure: null
dynamic: local
actorder: null
scale_dtype: torch.float8_e4m3fn
zp_dtype: null
observer: static_minmax
observer_kwargs: {}
output_activations: null
format: null
targets: [Linear]
ignore: [lm_head, 're:.*embed.*', 're:.*vision.*', 're:.*audio.*', 're:.*router.*', 're:.*per_layer.*']
kv_cache_scheme:
num_bits: 8
type: float
symmetric: true
group_size: null
strategy: tensor
block_structure: null
dynamic: false
actorder: null
scale_dtype: null
zp_dtype: null
observer: static_minmax
observer_kwargs: {}
bypass_divisibility_checks: false
requires_calibration_data: true
block_size: 128
dampening_frac: 0.01
actorder: static
offload_hessians: false
Reproducibility
The quantization code and calibration preprocessing are available at:
The quantization run used:
transformers: 5.12.1
llmcompressor: 0.12.1.dev92+g8cec0acc1
compressed-tensors: 0.17.2a20260729