Commit
•
4e6224a
1
Parent(s):
f90d29b
Upload folder using huggingface_hub
Browse files- .gitattributes +5 -35
- README.md +506 -0
- gemma-7b-it-Q3_K_L.gguf +3 -0
- gemma-7b-it-Q4_K_M.gguf +3 -0
- gemma-7b-it-Q5_K_M.gguf +3 -0
- gemma-7b-it-Q6_K.gguf +3 -0
- gemma-7b-it-Q8_0.gguf +3 -0
.gitattributes
CHANGED
@@ -1,35 +1,5 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
-
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
-
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
-
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
-
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
-
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
-
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
-
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
-
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
-
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
-
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
-
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
-
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
-
*.tar filter=lfs diff=lfs merge=lfs -text
|
29 |
-
*.tflite filter=lfs diff=lfs merge=lfs -text
|
30 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
31 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
32 |
-
*.xz filter=lfs diff=lfs merge=lfs -text
|
33 |
-
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
-
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
1 |
+
gemma-7b-it-Q3_K_L.gguf filter=lfs diff=lfs merge=lfs -text
|
2 |
+
gemma-7b-it-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
3 |
+
gemma-7b-it-Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
4 |
+
gemma-7b-it-Q6_K.gguf filter=lfs diff=lfs merge=lfs -text
|
5 |
+
gemma-7b-it-Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
ADDED
@@ -0,0 +1,506 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
library_name: transformers
|
3 |
+
tags: []
|
4 |
+
widget:
|
5 |
+
- text: |
|
6 |
+
<start_of_turn>user
|
7 |
+
How does the brain work?<end_of_turn>
|
8 |
+
<start_of_turn>model
|
9 |
+
inference:
|
10 |
+
parameters:
|
11 |
+
max_new_tokens: 200
|
12 |
+
extra_gated_heading: "Access Gemma on Hugging Face"
|
13 |
+
extra_gated_prompt: "To access Gemma on Hugging Face, you’re required to review and agree to Google’s usage license. To do this, please ensure you’re logged-in to Hugging Face and click below. Requests are processed immediately."
|
14 |
+
extra_gated_button_content: "Acknowledge license"
|
15 |
+
license: other
|
16 |
+
license_name: gemma-terms-of-use
|
17 |
+
license_link: https://ai.google.dev/gemma/terms
|
18 |
+
---
|
19 |
+
|
20 |
+
# Gemma Model Card
|
21 |
+
|
22 |
+
**Model Page**: [Gemma](https://ai.google.dev/gemma/docs)
|
23 |
+
|
24 |
+
This model card corresponds to the 7B instruct version of the Gemma model. You can also visit the model card of the [2B base model](https://huggingface.co/google/gemma-2b), [7B base model](https://huggingface.co/google/gemma-7b), and [2B instruct model](https://huggingface.co/google/gemma-2b-it).
|
25 |
+
|
26 |
+
**Resources and Technical Documentation**:
|
27 |
+
|
28 |
+
* [Responsible Generative AI Toolkit](https://ai.google.dev/responsible)
|
29 |
+
* [Gemma on Kaggle](https://www.kaggle.com/models/google/gemma)
|
30 |
+
* [Gemma on Vertex Model Garden](https://console.cloud.google.com/vertex-ai/publishers/google/model-garden/335?version=gemma-7b-it-gg-hf)
|
31 |
+
|
32 |
+
**Terms of Use**: [Terms](https://www.kaggle.com/models/google/gemma/license/consent)
|
33 |
+
|
34 |
+
**Authors**: Google
|
35 |
+
|
36 |
+
## Model Information
|
37 |
+
|
38 |
+
Summary description and brief definition of inputs and outputs.
|
39 |
+
|
40 |
+
### Description
|
41 |
+
|
42 |
+
Gemma is a family of lightweight, state-of-the-art open models from Google,
|
43 |
+
built from the same research and technology used to create the Gemini models.
|
44 |
+
They are text-to-text, decoder-only large language models, available in English,
|
45 |
+
with open weights, pre-trained variants, and instruction-tuned variants. Gemma
|
46 |
+
models are well-suited for a variety of text generation tasks, including
|
47 |
+
question answering, summarization, and reasoning. Their relatively small size
|
48 |
+
makes it possible to deploy them in environments with limited resources such as
|
49 |
+
a laptop, desktop or your own cloud infrastructure, democratizing access to
|
50 |
+
state of the art AI models and helping foster innovation for everyone.
|
51 |
+
|
52 |
+
### Usage
|
53 |
+
|
54 |
+
Below we share some code snippets on how to get quickly started with running the model. First make sure to `pip install -U transformers`, then copy the snippet from the section that is relevant for your usecase.
|
55 |
+
|
56 |
+
#### Fine-tuning the model
|
57 |
+
|
58 |
+
You can find fine-tuning scripts and notebook under the [`examples/` directory](https://huggingface.co/google/gemma-7b/tree/main/examples) of [`google/gemma-7b`](https://huggingface.co/google/gemma-7b) repository. To adapt it to this model, simply change the model-id to `google/gemma-7b-it`.
|
59 |
+
In that repository, we provide:
|
60 |
+
|
61 |
+
* A script to perform Supervised Fine-Tuning (SFT) on UltraChat dataset using QLoRA
|
62 |
+
* A script to perform SFT using FSDP on TPU devices
|
63 |
+
* A notebook that you can run on a free-tier Google Colab instance to perform SFT on English quotes dataset
|
64 |
+
|
65 |
+
|
66 |
+
#### Running the model on a CPU
|
67 |
+
|
68 |
+
|
69 |
+
```python
|
70 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
71 |
+
|
72 |
+
tokenizer = AutoTokenizer.from_pretrained("google/gemma-7b-it")
|
73 |
+
model = AutoModelForCausalLM.from_pretrained("google/gemma-7b-it")
|
74 |
+
|
75 |
+
input_text = "Write me a poem about Machine Learning."
|
76 |
+
input_ids = tokenizer(input_text, return_tensors="pt")
|
77 |
+
|
78 |
+
outputs = model.generate(**input_ids)
|
79 |
+
print(tokenizer.decode(outputs[0]))
|
80 |
+
```
|
81 |
+
|
82 |
+
|
83 |
+
#### Running the model on a single / multi GPU
|
84 |
+
|
85 |
+
|
86 |
+
```python
|
87 |
+
# pip install accelerate
|
88 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
89 |
+
|
90 |
+
tokenizer = AutoTokenizer.from_pretrained("google/gemma-7b-it")
|
91 |
+
model = AutoModelForCausalLM.from_pretrained("google/gemma-7b-it", device_map="auto")
|
92 |
+
|
93 |
+
input_text = "Write me a poem about Machine Learning."
|
94 |
+
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
|
95 |
+
|
96 |
+
outputs = model.generate(**input_ids)
|
97 |
+
print(tokenizer.decode(outputs[0]))
|
98 |
+
```
|
99 |
+
|
100 |
+
|
101 |
+
#### Running the model on a GPU using different precisions
|
102 |
+
|
103 |
+
* _Using `torch.float16`_
|
104 |
+
|
105 |
+
```python
|
106 |
+
# pip install accelerate
|
107 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
108 |
+
|
109 |
+
tokenizer = AutoTokenizer.from_pretrained("google/gemma-7b-it")
|
110 |
+
model = AutoModelForCausalLM.from_pretrained("google/gemma-7b-it", device_map="auto", torch_dtype=torch.float16)
|
111 |
+
|
112 |
+
input_text = "Write me a poem about Machine Learning."
|
113 |
+
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
|
114 |
+
|
115 |
+
outputs = model.generate(**input_ids)
|
116 |
+
print(tokenizer.decode(outputs[0]))
|
117 |
+
```
|
118 |
+
|
119 |
+
* _Using `torch.bfloat16`_
|
120 |
+
|
121 |
+
```python
|
122 |
+
# pip install accelerate
|
123 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
124 |
+
|
125 |
+
tokenizer = AutoTokenizer.from_pretrained("google/gemma-7b-it")
|
126 |
+
model = AutoModelForCausalLM.from_pretrained("google/gemma-7b-it", device_map="auto", torch_dtype=torch.bfloat16)
|
127 |
+
|
128 |
+
input_text = "Write me a poem about Machine Learning."
|
129 |
+
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
|
130 |
+
|
131 |
+
outputs = model.generate(**input_ids)
|
132 |
+
print(tokenizer.decode(outputs[0]))
|
133 |
+
```
|
134 |
+
|
135 |
+
#### Quantized Versions through `bitsandbytes`
|
136 |
+
|
137 |
+
* _Using 8-bit precision (int8)_
|
138 |
+
|
139 |
+
```python
|
140 |
+
# pip install bitsandbytes accelerate
|
141 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
|
142 |
+
|
143 |
+
quantization_config = BitsAndBytesConfig(load_in_8bit=True)
|
144 |
+
|
145 |
+
tokenizer = AutoTokenizer.from_pretrained("google/gemma-7b-it")
|
146 |
+
model = AutoModelForCausalLM.from_pretrained("google/gemma-7b-it", quantization_config=quantization_config)
|
147 |
+
|
148 |
+
input_text = "Write me a poem about Machine Learning."
|
149 |
+
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
|
150 |
+
|
151 |
+
outputs = model.generate(**input_ids)
|
152 |
+
print(tokenizer.decode(outputs[0]))
|
153 |
+
```
|
154 |
+
|
155 |
+
* _Using 4-bit precision_
|
156 |
+
|
157 |
+
```python
|
158 |
+
# pip install bitsandbytes accelerate
|
159 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
|
160 |
+
|
161 |
+
quantization_config = BitsAndBytesConfig(load_in_4bit=True)
|
162 |
+
|
163 |
+
tokenizer = AutoTokenizer.from_pretrained("google/gemma-7b-it")
|
164 |
+
model = AutoModelForCausalLM.from_pretrained("google/gemma-7b-it", quantization_config=quantization_config)
|
165 |
+
|
166 |
+
input_text = "Write me a poem about Machine Learning."
|
167 |
+
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
|
168 |
+
|
169 |
+
outputs = model.generate(**input_ids)
|
170 |
+
print(tokenizer.decode(outputs[0]))
|
171 |
+
```
|
172 |
+
|
173 |
+
|
174 |
+
#### Other optimizations
|
175 |
+
|
176 |
+
* _Flash Attention 2_
|
177 |
+
|
178 |
+
First make sure to install `flash-attn` in your environment `pip install flash-attn`
|
179 |
+
|
180 |
+
```diff
|
181 |
+
model = AutoModelForCausalLM.from_pretrained(
|
182 |
+
model_id,
|
183 |
+
torch_dtype=torch.float16,
|
184 |
+
+ attn_implementation="flash_attention_2"
|
185 |
+
).to(0)
|
186 |
+
```
|
187 |
+
|
188 |
+
### Chat Template
|
189 |
+
|
190 |
+
The instruction-tuned models use a chat template that must be adhered to for conversational use.
|
191 |
+
The easiest way to apply it is using the tokenizer's built-in chat template, as shown in the following snippet.
|
192 |
+
|
193 |
+
Let's load the model and apply the chat template to a conversation. In this example, we'll start with a single user interaction:
|
194 |
+
|
195 |
+
```py
|
196 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
197 |
+
import transformers
|
198 |
+
import torch
|
199 |
+
|
200 |
+
model_id = "gg-hf/gemma-7b-it"
|
201 |
+
dtype = torch.bfloat16
|
202 |
+
|
203 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
204 |
+
model = AutoModelForCausalLM.from_pretrained(
|
205 |
+
model_id,
|
206 |
+
device_map="cuda",
|
207 |
+
torch_dtype=dtype,
|
208 |
+
)
|
209 |
+
|
210 |
+
chat = [
|
211 |
+
{ "role": "user", "content": "Write a hello world program" },
|
212 |
+
]
|
213 |
+
prompt = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
|
214 |
+
```
|
215 |
+
|
216 |
+
At this point, the prompt contains the following text:
|
217 |
+
|
218 |
+
```
|
219 |
+
<start_of_turn>user
|
220 |
+
Write a hello world program<end_of_turn>
|
221 |
+
<start_of_turn>model
|
222 |
+
```
|
223 |
+
|
224 |
+
As you can see, each turn is preceeded by a `<start_of_turn>` delimiter and then the role of the entity
|
225 |
+
(either `user`, for content supplied by the user, or `model` for LLM responses). Turns finish with
|
226 |
+
the `<end_of_turn>` token.
|
227 |
+
|
228 |
+
You can follow this format to build the prompt manually, if you need to do it without the tokenizer's
|
229 |
+
chat template.
|
230 |
+
|
231 |
+
After the prompt is ready, generation can be performed like this:
|
232 |
+
|
233 |
+
```py
|
234 |
+
inputs = tokenizer.encode(prompt, add_special_tokens=True, return_tensors="pt")
|
235 |
+
outputs = model.generate(input_ids=inputs.to(model.device), max_new_tokens=150)
|
236 |
+
```
|
237 |
+
|
238 |
+
### Inputs and outputs
|
239 |
+
|
240 |
+
* **Input:** Text string, such as a question, a prompt, or a document to be
|
241 |
+
summarized.
|
242 |
+
* **Output:** Generated English-language text in response to the input, such
|
243 |
+
as an answer to a question, or a summary of a document.
|
244 |
+
|
245 |
+
## Model Data
|
246 |
+
|
247 |
+
Data used for model training and how the data was processed.
|
248 |
+
|
249 |
+
### Training Dataset
|
250 |
+
|
251 |
+
These models were trained on a dataset of text data that includes a wide variety
|
252 |
+
of sources, totaling 6 trillion tokens. Here are the key components:
|
253 |
+
|
254 |
+
* Web Documents: A diverse collection of web text ensures the model is exposed
|
255 |
+
to a broad range of linguistic styles, topics, and vocabulary. Primarily
|
256 |
+
English-language content.
|
257 |
+
* Code: Exposing the model to code helps it to learn the syntax and patterns of
|
258 |
+
programming languages, which improves its ability to generate code or
|
259 |
+
understand code-related questions.
|
260 |
+
* Mathematics: Training on mathematical text helps the model learn logical
|
261 |
+
reasoning, symbolic representation, and to address mathematical queries.
|
262 |
+
|
263 |
+
The combination of these diverse data sources is crucial for training a powerful
|
264 |
+
language model that can handle a wide variety of different tasks and text
|
265 |
+
formats.
|
266 |
+
|
267 |
+
### Data Preprocessing
|
268 |
+
|
269 |
+
Here are the key data cleaning and filtering methods applied to the training
|
270 |
+
data:
|
271 |
+
|
272 |
+
* CSAM Filtering: Rigorous CSAM (Child Sexual Abuse Material) filtering was
|
273 |
+
applied at multiple stages in the data preparation process to ensure the
|
274 |
+
exclusion of harmful and illegal content
|
275 |
+
* Sensitive Data Filtering: As part of making Gemma pre-trained models safe and
|
276 |
+
reliable, automated techniques were used to filter out certain personal
|
277 |
+
information and other sensitive data from training sets.
|
278 |
+
* Additional methods: Filtering based on content quality and safely in line with
|
279 |
+
[our policies](https://storage.googleapis.com/gweb-uniblog-publish-prod/documents/2023_Google_AI_Principles_Progress_Update.pdf#page=11).
|
280 |
+
|
281 |
+
## Implementation Information
|
282 |
+
|
283 |
+
Details about the model internals.
|
284 |
+
|
285 |
+
### Hardware
|
286 |
+
|
287 |
+
Gemma was trained using the latest generation of
|
288 |
+
[Tensor Processing Unit (TPU)](https://cloud.google.com/tpu/docs/intro-to-tpu) hardware (TPUv5e).
|
289 |
+
|
290 |
+
Training large language models requires significant computational power. TPUs,
|
291 |
+
designed specifically for matrix operations common in machine learning, offer
|
292 |
+
several advantages in this domain:
|
293 |
+
|
294 |
+
* Performance: TPUs are specifically designed to handle the massive computations
|
295 |
+
involved in training LLMs. They can speed up training considerably compared to
|
296 |
+
CPUs.
|
297 |
+
* Memory: TPUs often come with large amounts of high-bandwidth memory, allowing
|
298 |
+
for the handling of large models and batch sizes during training. This can
|
299 |
+
lead to better model quality.
|
300 |
+
* Scalability: TPU Pods (large clusters of TPUs) provide a scalable solution for
|
301 |
+
handling the growing complexity of large foundation models. You can distribute
|
302 |
+
training across multiple TPU devices for faster and more efficient processing.
|
303 |
+
* Cost-effectiveness: In many scenarios, TPUs can provide a more cost-effective
|
304 |
+
solution for training large models compared to CPU-based infrastructure,
|
305 |
+
especially when considering the time and resources saved due to faster
|
306 |
+
training.
|
307 |
+
* These advantages are aligned with
|
308 |
+
[Google's commitments to operate sustainably](https://sustainability.google/operating-sustainably/).
|
309 |
+
|
310 |
+
### Software
|
311 |
+
|
312 |
+
Training was done using [JAX](https://github.com/google/jax) and [ML Pathways](https://blog.google/technology/ai/introducing-pathways-next-generation-ai-architecture).
|
313 |
+
|
314 |
+
JAX allows researchers to take advantage of the latest generation of hardware,
|
315 |
+
including TPUs, for faster and more efficient training of large models.
|
316 |
+
|
317 |
+
ML Pathways is Google's latest effort to build artificially intelligent systems
|
318 |
+
capable of generalizing across multiple tasks. This is specially suitable for
|
319 |
+
[foundation models](https://ai.google/discover/foundation-models/), including large language models like
|
320 |
+
these ones.
|
321 |
+
|
322 |
+
Together, JAX and ML Pathways are used as described in the
|
323 |
+
[paper about the Gemini family of models](https://arxiv.org/abs/2312.11805); "the 'single
|
324 |
+
controller' programming model of Jax and Pathways allows a single Python
|
325 |
+
process to orchestrate the entire training run, dramatically simplifying the
|
326 |
+
development workflow."
|
327 |
+
|
328 |
+
## Evaluation
|
329 |
+
|
330 |
+
Model evaluation metrics and results.
|
331 |
+
|
332 |
+
### Benchmark Results
|
333 |
+
|
334 |
+
These models were evaluated against a large collection of different datasets and
|
335 |
+
metrics to cover different aspects of text generation:
|
336 |
+
|
337 |
+
| Benchmark | Metric | 2B Params | 7B Params |
|
338 |
+
| ------------------------------ | ------------- | ----------- | --------- |
|
339 |
+
| [MMLU](https://arxiv.org/abs/2009.03300) | 5-shot, top-1 | 42.3 | 64.3 |
|
340 |
+
| [HellaSwag](https://arxiv.org/abs/1905.07830) | 0-shot |71.4 | 81.2 |
|
341 |
+
| [PIQA](https://arxiv.org/abs/1911.11641) | 0-shot | 77.3 | 81.2 |
|
342 |
+
| [SocialIQA](https://arxiv.org/abs/1904.09728) | 0-shot | 59.7 | 51.8 |
|
343 |
+
| [BooIQ](https://arxiv.org/abs/1905.10044) | 0-shot | 69.4 | 83.2 |
|
344 |
+
| [WinoGrande](https://arxiv.org/abs/1907.10641) | partial score | 65.4 | 72.3 |
|
345 |
+
| [CommonsenseQA](https://arxiv.org/abs/1811.00937) | 7-shot | 65.3 | 71.3 |
|
346 |
+
| [OpenBookQA](https://arxiv.org/abs/1809.02789) | | 47.8 | 52.8 |
|
347 |
+
| [ARC-e](https://arxiv.org/abs/1911.01547) | | 73.2 | 81.5 |
|
348 |
+
| [ARC-c](https://arxiv.org/abs/1911.01547) | | 42.1 | 53.2 |
|
349 |
+
| [TriviaQA](https://arxiv.org/abs/1705.03551) | 5-shot | 53.2 | 63.4 |
|
350 |
+
| [Natural Questions](https://github.com/google-research-datasets/natural-questions) | 5-shot | - | 23 |
|
351 |
+
| [HumanEval](https://arxiv.org/abs/2107.03374) | pass@1 | 22.0 | 32.3 |
|
352 |
+
| [MBPP](https://arxiv.org/abs/2108.07732) | 3-shot | 29.2 | 44.4 |
|
353 |
+
| [GSM8K](https://arxiv.org/abs/2110.14168) | maj@1 | 17.7 | 46.4 |
|
354 |
+
| [MATH](https://arxiv.org/abs/2108.07732) | 4-shot | 11.8 | 24.3 |
|
355 |
+
| [AGIEval](https://arxiv.org/abs/2304.06364) | | 24.2 | 41.7 |
|
356 |
+
| [BIG-Bench](https://arxiv.org/abs/2206.04615) | | 35.2 | 55.1 |
|
357 |
+
| ------------------------------ | ------------- | ----------- | --------- |
|
358 |
+
| **Average** | | **54.0** | **56.4** |
|
359 |
+
|
360 |
+
## Ethics and Safety
|
361 |
+
|
362 |
+
Ethics and safety evaluation approach and results.
|
363 |
+
|
364 |
+
### Evaluation Approach
|
365 |
+
|
366 |
+
Our evaluation methods include structured evaluations and internal red-teaming
|
367 |
+
testing of relevant content policies. Red-teaming was conducted by a number of
|
368 |
+
different teams, each with different goals and human evaluation metrics. These
|
369 |
+
models were evaluated against a number of different categories relevant to
|
370 |
+
ethics and safety, including:
|
371 |
+
|
372 |
+
* Text-to-Text Content Safety: Human evaluation on prompts covering safety
|
373 |
+
policies including child sexual abuse and exploitation, harassment, violence
|
374 |
+
and gore, and hate speech.
|
375 |
+
* Text-to-Text Representational Harms: Benchmark against relevant academic
|
376 |
+
datasets such as [WinoBias](https://arxiv.org/abs/1804.06876) and [BBQ Dataset](https://arxiv.org/abs/2110.08193v2).
|
377 |
+
* Memorization: Automated evaluation of memorization of training data, including
|
378 |
+
the risk of personally identifiable information exposure.
|
379 |
+
* Large-scale harm: Tests for "dangerous capabilities," such as chemical,
|
380 |
+
biological, radiological, and nuclear (CBRN) risks.
|
381 |
+
|
382 |
+
### Evaluation Results
|
383 |
+
|
384 |
+
The results of ethics and safety evaluations are within acceptable thresholds
|
385 |
+
for meeting [internal policies](https://storage.googleapis.com/gweb-uniblog-publish-prod/documents/2023_Google_AI_Principles_Progress_Update.pdf#page=11) for categories such as child
|
386 |
+
safety, content safety, representational harms, memorization, large-scale harms.
|
387 |
+
On top of robust internal evaluations, the results of well known safety
|
388 |
+
benchmarks like BBQ, BOLD, Winogender, Winobias, RealToxicity, and TruthfulQA
|
389 |
+
are shown here.
|
390 |
+
|
391 |
+
| Benchmark | Metric | 2B Params | 7B Params |
|
392 |
+
| ------------------------------ | ------------- | ----------- | --------- |
|
393 |
+
| [RealToxicity](https://arxiv.org/abs/2009.11462) | average | 6.86 | 7.90 |
|
394 |
+
| [BOLD](https://arxiv.org/abs/2101.11718) | | 45.57 | 49.08 |
|
395 |
+
| [CrowS-Pairs](https://aclanthology.org/2020.emnlp-main.154/) | top-1 | 45.82 | 51.33 |
|
396 |
+
| [BBQ Ambig](https://arxiv.org/abs/2110.08193v2) | 1-shot, top-1 | 62.58 | 92.54 |
|
397 |
+
| [BBQ Disambig](https://arxiv.org/abs/2110.08193v2) | top-1 | 54.62 | 71.99 |
|
398 |
+
| [Winogender](https://arxiv.org/abs/1804.09301) | top-1 | 51.25 | 54.17 |
|
399 |
+
| [TruthfulQA](https://arxiv.org/abs/2109.07958) | | 44.84 | 31.81 |
|
400 |
+
| [Winobias 1_2](https://arxiv.org/abs/1804.06876) | | 56.12 | 59.09 |
|
401 |
+
| [Winobias 2_2](https://arxiv.org/abs/1804.06876) | | 91.10 | 92.23 |
|
402 |
+
| [Toxigen](https://arxiv.org/abs/2203.09509) | | 29.77 | 39.59 |
|
403 |
+
| ------------------------------ | ------------- | ----------- | --------- |
|
404 |
+
|
405 |
+
|
406 |
+
## Usage and Limitations
|
407 |
+
|
408 |
+
These models have certain limitations that users should be aware of.
|
409 |
+
|
410 |
+
### Intended Usage
|
411 |
+
|
412 |
+
Open Large Language Models (LLMs) have a wide range of applications across
|
413 |
+
various industries and domains. The following list of potential uses is not
|
414 |
+
comprehensive. The purpose of this list is to provide contextual information
|
415 |
+
about the possible use-cases that the model creators considered as part of model
|
416 |
+
training and development.
|
417 |
+
|
418 |
+
* Content Creation and Communication
|
419 |
+
* Text Generation: These models can be used to generate creative text formats
|
420 |
+
such as poems, scripts, code, marketing copy, and email drafts.
|
421 |
+
* Chatbots and Conversational AI: Power conversational interfaces for customer
|
422 |
+
service, virtual assistants, or interactive applications.
|
423 |
+
* Text Summarization: Generate concise summaries of a text corpus, research
|
424 |
+
papers, or reports.
|
425 |
+
* Research and Education
|
426 |
+
* Natural Language Processing (NLP) Research: These models can serve as a
|
427 |
+
foundation for researchers to experiment with NLP techniques, develop
|
428 |
+
algorithms, and contribute to the advancement of the field.
|
429 |
+
* Language Learning Tools: Support interactive language learning experiences,
|
430 |
+
aiding in grammar correction or providing writing practice.
|
431 |
+
* Knowledge Exploration: Assist researchers in exploring large bodies of text
|
432 |
+
by generating summaries or answering questions about specific topics.
|
433 |
+
|
434 |
+
### Limitations
|
435 |
+
|
436 |
+
* Training Data
|
437 |
+
* The quality and diversity of the training data significantly influence the
|
438 |
+
model's capabilities. Biases or gaps in the training data can lead to
|
439 |
+
limitations in the model's responses.
|
440 |
+
* The scope of the training dataset determines the subject areas the model can
|
441 |
+
handle effectively.
|
442 |
+
* Context and Task Complexity
|
443 |
+
* LLMs are better at tasks that can be framed with clear prompts and
|
444 |
+
instructions. Open-ended or highly complex tasks might be challenging.
|
445 |
+
* A model's performance can be influenced by the amount of context provided
|
446 |
+
(longer context generally leads to better outputs, up to a certain point).
|
447 |
+
* Language Ambiguity and Nuance
|
448 |
+
* Natural language is inherently complex. LLMs might struggle to grasp subtle
|
449 |
+
nuances, sarcasm, or figurative language.
|
450 |
+
* Factual Accuracy
|
451 |
+
* LLMs generate responses based on information they learned from their
|
452 |
+
training datasets, but they are not knowledge bases. They may generate
|
453 |
+
incorrect or outdated factual statements.
|
454 |
+
* Common Sense
|
455 |
+
* LLMs rely on statistical patterns in language. They might lack the ability
|
456 |
+
to apply common sense reasoning in certain situations.
|
457 |
+
|
458 |
+
### Ethical Considerations and Risks
|
459 |
+
|
460 |
+
The development of large language models (LLMs) raises several ethical concerns.
|
461 |
+
In creating an open model, we have carefully considered the following:
|
462 |
+
|
463 |
+
* Bias and Fairness
|
464 |
+
* LLMs trained on large-scale, real-world text data can reflect socio-cultural
|
465 |
+
biases embedded in the training material. These models underwent careful
|
466 |
+
scrutiny, input data pre-processing described and posterior evaluations
|
467 |
+
reported in this card.
|
468 |
+
* Misinformation and Misuse
|
469 |
+
* LLMs can be misused to generate text that is false, misleading, or harmful.
|
470 |
+
* Guidelines are provided for responsible use with the model, see the
|
471 |
+
[Responsible Generative AI Toolkit](http://ai.google.dev/gemma/responsible).
|
472 |
+
* Transparency and Accountability:
|
473 |
+
* This model card summarizes details on the models' architecture,
|
474 |
+
capabilities, limitations, and evaluation processes.
|
475 |
+
* A responsibly developed open model offers the opportunity to share
|
476 |
+
innovation by making LLM technology accessible to developers and researchers
|
477 |
+
across the AI ecosystem.
|
478 |
+
|
479 |
+
Risks identified and mitigations:
|
480 |
+
|
481 |
+
* Perpetuation of biases: It's encouraged to perform continuous monitoring
|
482 |
+
(using evaluation metrics, human review) and the exploration of de-biasing
|
483 |
+
techniques during model training, fine-tuning, and other use cases.
|
484 |
+
* Generation of harmful content: Mechanisms and guidelines for content safety
|
485 |
+
are essential. Developers are encouraged to exercise caution and implement
|
486 |
+
appropriate content safety safeguards based on their specific product policies
|
487 |
+
and application use cases.
|
488 |
+
* Misuse for malicious purposes: Technical limitations and developer and
|
489 |
+
end-user education can help mitigate against malicious applications of LLMs.
|
490 |
+
Educational resources and reporting mechanisms for users to flag misuse are
|
491 |
+
provided. Prohibited uses of Gemma models are outlined in the
|
492 |
+
[Gemma Prohibited Use Policy](https://ai.google.dev/gemma/prohibited_use_policy).
|
493 |
+
* Privacy violations: Models were trained on data filtered for removal of PII
|
494 |
+
(Personally Identifiable Information). Developers are encouraged to adhere to
|
495 |
+
privacy regulations with privacy-preserving techniques.
|
496 |
+
|
497 |
+
### Benefits
|
498 |
+
|
499 |
+
At the time of release, this family of models provides high-performance open
|
500 |
+
large language model implementations designed from the ground up for Responsible
|
501 |
+
AI development compared to similarly sized models.
|
502 |
+
|
503 |
+
Using the benchmark evaluation metrics described in this document, these models
|
504 |
+
have shown to provide superior performance to other, comparably-sized open model
|
505 |
+
alternatives.
|
506 |
+
|
gemma-7b-it-Q3_K_L.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:24d502df64ae27dc02e44567463184d9a00e433c02c73867dbe653d4dc3ed346
|
3 |
+
size 4402039968
|
gemma-7b-it-Q4_K_M.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bd87fc03fe3d651ac419ae35f4a0e6d861167db156572b6c4b90fb81822a3547
|
3 |
+
size 5127231648
|
gemma-7b-it-Q5_K_M.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:601ea5510042eb36434b85c024f8182350ed9b96b2efeee0157c8035a9042b79
|
3 |
+
size 6040328352
|
gemma-7b-it-Q6_K.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:06c44fb30feac4c7d681baf4c68e9d2df45fe624ce22f3a9bad45a8de711dd32
|
3 |
+
size 7010493600
|
gemma-7b-it-Q8_0.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6daf2627518df1d55e8d8c8ca874909cb4f69f4ab863bffc7a0bb7636509bbb6
|
3 |
+
size 9078266016
|