
Hugging Face Blog
· 2 min read
Google releases Gemma 2 2B, ShieldGemma and Gemma Scope
One month after the release of Gemma 2, Google has expanded their set of Gemma models to include the following new additions:
- Gemma 2 2B - The 2.6B parameter version of Gemma 2, making it a great candidate for on-device use.
- ShieldGemma - A series of safety classifiers, trained on top of Gemma 2, for developers to filter inputs and outputs of their applications.
- Gemma Scope - A comprehensive, open suite of sparse autoencoders for Gemma 2 2B and 9B.
Let’s take a look at each of these in turn!
Gemma 2 2B
For those who missed the previous launches, Gemma is a family of lightweight, state-of-the-art open models from Google, built from the same research and technology used to create the Gemini models. They are text-to-text, decoder-only large language models, available in English, with open weights for both pre-trained variants and instruction-tuned variants. This release introduces the 2.6B parameter version of Gemma 2 (base and instruction-tuned), complementing the existing 9B and 27B variants.
Gemma 2 2B shares the same architecture as the other models in the Gemma 2 family, and therefore leverages technical features like sliding attention and logit soft-capping. You can check more details in this section of our previous blog post. Like in the other Gemma 2 models, we recommend you use bfloat16 for inference.
Use with Transformers
With Transformers, you can use Gemma and leverage all the tools within the Hugging Face ecosystem. To use Gemma models with transformers, make sure to use transformers from main for the latest fixes and optimizations:
pip install git+https://github.com/huggingface/transformers.git --upgrade
You can then use gemma-2-2b-it with transformers as follows:
Ahoy, matey! I be Gemma, a digital scallywag, a language-slingin' parrot of the digital seas. I be here to help ye with yer wordy woes, answer yer questions, and spin ye yarns of the digital world. So, what be yer pleasure, eh? 🦜
Use with llama.cpp
Step 1: Install llama.cpp
brew install llama.cpp
Here’s a list of some example safety principles you may wish to incorporate into your workflow:Original source
This story was published by Hugging Face Blog. SyncAI.news shows a preview; the complete article is on the publisher's site.
Read the full story on huggingface.co


