Image-Text-to-Text
Transformers
Safetensors
gemma3n
automatic-speech-recognition
automatic-speech-translation
audio-text-to-text
video-text-to-text
conversational
Instructions to use google/gemma-3n-E4B-it with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use google/gemma-3n-E4B-it with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="google/gemma-3n-E4B-it") 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, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("google/gemma-3n-E4B-it") model = AutoModelForImageTextToText.from_pretrained("google/gemma-3n-E4B-it") 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]:])) - Inference
- HuggingChat
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use google/gemma-3n-E4B-it with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "google/gemma-3n-E4B-it" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "google/gemma-3n-E4B-it", "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/google/gemma-3n-E4B-it
- SGLang
How to use google/gemma-3n-E4B-it 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 "google/gemma-3n-E4B-it" \ --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": "google/gemma-3n-E4B-it", "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 "google/gemma-3n-E4B-it" \ --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": "google/gemma-3n-E4B-it", "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 google/gemma-3n-E4B-it with Docker Model Runner:
docker model run hf.co/google/gemma-3n-E4B-it
Broken audio processing
3
#42 opened 5 months ago
by
souflaeeh
chat template in tokenizer config
#41 opened 6 months ago
by
dmchoi-scale
VLLM error: google/gemma-3n-E4B-it is not a multimodal model None
👀 5
2
#39 opened 9 months ago
by
tatarrecords
How can I finetune mnv5 with my own LLM?
3
#38 opened 9 months ago
by
lsxx
how to let the model transcribe long audio files ?
➕ 5
2
#37 opened 9 months ago
by
StephennFernandes
FP16 version?
2
#36 opened 10 months ago
by
sd17js2
when add new tokens get CUDA error: device-side assert triggered
#34 opened 10 months ago
by
mohamed-stifi
Add extra tokens to the tokenizer
4
#33 opened 10 months ago
by
debasisdwivedy
AttributeError: 'HybridCache' object has no attribute 'sliding_window'
3
#32 opened 10 months ago
by
Nasa1423
VRAM usage with transformers
👍👀 4
3
#29 opened 10 months ago
by
JPSun56
Bigger context length
#28 opened 10 months ago
by
olegshulyakov
Why can't I use the vision capability in ollama
5
#27 opened 11 months ago
by
NoobExp
Inside Google Gemma 3n: my PyTorch Profiler insights
1
#26 opened 11 months ago
by
aospan1
How to ask about coordinates of object in prompt?
2
#25 opened 11 months ago
by
ZFTurbo
Prompt and Text Normalizer for Audio Transcription Word Error Rate Calculation
👀 1
1
#24 opened 11 months ago
by
cwoolee
Non-text output?
1
#21 opened 11 months ago
by
sidhusmart
Unexpected error: recompile_limit reached with one_graph=True.
1
#19 opened 11 months ago
by
kkjh0723
Update notebook.ipynb
#17 opened 11 months ago
by
sergiopaniego
This model is amazing, but almost too amazing
🔥👍 7
2
#16 opened 11 months ago
by
nonetrix
[Bug?] google/gemma-3n-E4B-it fails with AttributeError: 'Gemma3nConfig' object has no attribute 'vocab_size'
➕ 3
7
#15 opened 11 months ago
by
EsatKara
Cannot copy out of meta tensor; no data!
1
#14 opened 11 months ago
by
Amit5674
LiteRT launch version?
➕ 7
1
#13 opened 11 months ago
by
Cat7433
Update config.json
5
#12 opened 11 months ago
by
rogerwyf
For some weird reason google ai studio is different from ALL quantizations
2
#11 opened 11 months ago
by
aguspiza
RuntimeError: number of heads in query/key/value should match
4
#10 opened 11 months ago
by
ybathula
how about those multimodal Benchmark like VideoBench ?
➕ 2
1
#9 opened 11 months ago
by
LukeAlan
Vision encoder mobilenetv5_300m_enc is not uploaded to transformers?
➕ 9
9
#8 opened 11 months ago
by
totoro74
tgi fails saying - upgrade tranformers version
4
#6 opened 11 months ago
by
Tollring
Audio example
❤️ 2
6
#5 opened 11 months ago
by
kristaller486