Transformers
Inference Endpoints
jncraton commited on
Commit
89382b5
1 Parent(s): 264fdfa

Upload folder using huggingface_hub

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