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")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("google/gemma-3n-E4B-it", dtype="auto") - 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/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "google/gemma-3n-E4B-it", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "google/gemma-3n-E4B-it", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "google/gemma-3n-E4B-it", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - 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
Inside Google Gemma 3n: my PyTorch Profiler insights
Hi everyone,
If you’ve ever wondered what really happens inside modern vision-language models, here’s a hands-on look. I profiled the Google Gemma 3n model on an NVIDIA GPU using PyTorch Profiler, asking it to describe a bee image.
I visualized the profiling results using https://ui.perfetto.dev/, as shown in the animated GIF below:
I’ve shared the full code, profiling scripts, and raw trace data, so you can dive in, reproduce the results, and explore the model’s internals for yourself.
👉 https://github.com/sbnb-io/gemma3n-profiling/
If you’re looking to better understand how these models run under the hood, this is a solid place to start. Happy to hear your thoughts or suggestions!
Hi @aospan1 ,
Welcome to Google Gemma family of open source models, thanks for sharing your script with us, we are really excited to try this from our end and will share the feedback and suggestion with you.
Thanks.
