BenevolenceMessiah commited on
Commit
2a5b56d
1 Parent(s): dae0c11

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +34 -486
README.md CHANGED
@@ -1,511 +1,59 @@
1
  ---
2
- license: gemma
3
  library_name: transformers
 
4
  pipeline_tag: text-generation
 
 
 
 
5
  extra_gated_heading: Access Gemma on Hugging Face
6
- extra_gated_prompt: >-
7
- To access Gemma on Hugging Face, you’re required to review and agree to
8
- Google’s usage license. To do this, please ensure you’re logged in to Hugging
9
  Face and click below. Requests are processed immediately.
10
  extra_gated_button_content: Acknowledge license
11
  ---
12
 
 
 
 
13
 
14
- # Gemma 2 model card
15
-
16
- **Model Page**: [Gemma](https://ai.google.dev/gemma/docs)
17
-
18
- **Resources and Technical Documentation**:
19
-
20
- * [Responsible Generative AI Toolkit][rai-toolkit]
21
- * [Gemma on Kaggle][kaggle-gemma]
22
- * [Gemma on Vertex Model Garden][vertex-mg-gemma]
23
-
24
- **Terms of Use**: [Terms](https://www.kaggle.com/models/google/gemma/license/consent/verify/huggingface?returnModelRepoId=google/gemma-2-9b)
25
-
26
- **Authors**: Google
27
-
28
- ## Model Information
29
-
30
- Summary description and brief definition of inputs and outputs.
31
-
32
- ### Description
33
-
34
- Gemma is a family of lightweight, state-of-the-art open models from Google,
35
- built from the same research and technology used to create the Gemini models.
36
- They are text-to-text, decoder-only large language models, available in English,
37
- with open weights for both pre-trained variants and instruction-tuned variants.
38
- Gemma models are well-suited for a variety of text generation tasks, including
39
- question answering, summarization, and reasoning. Their relatively small size
40
- makes it possible to deploy them in environments with limited resources such as
41
- a laptop, desktop or your own cloud infrastructure, democratizing access to
42
- state of the art AI models and helping foster innovation for everyone.
43
-
44
- ### Usage
45
-
46
- 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.
47
-
48
 
49
- #### Running the model on a single / multi GPU
 
50
 
51
-
52
- ```python
53
- # pip install accelerate
54
- from transformers import AutoTokenizer, AutoModelForCausalLM
55
- import torch
56
-
57
- tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-9b")
58
- model = AutoModelForCausalLM.from_pretrained(
59
- "google/gemma-2-9b",
60
- device_map="auto",
61
- torch_dtype=torch.bfloat16
62
- )
63
-
64
- input_text = "Write me a poem about Machine Learning."
65
- input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
66
-
67
- outputs = model.generate(**input_ids)
68
- print(tokenizer.decode(outputs[0]))
69
  ```
 
70
 
71
- <a name="precisions"></a>
72
- #### Running the model on a GPU using different precisions
73
-
74
- The native weights of this model were exported in `bfloat16` precision. You can use `float16`, which may be faster on certain hardware, indicating the `torch_dtype` when loading the model. For convenience, the `float16` revision of the repo contains a copy of the weights already converted to that precision.
75
-
76
- You can also use `float32` if you skip the dtype, but no precision increase will occur (model weights will just be upcasted to `float32`). See examples below.
77
-
78
- * _Using `torch.float16`_
79
-
80
- ```python
81
- # pip install accelerate
82
- from transformers import AutoTokenizer, AutoModelForCausalLM
83
- import torch
84
-
85
- tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-9b")
86
- model = AutoModelForCausalLM.from_pretrained(
87
- "google/gemma-2-9b",
88
- device_map="auto",
89
- torch_dtype=torch.float16,
90
- revision="float16",
91
- )
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
- * _Using `torch.bfloat16`_
101
-
102
- ```python
103
- # pip install accelerate
104
- from transformers import AutoTokenizer, AutoModelForCausalLM
105
-
106
- tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-9b")
107
- model = AutoModelForCausalLM.from_pretrained(
108
- "google/gemma-2-9b",
109
- device_map="auto",
110
- torch_dtype=torch.bfloat16)
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
- * _Upcasting to `torch.float32`_
120
-
121
- ```python
122
- # pip install accelerate
123
- from transformers import AutoTokenizer, AutoModelForCausalLM
124
-
125
- tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-9b")
126
- model = AutoModelForCausalLM.from_pretrained(
127
- "google/gemma-2-9b",
128
- device_map="auto")
129
 
130
- input_text = "Write me a poem about Machine Learning."
131
- input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
132
-
133
- outputs = model.generate(**input_ids)
134
- print(tokenizer.decode(outputs[0]))
135
  ```
136
-
137
- #### Quantized Versions through `bitsandbytes`
138
-
139
- * _Using 8-bit precision (int8)_
140
-
141
- ```python
142
- # pip install bitsandbytes accelerate
143
- from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
144
-
145
- quantization_config = BitsAndBytesConfig(load_in_8bit=True)
146
-
147
- tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-9b")
148
- model = AutoModelForCausalLM.from_pretrained(
149
- "google/gemma-2-9b",
150
- quantization_config=quantization_config)
151
-
152
- input_text = "Write me a poem about Machine Learning."
153
- input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
154
-
155
- outputs = model.generate(**input_ids)
156
- print(tokenizer.decode(outputs[0]))
157
  ```
158
 
159
- * _Using 4-bit precision_
160
-
161
- ```python
162
- # pip install bitsandbytes accelerate
163
- from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
164
-
165
- quantization_config = BitsAndBytesConfig(load_in_4bit=True)
166
-
167
- tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-9b")
168
- model = AutoModelForCausalLM.from_pretrained(
169
- "google/gemma-2-9b",
170
- quantization_config=quantization_config)
171
-
172
- input_text = "Write me a poem about Machine Learning."
173
- input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
174
-
175
- outputs = model.generate(**input_ids)
176
- print(tokenizer.decode(outputs[0]))
177
  ```
178
-
179
-
180
- #### Other optimizations
181
-
182
- * _Flash Attention 2_
183
-
184
- First make sure to install `flash-attn` in your environment `pip install flash-attn`
185
-
186
- ```diff
187
- model = AutoModelForCausalLM.from_pretrained(
188
- model_id,
189
- torch_dtype=torch.float16,
190
- + attn_implementation="flash_attention_2"
191
- ).to(0)
192
  ```
193
 
194
- ### Inputs and outputs
195
-
196
- * **Input:** Text string, such as a question, a prompt, or a document to be
197
- summarized.
198
- * **Output:** Generated English-language text in response to the input, such
199
- as an answer to a question, or a summary of a document.
200
-
201
- ### Citation
202
-
203
- ```none
204
- @article{gemma_2024,
205
- title={Gemma},
206
- url={https://www.kaggle.com/m/3301},
207
- DOI={10.34740/KAGGLE/M/3301},
208
- publisher={Kaggle},
209
- author={Gemma Team},
210
- year={2024}
211
- }
212
  ```
213
-
214
- ## Model Data
215
-
216
- Data used for model training and how the data was processed.
217
-
218
- ### Training Dataset
219
-
220
- These models were trained on a dataset of text data that includes a wide variety of sources. The 27B model was trained with 13 trillion tokens and the 9B model was trained with 8 trillion tokens.
221
- Here are the key components:
222
-
223
- * Web Documents: A diverse collection of web text ensures the model is exposed
224
- to a broad range of linguistic styles, topics, and vocabulary. Primarily
225
- English-language content.
226
- * Code: Exposing the model to code helps it to learn the syntax and patterns of
227
- programming languages, which improves its ability to generate code or
228
- understand code-related questions.
229
- * Mathematics: Training on mathematical text helps the model learn logical
230
- reasoning, symbolic representation, and to address mathematical queries.
231
-
232
- The combination of these diverse data sources is crucial for training a powerful
233
- language model that can handle a wide variety of different tasks and text
234
- formats.
235
-
236
- ### Data Preprocessing
237
-
238
- Here are the key data cleaning and filtering methods applied to the training
239
- data:
240
-
241
- * CSAM Filtering: Rigorous CSAM (Child Sexual Abuse Material) filtering was
242
- applied at multiple stages in the data preparation process to ensure the
243
- exclusion of harmful and illegal content.
244
- * Sensitive Data Filtering: As part of making Gemma pre-trained models safe and
245
- reliable, automated techniques were used to filter out certain personal
246
- information and other sensitive data from training sets.
247
- * Additional methods: Filtering based on content quality and safety in line with
248
- [our policies][safety-policies].
249
-
250
- ## Implementation Information
251
-
252
- Details about the model internals.
253
-
254
- ### Hardware
255
-
256
- Gemma was trained using the latest generation of
257
- [Tensor Processing Unit (TPU)][tpu] hardware (TPUv5p).
258
-
259
- Training large language models requires significant computational power. TPUs,
260
- designed specifically for matrix operations common in machine learning, offer
261
- several advantages in this domain:
262
-
263
- * Performance: TPUs are specifically designed to handle the massive computations
264
- involved in training LLMs. They can speed up training considerably compared to
265
- CPUs.
266
- * Memory: TPUs often come with large amounts of high-bandwidth memory, allowing
267
- for the handling of large models and batch sizes during training. This can
268
- lead to better model quality.
269
- * Scalability: TPU Pods (large clusters of TPUs) provide a scalable solution for
270
- handling the growing complexity of large foundation models. You can distribute
271
- training across multiple TPU devices for faster and more efficient processing.
272
- * Cost-effectiveness: In many scenarios, TPUs can provide a more cost-effective
273
- solution for training large models compared to CPU-based infrastructure,
274
- especially when considering the time and resources saved due to faster
275
- training.
276
- * These advantages are aligned with
277
- [Google's commitments to operate sustainably][sustainability].
278
-
279
- ### Software
280
-
281
- Training was done using [JAX][jax] and [ML Pathways][ml-pathways].
282
-
283
- JAX allows researchers to take advantage of the latest generation of hardware,
284
- including TPUs, for faster and more efficient training of large models.
285
-
286
- ML Pathways is Google's latest effort to build artificially intelligent systems
287
- capable of generalizing across multiple tasks. This is specially suitable for
288
- [foundation models][foundation-models], including large language models like
289
- these ones.
290
-
291
- Together, JAX and ML Pathways are used as described in the
292
- [paper about the Gemini family of models][gemini-2-paper]; "the 'single
293
- controller' programming model of Jax and Pathways allows a single Python
294
- process to orchestrate the entire training run, dramatically simplifying the
295
- development workflow."
296
-
297
- ## Evaluation
298
-
299
- Model evaluation metrics and results.
300
-
301
- ### Benchmark Results
302
-
303
- These models were evaluated against a large collection of different datasets and
304
- metrics to cover different aspects of text generation:
305
-
306
- | Benchmark | Metric | Gemma PT 9B | Gemma PT 27B |
307
- | ------------------------------ | ------------- | ----------- | ------------ |
308
- | [MMLU][mmlu] | 5-shot, top-1 | 71.3 | 75.2 |
309
- | [HellaSwag][hellaswag] | 10-shot | 81.9 | 86.4 |
310
- | [PIQA][piqa] | 0-shot | 81.7 | 83.2 |
311
- | [SocialIQA][socialiqa] | 0-shot | 53.4 | 53.7 |
312
- | [BoolQ][boolq] | 0-shot | 84.2 | 84.8 |
313
- | [WinoGrande][winogrande] | partial score | 80.6 | 83.7 |
314
- | [ARC-e][arc] | 0-shot | 88.0 | 88.6 |
315
- | [ARC-c][arc] | 25-shot | 68.4 | 71.4 |
316
- | [TriviaQA][triviaqa] | 5-shot | 76.6 | 83.7 |
317
- | [Natural Questions][naturalq] | 5-shot | 29.2 | 34.5 |
318
- | [HumanEval][humaneval] | pass@1 | 40.2 | 51.8 |
319
- | [MBPP][mbpp] | 3-shot | 52.4 | 62.6 |
320
- | [GSM8K][gsm8k] | 5-shot, maj@1 | 68.6 | 74.0 |
321
- | [MATH][math] | 4-shot | 36.6 | 42.3 |
322
- | [AGIEval][agieval] | 3-5-shot | 52.8 | 55.1 |
323
- | [BIG-Bench][big-bench] | 3-shot, CoT | 68.2 | 74.9 |
324
- | ------------------------------ | ------------- | ----------- | ------------ |
325
-
326
- ## Ethics and Safety
327
-
328
- Ethics and safety evaluation approach and results.
329
-
330
- ### Evaluation Approach
331
-
332
- Our evaluation methods include structured evaluations and internal red-teaming
333
- testing of relevant content policies. Red-teaming was conducted by a number of
334
- different teams, each with different goals and human evaluation metrics. These
335
- models were evaluated against a number of different categories relevant to
336
- ethics and safety, including:
337
-
338
- * Text-to-Text Content Safety: Human evaluation on prompts covering safety
339
- policies including child sexual abuse and exploitation, harassment, violence
340
- and gore, and hate speech.
341
- * Text-to-Text Representational Harms: Benchmark against relevant academic
342
- datasets such as [WinoBias][winobias] and [BBQ Dataset][bbq].
343
- * Memorization: Automated evaluation of memorization of training data, including
344
- the risk of personally identifiable information exposure.
345
- * Large-scale harm: Tests for "dangerous capabilities," such as chemical,
346
- biological, radiological, and nuclear (CBRN) risks.
347
-
348
- ### Evaluation Results
349
-
350
- The results of ethics and safety evaluations are within acceptable thresholds
351
- for meeting [internal policies][safety-policies] for categories such as child
352
- safety, content safety, representational harms, memorization, large-scale harms.
353
- On top of robust internal evaluations, the results of well-known safety
354
- benchmarks like BBQ, BOLD, Winogender, Winobias, RealToxicity, and TruthfulQA
355
- are shown here.
356
-
357
- #### Gemma 2.0
358
-
359
- | Benchmark | Metric | Gemma 2 IT 9B | Gemma 2 IT 27B |
360
- | ------------------------ | ------------- | --------------- | ---------------- |
361
- | [RealToxicity][realtox] | average | 8.25 | 8.84 |
362
- | [CrowS-Pairs][crows] | top-1 | 37.47 | 36.67 |
363
- | [BBQ Ambig][bbq] | 1-shot, top-1 | 88.58 | 85.99 |
364
- | [BBQ Disambig][bbq] | top-1 | 82.67 | 86.94 |
365
- | [Winogender][winogender] | top-1 | 79.17 | 77.22 |
366
- | [TruthfulQA][truthfulqa] | | 50.27 | 51.60 |
367
- | [Winobias 1_2][winobias] | | 78.09 | 81.94 |
368
- | [Winobias 2_2][winobias] | | 95.32 | 97.22 |
369
- | [Toxigen][toxigen] | | 39.30 | 38.42 |
370
- | ------------------------ | ------------- | --------------- | ---------------- |
371
-
372
- ## Usage and Limitations
373
-
374
- These models have certain limitations that users should be aware of.
375
-
376
- ### Intended Usage
377
-
378
- Open Large Language Models (LLMs) have a wide range of applications across
379
- various industries and domains. The following list of potential uses is not
380
- comprehensive. The purpose of this list is to provide contextual information
381
- about the possible use-cases that the model creators considered as part of model
382
- training and development.
383
-
384
- * Content Creation and Communication
385
- * Text Generation: These models can be used to generate creative text formats
386
- such as poems, scripts, code, marketing copy, and email drafts.
387
- * Chatbots and Conversational AI: Power conversational interfaces for customer
388
- service, virtual assistants, or interactive applications.
389
- * Text Summarization: Generate concise summaries of a text corpus, research
390
- papers, or reports.
391
- * Research and Education
392
- * Natural Language Processing (NLP) Research: These models can serve as a
393
- foundation for researchers to experiment with NLP techniques, develop
394
- algorithms, and contribute to the advancement of the field.
395
- * Language Learning Tools: Support interactive language learning experiences,
396
- aiding in grammar correction or providing writing practice.
397
- * Knowledge Exploration: Assist researchers in exploring large bodies of text
398
- by generating summaries or answering questions about specific topics.
399
-
400
- ### Limitations
401
-
402
- * Training Data
403
- * The quality and diversity of the training data significantly influence the
404
- model's capabilities. Biases or gaps in the training data can lead to
405
- limitations in the model's responses.
406
- * The scope of the training dataset determines the subject areas the model can
407
- handle effectively.
408
- * Context and Task Complexity
409
- * LLMs are better at tasks that can be framed with clear prompts and
410
- instructions. Open-ended or highly complex tasks might be challenging.
411
- * A model's performance can be influenced by the amount of context provided
412
- (longer context generally leads to better outputs, up to a certain point).
413
- * Language Ambiguity and Nuance
414
- * Natural language is inherently complex. LLMs might struggle to grasp subtle
415
- nuances, sarcasm, or figurative language.
416
- * Factual Accuracy
417
- * LLMs generate responses based on information they learned from their
418
- training datasets, but they are not knowledge bases. They may generate
419
- incorrect or outdated factual statements.
420
- * Common Sense
421
- * LLMs rely on statistical patterns in language. They might lack the ability
422
- to apply common sense reasoning in certain situations.
423
-
424
- ### Ethical Considerations and Risks
425
-
426
- The development of large language models (LLMs) raises several ethical concerns.
427
- In creating an open model, we have carefully considered the following:
428
-
429
- * Bias and Fairness
430
- * LLMs trained on large-scale, real-world text data can reflect socio-cultural
431
- biases embedded in the training material. These models underwent careful
432
- scrutiny, input data pre-processing described and posterior evaluations
433
- reported in this card.
434
- * Misinformation and Misuse
435
- * LLMs can be misused to generate text that is false, misleading, or harmful.
436
- * Guidelines are provided for responsible use with the model, see the
437
- [Responsible Generative AI Toolkit][rai-toolkit].
438
- * Transparency and Accountability:
439
- * This model card summarizes details on the models' architecture,
440
- capabilities, limitations, and evaluation processes.
441
- * A responsibly developed open model offers the opportunity to share
442
- innovation by making LLM technology accessible to developers and researchers
443
- across the AI ecosystem.
444
-
445
- Risks identified and mitigations:
446
-
447
- * Perpetuation of biases: It's encouraged to perform continuous monitoring
448
- (using evaluation metrics, human review) and the exploration of de-biasing
449
- techniques during model training, fine-tuning, and other use cases.
450
- * Generation of harmful content: Mechanisms and guidelines for content safety
451
- are essential. Developers are encouraged to exercise caution and implement
452
- appropriate content safety safeguards based on their specific product policies
453
- and application use cases.
454
- * Misuse for malicious purposes: Technical limitations and developer and
455
- end-user education can help mitigate against malicious applications of LLMs.
456
- Educational resources and reporting mechanisms for users to flag misuse are
457
- provided. Prohibited uses of Gemma models are outlined in the
458
- [Gemma Prohibited Use Policy][prohibited-use].
459
- * Privacy violations: Models were trained on data filtered for removal of PII
460
- (Personally Identifiable Information). Developers are encouraged to adhere to
461
- privacy regulations with privacy-preserving techniques.
462
-
463
- ### Benefits
464
-
465
- At the time of release, this family of models provides high-performance open
466
- large language model implementations designed from the ground up for Responsible
467
- AI development compared to similarly sized models.
468
-
469
- Using the benchmark evaluation metrics described in this document, these models
470
- have shown to provide superior performance to other, comparably-sized open model
471
- alternatives.
472
-
473
- [rai-toolkit]: https://ai.google.dev/responsible
474
- [kaggle-gemma]: https://www.kaggle.com/models/google/gemma-2
475
- [terms]: https://ai.google.dev/gemma/terms
476
- [vertex-mg-gemma]: https://console.cloud.google.com/vertex-ai/publishers/google/model-garden/335
477
- [sensitive-info]: https://cloud.google.com/dlp/docs/high-sensitivity-infotypes-reference
478
- [safety-policies]: https://storage.googleapis.com/gweb-uniblog-publish-prod/documents/2023_Google_AI_Principles_Progress_Update.pdf#page=11
479
- [prohibited-use]: https://ai.google.dev/gemma/prohibited_use_policy
480
- [tpu]: https://cloud.google.com/tpu/docs/intro-to-tpu
481
- [sustainability]: https://sustainability.google/operating-sustainably/
482
- [jax]: https://github.com/google/jax
483
- [ml-pathways]: https://blog.google/technology/ai/introducing-pathways-next-generation-ai-architecture/
484
- [sustainability]: https://sustainability.google/operating-sustainably/
485
- [foundation-models]: https://ai.google/discover/foundation-models/
486
- [gemini-2-paper]: https://goo.gle/gemma2report
487
- [mmlu]: https://arxiv.org/abs/2009.03300
488
- [hellaswag]: https://arxiv.org/abs/1905.07830
489
- [piqa]: https://arxiv.org/abs/1911.11641
490
- [socialiqa]: https://arxiv.org/abs/1904.09728
491
- [boolq]: https://arxiv.org/abs/1905.10044
492
- [winogrande]: https://arxiv.org/abs/1907.10641
493
- [commonsenseqa]: https://arxiv.org/abs/1811.00937
494
- [openbookqa]: https://arxiv.org/abs/1809.02789
495
- [arc]: https://arxiv.org/abs/1911.01547
496
- [triviaqa]: https://arxiv.org/abs/1705.03551
497
- [naturalq]: https://github.com/google-research-datasets/natural-questions
498
- [humaneval]: https://arxiv.org/abs/2107.03374
499
- [mbpp]: https://arxiv.org/abs/2108.07732
500
- [gsm8k]: https://arxiv.org/abs/2110.14168
501
- [realtox]: https://arxiv.org/abs/2009.11462
502
- [bold]: https://arxiv.org/abs/2101.11718
503
- [crows]: https://aclanthology.org/2020.emnlp-main.154/
504
- [bbq]: https://arxiv.org/abs/2110.08193v2
505
- [winogender]: https://arxiv.org/abs/1804.09301
506
- [truthfulqa]: https://arxiv.org/abs/2109.07958
507
- [winobias]: https://arxiv.org/abs/1804.06876
508
- [math]: https://arxiv.org/abs/2103.03874
509
- [agieval]: https://arxiv.org/abs/2304.06364
510
- [big-bench]: https://arxiv.org/abs/2206.04615
511
- [toxigen]: https://arxiv.org/abs/2203.09509
 
1
  ---
2
+ base_model: google/gemma-2-9b-it
3
  library_name: transformers
4
+ license: gemma
5
  pipeline_tag: text-generation
6
+ tags:
7
+ - conversational
8
+ - llama-cpp
9
+ - gguf-my-repo
10
  extra_gated_heading: Access Gemma on Hugging Face
11
+ extra_gated_prompt: To access Gemma on Hugging Face, you’re required to review and
12
+ agree to Google’s usage license. To do this, please ensure you’re logged in to Hugging
 
13
  Face and click below. Requests are processed immediately.
14
  extra_gated_button_content: Acknowledge license
15
  ---
16
 
17
+ # BenevolenceMessiah/gemma-2-9b-it-Q8_0-GGUF
18
+ This model was converted to GGUF format from [`google/gemma-2-9b-it`](https://huggingface.co/google/gemma-2-9b-it) using llama.cpp via the ggml.ai's [GGUF-my-repo](https://huggingface.co/spaces/ggml-org/gguf-my-repo) space.
19
+ Refer to the [original model card](https://huggingface.co/google/gemma-2-9b-it) for more details on the model.
20
 
21
+ ## Use with llama.cpp
22
+ Install llama.cpp through brew (works on Mac and Linux)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
+ ```bash
25
+ brew install llama.cpp
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  ```
28
+ Invoke the llama.cpp server or the CLI.
29
 
30
+ ### CLI:
31
+ ```bash
32
+ llama-cli --hf-repo BenevolenceMessiah/gemma-2-9b-it-Q8_0-GGUF --hf-file gemma-2-9b-it-q8_0.gguf -p "The meaning to life and the universe is"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  ```
34
 
35
+ ### Server:
36
+ ```bash
37
+ llama-server --hf-repo BenevolenceMessiah/gemma-2-9b-it-Q8_0-GGUF --hf-file gemma-2-9b-it-q8_0.gguf -c 2048
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  ```
39
 
40
+ Note: You can also use this checkpoint directly through the [usage steps](https://github.com/ggerganov/llama.cpp?tab=readme-ov-file#usage) listed in the Llama.cpp repo as well.
 
 
 
 
 
 
 
 
 
41
 
42
+ Step 1: Clone llama.cpp from GitHub.
 
 
 
 
43
  ```
44
+ git clone https://github.com/ggerganov/llama.cpp
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  ```
46
 
47
+ Step 2: Move into the llama.cpp folder and build it with `LLAMA_CURL=1` flag along with other hardware-specific flags (for ex: LLAMA_CUDA=1 for Nvidia GPUs on Linux).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  ```
49
+ cd llama.cpp && LLAMA_CURL=1 make
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  ```
51
 
52
+ Step 3: Run inference through the main binary.
53
+ ```
54
+ ./llama-cli --hf-repo BenevolenceMessiah/gemma-2-9b-it-Q8_0-GGUF --hf-file gemma-2-9b-it-q8_0.gguf -p "The meaning to life and the universe is"
55
+ ```
56
+ or
57
+ ```
58
+ ./llama-server --hf-repo BenevolenceMessiah/gemma-2-9b-it-Q8_0-GGUF --hf-file gemma-2-9b-it-q8_0.gguf -c 2048
 
 
 
 
 
 
 
 
 
 
 
59
  ```