Instructions to use google/gemma-4-E2B-it with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use google/gemma-4-E2B-it with Transformers:
# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("google/gemma-4-E2B-it") model = AutoModelForImageTextToText.from_pretrained("google/gemma-4-E2B-it") - Notebooks
- Google Colab
- Kaggle
Embed chat_template in tokenizer_config.json
What
Adds the chat template directly to tokenizer_config.json so that tokenizer.apply_chat_template() works out of the box without needing to separately download and load chat_template.jinja.
Why
Right now the chat template is only in chat_template.jinja as a separate file. The transformers library auto-loads it when it's present in the model directory, but many third-party tools and deployment pipelines only copy the standard tokenizer files (tokenizer.json + tokenizer_config.json). When the .jinja file is missing, tokenizer.chat_template is None and apply_chat_template() fails silently.
Other Gemma models (Gemma 2, Gemma 3) embed the template in tokenizer_config.json, so this seems like an oversight in the Gemma 4 release.
Related: https://github.com/huggingface/transformers/issues/45205