andrijdavid
commited on
Commit
•
0034eae
1
Parent(s):
6209930
Upload folder using huggingface_hub
Browse files- .gitattributes +17 -0
- Q2_K/Q2_K-00001-of-00001.gguf +3 -0
- Q3_K/Q3_K-00001-of-00001.gguf +3 -0
- Q3_K_L/Q3_K_L-00001-of-00001.gguf +3 -0
- Q3_K_M/Q3_K_M-00001-of-00001.gguf +3 -0
- Q3_K_S/Q3_K_S-00001-of-00001.gguf +3 -0
- Q4_0/Q4_0-00001-of-00001.gguf +3 -0
- Q4_1/Q4_1-00001-of-00001.gguf +3 -0
- Q4_K/Q4_K-00001-of-00001.gguf +3 -0
- Q4_K_M/Q4_K_M-00001-of-00001.gguf +3 -0
- Q4_K_S/Q4_K_S-00001-of-00001.gguf +3 -0
- Q5_0/Q5_0-00001-of-00001.gguf +3 -0
- Q5_1/Q5_1-00001-of-00001.gguf +3 -0
- Q5_K/Q5_K-00001-of-00001.gguf +3 -0
- Q5_K_M/Q5_K_M-00001-of-00001.gguf +3 -0
- Q5_K_S/Q5_K_S-00001-of-00001.gguf +3 -0
- Q6_K/Q6_K-00001-of-00001.gguf +3 -0
- Q8_0/Q8_0-00001-of-00001.gguf +3 -0
- README.md +460 -0
.gitattributes
CHANGED
@@ -33,3 +33,20 @@ 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 |
+
Q2_K/Q2_K-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
|
37 |
+
Q3_K/Q3_K-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
|
38 |
+
Q3_K_L/Q3_K_L-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
|
39 |
+
Q3_K_M/Q3_K_M-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
|
40 |
+
Q3_K_S/Q3_K_S-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
|
41 |
+
Q4_0/Q4_0-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
|
42 |
+
Q4_1/Q4_1-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
|
43 |
+
Q4_K/Q4_K-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
|
44 |
+
Q4_K_M/Q4_K_M-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
|
45 |
+
Q4_K_S/Q4_K_S-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
|
46 |
+
Q5_0/Q5_0-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
|
47 |
+
Q5_1/Q5_1-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
|
48 |
+
Q5_K/Q5_K-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
|
49 |
+
Q5_K_M/Q5_K_M-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
|
50 |
+
Q5_K_S/Q5_K_S-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
|
51 |
+
Q6_K/Q6_K-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
|
52 |
+
Q8_0/Q8_0-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
|
Q2_K/Q2_K-00001-of-00001.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:472e7747d7fea029710470018b6440136cb6d5671a30c5476f4479897a5b4d0b
|
3 |
+
size 3481446304
|
Q3_K/Q3_K-00001-of-00001.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8354ca64ac56663ce111bfd13eb0985d4052164a2aeb8db34485865d2caacc13
|
3 |
+
size 4369328032
|
Q3_K_L/Q3_K_L-00001-of-00001.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6374ebd209d5234db16b1182140e6e9ced31048ce1075d427ffaef655ec1da26
|
3 |
+
size 4709066656
|
Q3_K_M/Q3_K_M-00001-of-00001.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8354ca64ac56663ce111bfd13eb0985d4052164a2aeb8db34485865d2caacc13
|
3 |
+
size 4369328032
|
Q3_K_S/Q3_K_S-00001-of-00001.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:57f1c2edd07cbb40b294c94ccfa8a440553875d99356241799194115fd7e43cf
|
3 |
+
size 3982403488
|
Q4_0/Q4_0-00001-of-00001.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e7c02d915cd723ca677ba538f2d0fb0a2e74d9de3faa04646273f94f98f66c2f
|
3 |
+
size 5011842976
|
Q4_1/Q4_1-00001-of-00001.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fd970479bac109b499fa88d472f83a3d3affeaeeb4da85096c27513610191952
|
3 |
+
size 5496285088
|
Q4_K/Q4_K-00001-of-00001.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:676f8eff701b639b0b78c6940593d0501e2be3d7c09be40638677a328901adc8
|
3 |
+
size 5329758112
|
Q4_K_M/Q4_K_M-00001-of-00001.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:676f8eff701b639b0b78c6940593d0501e2be3d7c09be40638677a328901adc8
|
3 |
+
size 5329758112
|
Q4_K_S/Q4_K_S-00001-of-00001.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:49793c285b98b9936cc663eda9c067bf65c4d5649c58e83d844cac699ddf5e5e
|
3 |
+
size 5046445984
|
Q5_0/Q5_0-00001-of-00001.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9b39487f9a083105b7b39dd580598a4f9659732e14d0089e5cd9a91412ec2b87
|
3 |
+
size 5980727200
|
Q5_1/Q5_1-00001-of-00001.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6f46ff9358ec73b7eee1c768b1ae9c419ffb615b3c395e6abb6d8eb0fe5c2148
|
3 |
+
size 6465169312
|
Q5_K/Q5_K-00001-of-00001.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:75666e831dc5e91f8478cf3fb09e11ac17eb0f8bd509595d626dea87e80203f3
|
3 |
+
size 6144501664
|
Q5_K_M/Q5_K_M-00001-of-00001.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:75666e831dc5e91f8478cf3fb09e11ac17eb0f8bd509595d626dea87e80203f3
|
3 |
+
size 6144501664
|
Q5_K_S/Q5_K_S-00001-of-00001.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:564f9cb5c9209bb5bb6dc432d88c37140bf5ef93c6671f28d503e863c8da5fd0
|
3 |
+
size 5980727200
|
Q6_K/Q6_K-00001-of-00001.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4a5507654543ef620297418e74729165aeab476827d11025de65620c73df0e14
|
3 |
+
size 7010166688
|
Q8_0/Q8_0-00001-of-00001.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dfaeaae27f5dd799371998523d8eb372e6f2cdba3d45a1f469c9030605a72218
|
3 |
+
size 9077843872
|
README.md
ADDED
@@ -0,0 +1,460 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
library_name: transformers
|
3 |
+
license: gemma
|
4 |
+
license_link: https://ai.google.dev/gemma/terms
|
5 |
+
tags:
|
6 |
+
- GGUF
|
7 |
+
extra_gated_heading: Access CodeGemma on Hugging Face
|
8 |
+
extra_gated_prompt: To access CodeGemma on Hugging Face, you’re required to review
|
9 |
+
and agree to Google’s usage license. To do this, please ensure you’re logged-in
|
10 |
+
to Hugging Face and click below. Requests are processed immediately.
|
11 |
+
extra_gated_button_content: Acknowledge license
|
12 |
+
quantized_by: andrijdavid
|
13 |
+
---
|
14 |
+
# codegemma-7b-GGUF
|
15 |
+
- Original model: [codegemma-7b](https://huggingface.co/google/codegemma-7b)
|
16 |
+
|
17 |
+
<!-- description start -->
|
18 |
+
## Description
|
19 |
+
|
20 |
+
This repo contains GGUF format model files for [codegemma-7b](https://huggingface.co/google/codegemma-7b).
|
21 |
+
|
22 |
+
<!-- description end -->
|
23 |
+
<!-- README_GGUF.md-about-gguf start -->
|
24 |
+
### About GGUF
|
25 |
+
GGUF is a new format introduced by the llama.cpp team on August 21st 2023. It is a replacement for GGML, which is no longer supported by llama.cpp.
|
26 |
+
Here is an incomplete list of clients and libraries that are known to support GGUF:
|
27 |
+
* [llama.cpp](https://github.com/ggerganov/llama.cpp). This is the source project for GGUF, providing both a Command Line Interface (CLI) and a server option.
|
28 |
+
* [text-generation-webui](https://github.com/oobabooga/text-generation-webui), Known as the most widely used web UI, this project boasts numerous features and powerful extensions, and supports GPU acceleration.
|
29 |
+
* [Ollama](https://github.com/jmorganca/ollama) Ollama is a lightweight and extensible framework designed for building and running language models locally. It features a simple API for creating, managing, and executing models, along with a library of pre-built models for use in various applications
|
30 |
+
* [KoboldCpp](https://github.com/LostRuins/koboldcpp), A comprehensive web UI offering GPU acceleration across all platforms and architectures, particularly renowned for storytelling.
|
31 |
+
* [GPT4All](https://gpt4all.io), This is a free and open source GUI that runs locally, supporting Windows, Linux, and macOS with full GPU acceleration.
|
32 |
+
* [LM Studio](https://lmstudio.ai/) An intuitive and powerful local GUI for Windows and macOS (Silicon), featuring GPU acceleration.
|
33 |
+
* [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui). A notable web UI with a variety of unique features, including a comprehensive model library for easy model selection.
|
34 |
+
* [Faraday.dev](https://faraday.dev/), An attractive, user-friendly character-based chat GUI for Windows and macOS (both Silicon and Intel), also offering GPU acceleration.
|
35 |
+
* [llama-cpp-python](https://github.com/abetlen/llama-cpp-python), A Python library equipped with GPU acceleration, LangChain support, and an OpenAI-compatible API server.
|
36 |
+
* [candle](https://github.com/huggingface/candle), A Rust-based ML framework focusing on performance, including GPU support, and designed for ease of use.
|
37 |
+
* [ctransformers](https://github.com/marella/ctransformers), A Python library featuring GPU acceleration, LangChain support, and an OpenAI-compatible AI server.
|
38 |
+
* [localGPT](https://github.com/PromtEngineer/localGPT) An open-source initiative enabling private conversations with documents.
|
39 |
+
<!-- README_GGUF.md-about-gguf end -->
|
40 |
+
|
41 |
+
<!-- compatibility_gguf start -->
|
42 |
+
## Explanation of quantisation methods
|
43 |
+
<details>
|
44 |
+
<summary>Click to see details</summary>
|
45 |
+
The new methods available are:
|
46 |
+
|
47 |
+
* GGML_TYPE_Q2_K - "type-1" 2-bit quantization in super-blocks containing 16 blocks, each block having 16 weight. Block scales and mins are quantized with 4 bits. This ends up effectively using 2.5625 bits per weight (bpw)
|
48 |
+
* GGML_TYPE_Q3_K - "type-0" 3-bit quantization in super-blocks containing 16 blocks, each block having 16 weights. Scales are quantized with 6 bits. This end up using 3.4375 bpw.
|
49 |
+
* GGML_TYPE_Q4_K - "type-1" 4-bit quantization in super-blocks containing 8 blocks, each block having 32 weights. Scales and mins are quantized with 6 bits. This ends up using 4.5 bpw.
|
50 |
+
* GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
|
51 |
+
* GGML_TYPE_Q6_K - "type-0" 6-bit quantization. Super-blocks with 16 blocks, each block having 16 weights. Scales are quantized with 8 bits. This ends up using 6.5625 bpw.
|
52 |
+
</details>
|
53 |
+
<!-- compatibility_gguf end -->
|
54 |
+
|
55 |
+
<!-- README_GGUF.md-how-to-download start -->
|
56 |
+
## How to download GGUF files
|
57 |
+
|
58 |
+
**Note for manual downloaders:** You almost never want to clone the entire repo! Multiple different quantisation formats are provided, and most users only want to pick and download a single folder.
|
59 |
+
|
60 |
+
The following clients/libraries will automatically download models for you, providing a list of available models to choose from:
|
61 |
+
|
62 |
+
* LM Studio
|
63 |
+
* LoLLMS Web UI
|
64 |
+
* Faraday.dev
|
65 |
+
|
66 |
+
### In `text-generation-webui`
|
67 |
+
|
68 |
+
Under Download Model, you can enter the model repo: LiteLLMs/codegemma-7b-GGUF and below it, a specific filename to download, such as: Q4_0/Q4_0-00001-of-00001.gguf.
|
69 |
+
|
70 |
+
Then click Download.
|
71 |
+
|
72 |
+
### On the command line, including multiple files at once
|
73 |
+
|
74 |
+
I recommend using the `huggingface-hub` Python library:
|
75 |
+
|
76 |
+
```shell
|
77 |
+
pip3 install huggingface-hub
|
78 |
+
```
|
79 |
+
|
80 |
+
Then you can download any individual model file to the current directory, at high speed, with a command like this:
|
81 |
+
|
82 |
+
```shell
|
83 |
+
huggingface-cli download LiteLLMs/codegemma-7b-GGUF Q4_0/Q4_0-00001-of-00001.gguf --local-dir . --local-dir-use-symlinks False
|
84 |
+
```
|
85 |
+
|
86 |
+
<details>
|
87 |
+
<summary>More advanced huggingface-cli download usage (click to read)</summary>
|
88 |
+
|
89 |
+
You can also download multiple files at once with a pattern:
|
90 |
+
|
91 |
+
```shell
|
92 |
+
huggingface-cli download LiteLLMs/codegemma-7b-GGUF --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'
|
93 |
+
```
|
94 |
+
|
95 |
+
For more documentation on downloading with `huggingface-cli`, please see: [HF -> Hub Python Library -> Download files -> Download from the CLI](https://huggingface.co/docs/huggingface_hub/guides/download#download-from-the-cli).
|
96 |
+
|
97 |
+
To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
|
98 |
+
|
99 |
+
```shell
|
100 |
+
pip3 install huggingface_hub[hf_transfer]
|
101 |
+
```
|
102 |
+
|
103 |
+
And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
|
104 |
+
|
105 |
+
```shell
|
106 |
+
HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download LiteLLMs/codegemma-7b-GGUF Q4_0/Q4_0-00001-of-00001.gguf --local-dir . --local-dir-use-symlinks False
|
107 |
+
```
|
108 |
+
|
109 |
+
Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
|
110 |
+
</details>
|
111 |
+
<!-- README_GGUF.md-how-to-download end -->
|
112 |
+
<!-- README_GGUF.md-how-to-run start -->
|
113 |
+
## Example `llama.cpp` command
|
114 |
+
|
115 |
+
Make sure you are using `llama.cpp` from commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221) or later.
|
116 |
+
|
117 |
+
```shell
|
118 |
+
./main -ngl 35 -m Q4_0/Q4_0-00001-of-00001.gguf --color -c --temp 0.7 --repeat_penalty 1.1 -n -1 -p "<PROMPT>"
|
119 |
+
```
|
120 |
+
|
121 |
+
Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
|
122 |
+
|
123 |
+
Change `-c ` to the desired sequence length. For extended sequence models - eg 8K, 16K, 32K - the necessary RoPE scaling parameters are read from the GGUF file and set by llama.cpp automatically. Note that longer sequence lengths require much more resources, so you may need to reduce this value.
|
124 |
+
|
125 |
+
If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
|
126 |
+
|
127 |
+
For other parameters and how to use them, please refer to [the llama.cpp documentation](https://github.com/ggerganov/llama.cpp/blob/master/examples/main/README.md)
|
128 |
+
|
129 |
+
## How to run in `text-generation-webui`
|
130 |
+
|
131 |
+
Further instructions can be found in the text-generation-webui documentation, here: [text-generation-webui/docs/04 ‐ Model Tab.md](https://github.com/oobabooga/text-generation-webui/blob/main/docs/04%20%E2%80%90%20Model%20Tab.md#llamacpp).
|
132 |
+
|
133 |
+
## How to run from Python code
|
134 |
+
|
135 |
+
You can use GGUF models from Python using the [llama-cpp-python](https://github.com/abetlen/llama-cpp-python) or [ctransformers](https://github.com/marella/ctransformers) libraries. Note that at the time of writing (Nov 27th 2023), ctransformers has not been updated for some time and is not compatible with some recent models. Therefore I recommend you use llama-cpp-python.
|
136 |
+
|
137 |
+
### How to load this model in Python code, using llama-cpp-python
|
138 |
+
|
139 |
+
For full documentation, please see: [llama-cpp-python docs](https://abetlen.github.io/llama-cpp-python/).
|
140 |
+
|
141 |
+
#### First install the package
|
142 |
+
|
143 |
+
Run one of the following commands, according to your system:
|
144 |
+
|
145 |
+
```shell
|
146 |
+
# Base ctransformers with no GPU acceleration
|
147 |
+
pip install llama-cpp-python
|
148 |
+
# With NVidia CUDA acceleration
|
149 |
+
CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python
|
150 |
+
# Or with OpenBLAS acceleration
|
151 |
+
CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python
|
152 |
+
# Or with CLBLast acceleration
|
153 |
+
CMAKE_ARGS="-DLLAMA_CLBLAST=on" pip install llama-cpp-python
|
154 |
+
# Or with AMD ROCm GPU acceleration (Linux only)
|
155 |
+
CMAKE_ARGS="-DLLAMA_HIPBLAS=on" pip install llama-cpp-python
|
156 |
+
# Or with Metal GPU acceleration for macOS systems only
|
157 |
+
CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python
|
158 |
+
# In windows, to set the variables CMAKE_ARGS in PowerShell, follow this format; eg for NVidia CUDA:
|
159 |
+
$env:CMAKE_ARGS = "-DLLAMA_OPENBLAS=on"
|
160 |
+
pip install llama-cpp-python
|
161 |
+
```
|
162 |
+
|
163 |
+
#### Simple llama-cpp-python example code
|
164 |
+
|
165 |
+
```python
|
166 |
+
from llama_cpp import Llama
|
167 |
+
# Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
|
168 |
+
llm = Llama(
|
169 |
+
model_path="./Q4_0/Q4_0-00001-of-00001.gguf", # Download the model file first
|
170 |
+
n_ctx=32768, # The max sequence length to use - note that longer sequence lengths require much more resources
|
171 |
+
n_threads=8, # The number of CPU threads to use, tailor to your system and the resulting performance
|
172 |
+
n_gpu_layers=35 # The number of layers to offload to GPU, if you have GPU acceleration available
|
173 |
+
)
|
174 |
+
# Simple inference example
|
175 |
+
output = llm(
|
176 |
+
"<PROMPT>", # Prompt
|
177 |
+
max_tokens=512, # Generate up to 512 tokens
|
178 |
+
stop=["</s>"], # Example stop token - not necessarily correct for this specific model! Please check before using.
|
179 |
+
echo=True # Whether to echo the prompt
|
180 |
+
)
|
181 |
+
# Chat Completion API
|
182 |
+
llm = Llama(model_path="./Q4_0/Q4_0-00001-of-00001.gguf", chat_format="llama-2") # Set chat_format according to the model you are using
|
183 |
+
llm.create_chat_completion(
|
184 |
+
messages = [
|
185 |
+
{"role": "system", "content": "You are a story writing assistant."},
|
186 |
+
{
|
187 |
+
"role": "user",
|
188 |
+
"content": "Write a story about llamas."
|
189 |
+
}
|
190 |
+
]
|
191 |
+
)
|
192 |
+
```
|
193 |
+
|
194 |
+
## How to use with LangChain
|
195 |
+
|
196 |
+
Here are guides on using llama-cpp-python and ctransformers with LangChain:
|
197 |
+
|
198 |
+
* [LangChain + llama-cpp-python](https://python.langchain.com/docs/integrations/llms/llamacpp)
|
199 |
+
* [LangChain + ctransformers](https://python.langchain.com/docs/integrations/providers/ctransformers)
|
200 |
+
|
201 |
+
<!-- README_GGUF.md-how-to-run end -->
|
202 |
+
|
203 |
+
<!-- footer end -->
|
204 |
+
|
205 |
+
<!-- original-model-card start -->
|
206 |
+
# Original model card: codegemma-7b
|
207 |
+
|
208 |
+
|
209 |
+
# CodeGemma
|
210 |
+
|
211 |
+
Model Page
|
212 |
+
: [CodeGemma](https://ai.google.dev/gemma/docs/codegemma)
|
213 |
+
|
214 |
+
Resources and Technical Documentation
|
215 |
+
: [Technical Report](https://goo.gle/codegemma)
|
216 |
+
: [Responsible Generative AI Toolkit](https://ai.google.dev/responsible)
|
217 |
+
|
218 |
+
Terms of Use
|
219 |
+
: [Terms](https://www.kaggle.com/models/google/codegemma/license/consent/verify/huggingface?returnModelRepoId=google/codegemma-7b)
|
220 |
+
|
221 |
+
Authors
|
222 |
+
: Google
|
223 |
+
|
224 |
+
## Model Information
|
225 |
+
|
226 |
+
Summary description and brief definition of inputs and outputs.
|
227 |
+
|
228 |
+
### Description
|
229 |
+
|
230 |
+
CodeGemma is a collection of lightweight open code models built on top of Gemma. CodeGemma models are text-to-text and text-to-code decoder-only models and are available as a 7 billion pretrained variant that specializes in code completion and code generation tasks, a 7 billion parameter instruction-tuned variant for code chat and instruction following and a 2 billion parameter pretrained variant for fast code completion.
|
231 |
+
|
232 |
+
| | [codegemma-2b](https://huggingface.co/google/codegemma-2b) | [**codegemma-7b**](https://huggingface.co/google/codegemma-7b) | [codegemma-7b-it](https://huggingface.co/google/codegemma-7b-it) |
|
233 |
+
| -- | :--: | :: | :--: |
|
234 |
+
| Code Completion | ✅ | ✅ | |
|
235 |
+
| Generation from natural language | | ✅ | ✅ |
|
236 |
+
| Chat | | | ✅ |
|
237 |
+
| Instruction Following | | | ✅ |
|
238 |
+
|
239 |
+
### Sample Usage
|
240 |
+
|
241 |
+
#### For Code Completion
|
242 |
+
|
243 |
+
Code completion can be used for infilling inside code editors. CodeGemma was trained for this task using the fill-in-the-middle (FIM) objective, where you provide a prefix and a suffix as context for the completion. The following tokens are used to separate the different parts of the input:
|
244 |
+
|
245 |
+
- `<|fim_prefix|>` precedes the context before the completion we want to run.
|
246 |
+
- `<|fim_suffix|>` precedes the suffix. You must put this token exactly where the cursor would be positioned in an editor, as this is the location that will be completed by the model.
|
247 |
+
- `<|fim_middle|>` is the prompt that invites the model to run the generation.
|
248 |
+
|
249 |
+
In addition to these, there's also `<|file_separator|>`, which is used to provide multi-file contexts.
|
250 |
+
|
251 |
+
Please, make sure to not provide any extra spaces or newlines around the tokens, other than those that would naturally occur in the code fragment you want to complete. Here's an example:
|
252 |
+
|
253 |
+
```python
|
254 |
+
from transformers import GemmaTokenizer, AutoModelForCausalLM
|
255 |
+
|
256 |
+
model_id = "google/codegemma-7b"
|
257 |
+
tokenizer = GemmaTokenizer.from_pretrained(model_id)
|
258 |
+
model = AutoModelForCausalLM.from_pretrained(model_id)
|
259 |
+
|
260 |
+
prompt = '''\
|
261 |
+
<|fim_prefix|>import datetime
|
262 |
+
def calculate_age(birth_year):
|
263 |
+
"""Calculates a person's age based on their birth year."""
|
264 |
+
current_year = datetime.date.today().year
|
265 |
+
<|fim_suffix|>
|
266 |
+
return age<|fim_middle|>\
|
267 |
+
'''
|
268 |
+
|
269 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
270 |
+
prompt_len = inputs["input_ids"].shape[-1]
|
271 |
+
outputs = model.generate(**inputs, max_new_tokens=100)
|
272 |
+
print(tokenizer.decode(outputs[0][prompt_len:]))
|
273 |
+
```
|
274 |
+
|
275 |
+
This may return something like the following:
|
276 |
+
|
277 |
+
```
|
278 |
+
age = current_year - birth_year<|file_separator|>test_calculate_age.py
|
279 |
+
<|fim_suffix|>
|
280 |
+
assert calculate_age(1990) == 33
|
281 |
+
assert calculate_age(1980) == 43
|
282 |
+
assert calculate_age(1970) == 53
|
283 |
+
assert calculate_age(1960) == 63
|
284 |
+
assert calculate_age(1950) == 73
|
285 |
+
```
|
286 |
+
|
287 |
+
Note the extra content after the correct completion. The model returns the completion, followed by one of the FIM tokens or the EOS token. You should ignore everything that comes after any of these tokens. A good way to achieve this is by providing a list of terminators to the `generate` function, like this:
|
288 |
+
|
289 |
+
```python
|
290 |
+
FIM_PREFIX = '<|fim_prefix|>'
|
291 |
+
FIM_SUFFIX = '<|fim_suffix|>'
|
292 |
+
FIM_MIDDLE = '<|fim_middle|>'
|
293 |
+
FIM_FILE_SEPARATOR = '<|file_separator|>'
|
294 |
+
|
295 |
+
terminators = tokenizer.convert_tokens_to_ids([FIM_PREFIX, FIM_MIDDLE, FIM_SUFFIX, FIM_FILE_SEPARATOR])
|
296 |
+
terminators += [tokenizer.eos_token_id]
|
297 |
+
|
298 |
+
outputs = model.generate(
|
299 |
+
**inputs,
|
300 |
+
max_new_tokens=100,
|
301 |
+
eos_token_id=terminators,
|
302 |
+
)
|
303 |
+
```
|
304 |
+
|
305 |
+
In this case, generation stops as soon as the first delimiter is found in the response:
|
306 |
+
|
307 |
+
```
|
308 |
+
age = current_year - birth_year<|file_separator|>
|
309 |
+
```
|
310 |
+
|
311 |
+
|
312 |
+
#### For Code Generation
|
313 |
+
|
314 |
+
```python
|
315 |
+
from transformers import GemmaTokenizer, AutoModelForCausalLM
|
316 |
+
|
317 |
+
tokenizer = GemmaTokenizer.from_pretrained("google/codegemma-7b")
|
318 |
+
model = AutoModelForCausalLM.from_pretrained("google/codegemma-7b")
|
319 |
+
|
320 |
+
input_text = "Write me a Python function to calculate the nth fibonacci number."
|
321 |
+
input_ids = tokenizer(input_text, return_tensors="pt")
|
322 |
+
|
323 |
+
outputs = model.generate(**input_ids)
|
324 |
+
print(tokenizer.decode(outputs[0]))
|
325 |
+
```
|
326 |
+
|
327 |
+
### Inputs and Outputs
|
328 |
+
|
329 |
+
Inputs
|
330 |
+
: For pretrained model variants: code prefix and/or suffix for code completion and generation scenarios, or natural language text or prompt
|
331 |
+
: For instruction tuned model variant: natural language text or prompt
|
332 |
+
|
333 |
+
Outputs
|
334 |
+
: For pretrained model variants: fill-in-the-middle code completion, code and natural language
|
335 |
+
: For instruction tuned model variant: code and natural language
|
336 |
+
|
337 |
+
## Model Data
|
338 |
+
|
339 |
+
Data used for model training and how the data was processed.
|
340 |
+
|
341 |
+
### Training Dataset
|
342 |
+
|
343 |
+
Using Gemma as the base model, CodeGemma 2B and 7B pretrained variants are further trained on an additional 500 billion tokens of primarily English language data from publicly available code repositories, open source mathematics datasets and synthetically generated code.
|
344 |
+
|
345 |
+
### Training Data Processing
|
346 |
+
|
347 |
+
The following data pre-processing techniques were applied:
|
348 |
+
|
349 |
+
* FIM Pretrained CodeGemma models focus on fill-in-the-middle (FIM) tasks. The models are trained to work with both PSM and SPM modes. Our FIM settings are 80% FIM rate with 50-50 PSM/SPM.
|
350 |
+
* Dependency Graph-based Packing and Unit Test-based Lexical Packing techniques: To improve model alignment with real-world applications, we structured training examples at the project/repository level to co-locate the most relevant source files within each repository. Specifically, we employed two heuristic techniques: dependency graph-based packing and unit test-based lexical packing
|
351 |
+
* We developed a novel technique for splitting the documents into prefix, middle, and suffix to make the suffix start in a more syntactically natural point rather than purely random distribution.
|
352 |
+
* Safety: Similarly to Gemma, we deployed rigorous safety filtering including filtering personal data, CSAM filtering and other filtering based on content quality and safety in line with [our policies](https://storage.googleapis.com/gweb-uniblog-publish-prod/documents/2023_Google_AI_Principles_Progress_Update.pdf#page=11).
|
353 |
+
|
354 |
+
## Implementation Information
|
355 |
+
|
356 |
+
Information about the hardware and software used to train the models.
|
357 |
+
|
358 |
+
### Hardware
|
359 |
+
|
360 |
+
CodeGemma was trained using the latest generation of [Tensor Processing Unit (TPU)](https://cloud.google.com/tpu/docs/intro-to-tpu) hardware (TPUv5e).
|
361 |
+
|
362 |
+
### Software
|
363 |
+
|
364 |
+
Training was done using [JAX](https://github.com/google/jax) and [ML Pathways](https://blog.google/technology/ai/introducing-pathways-next-generation-ai-architecture/).
|
365 |
+
|
366 |
+
## Evaluation Information
|
367 |
+
|
368 |
+
Model evaluation metrics and results.
|
369 |
+
|
370 |
+
### Evaluation Approach
|
371 |
+
|
372 |
+
We evaluate CodeGemma on a variety of academic benchmarks across several domains:
|
373 |
+
|
374 |
+
* Code completion benchmarks: HumanEval Single Line and Multiple Line Infilling
|
375 |
+
* Code generation benchmarks: HumanEval, MBPP, BabelCode (C++, C#, Go, Java, JavaScript, Kotlin, Python, Rust)
|
376 |
+
* Q&A: BoolQ, PIQA, TriviaQA
|
377 |
+
* Natural Language: ARC-Challenge, HellaSwag, MMLU, WinoGrande
|
378 |
+
* Math Reasoning: GSM8K, MATH
|
379 |
+
|
380 |
+
### Evaluation Results
|
381 |
+
|
382 |
+
#### Coding Benchmarks
|
383 |
+
|
384 |
+
| Benchmark | 2B | 7B | 7B-IT |
|
385 |
+
| -- | -- |
|
386 |
+
| HumanEval | 31.1 | 44.5 | 56.1 |
|
387 |
+
| MBPP | 43.6 | 56.2 | 54.2 |
|
388 |
+
| HumanEval Single Line | 78.41 | 76.09 | 68.25 |
|
389 |
+
| HumanEval Multi Line | 51.44 | 58.44 | 20.05 |
|
390 |
+
| BC HE C++ | 24.2 | 32.9 | 42.2 |
|
391 |
+
| BC HE C# | 10.6 | 22.4 | 26.7 |
|
392 |
+
| BC HE Go | 20.5 | 21.7 | 28.6 |
|
393 |
+
| BC HE Java | 29.2 | 41.0 | 48.4 |
|
394 |
+
| BC HE JavaScript | 21.7 | 39.8 | 46.0 |
|
395 |
+
| BC HE Kotlin | 28.0 | 39.8 | 51.6 |
|
396 |
+
| BC HE Python | 21.7 | 42.2 | 48.4 |
|
397 |
+
| BC HE Rust | 26.7 | 34.1 | 36.0 |
|
398 |
+
| BC MBPP C++ | 47.1 | 53.8 | 56.7 |
|
399 |
+
| BC MBPP C# | 28.7 | 32.5 | 41.2 |
|
400 |
+
| BC MBPP Go | 45.6 | 43.3 | 46.2 |
|
401 |
+
| BC MBPP Java | 41.8 | 50.3 | 57.3 |
|
402 |
+
| BC MBPP JavaScript | 45.3 | 58.2 | 61.4 |
|
403 |
+
| BC MBPP Kotlin | 46.8 | 54.7 | 59.9 |
|
404 |
+
| BC MBPP Python | 38.6 | 59.1 | 62.0 |
|
405 |
+
| BC MBPP Rust | 45.3 | 52.9 | 53.5 |
|
406 |
+
|
407 |
+
#### Natural Language Benchmarks
|
408 |
+
|
409 |
+
![CodeGemma Natural Language Benchmarks](./codegemma_nl_benchmarks.png)
|
410 |
+
|
411 |
+
## Ethics and Safety
|
412 |
+
|
413 |
+
Ethics and safety evaluation approach and results.
|
414 |
+
|
415 |
+
### Evaluation Approach
|
416 |
+
|
417 |
+
Our evaluation methods include structured evaluations and internal red-teaming testing of relevant content policies. Red-teaming was conducted by a number of different teams, each with different goals and human evaluation metrics. These models were evaluated against a number of different categories relevant to ethics and safety, including:
|
418 |
+
|
419 |
+
* Human evaluation on prompts covering content safety and representational harms. See the [Gemma model card](https://ai.google.dev/gemma/docs/model_card#evaluation_approach) for more details on evaluation approach.
|
420 |
+
* Specific testing of cyber-offence capabilities, focusing on testing autonomous hacking capabilities and ensuring potential harms are limited.
|
421 |
+
|
422 |
+
### Evaluation Results
|
423 |
+
|
424 |
+
The results of ethics and safety evaluations are within acceptable thresholds 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 safety, content safety, representational harms, memorization, large-scale harms. See the [Gemma model card](https://ai.google.dev/gemma/docs/model_card#evaluation_results) for more details.
|
425 |
+
|
426 |
+
## Model Usage & Limitations
|
427 |
+
|
428 |
+
These models have certain limitations that users should be aware of.
|
429 |
+
|
430 |
+
### Intended Usage
|
431 |
+
|
432 |
+
Code Gemma models have a wide range of applications, which vary between IT and PT models. The following list of potential uses is not comprehensive. The purpose of this list is to provide contextual information about the possible use-cases that the model creators considered as part of model training and development.
|
433 |
+
|
434 |
+
Code Completion
|
435 |
+
: PT models can be used to complete code with an IDE extension
|
436 |
+
|
437 |
+
Code Generation
|
438 |
+
: IT model can be used to generate code with or without an IDE extension
|
439 |
+
|
440 |
+
Code Conversation
|
441 |
+
: IT model can power conversation interfaces which discuss code.
|
442 |
+
|
443 |
+
Code Education
|
444 |
+
: IT model supports interactive code learning experiences, aids in syntax correction or provides coding practice.
|
445 |
+
|
446 |
+
### Known Limitations
|
447 |
+
|
448 |
+
Large Language Models (LLMs) have limitations based on their training data and the inherent limitations of the technology. See the [Gemma model card](https://ai.google.dev/gemma/docs/model_card#evaluation_results) for more details on the limitations of LLMs.
|
449 |
+
|
450 |
+
### Ethical Considerations & Risks
|
451 |
+
|
452 |
+
The development of large language models (LLMs) raises several ethical concerns. We have carefully considered multiple aspects in the development of these models. Please refer to [the same discussion](https://ai.google.dev/gemma/docs/model_card#ethical_considerations_and_risks) in the Gemma model card for model details.
|
453 |
+
|
454 |
+
### Benefits
|
455 |
+
|
456 |
+
At the time of release, this family of models provides high-performance open code-focused large language model implementations designed from the ground up for Responsible AI development compared to similarly sized models.
|
457 |
+
|
458 |
+
Using the coding benchmark evaluation metrics described in this document, these models have shown to provide superior performance to other, comparably-sized open model alternatives.
|
459 |
+
|
460 |
+
<!-- original-model-card end -->
|