bartowski commited on
Commit
215cae4
·
verified ·
1 Parent(s): f93437c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +170 -64
README.md CHANGED
@@ -10,69 +10,175 @@ license: gemma
10
  license_link: https://ai.google.dev/gemma/terms
11
  quantized_by: bartowski
12
  pipeline_tag: text-generation
 
 
 
 
 
 
 
 
 
13
  ---
14
 
15
- ## Llamacpp Quantizations of codegemma-7b
16
-
17
- Using <a href="https://github.com/ggerganov/llama.cpp/">llama.cpp</a> release <a href="https://github.com/ggerganov/llama.cpp/releases/tag/b2589">b2589</a> for quantization.
18
-
19
- Original model: https://huggingface.co/google/codegemma-7b
20
-
21
- All quants made using imatrix option with dataset provided by Kalomaze [here](https://github.com/ggerganov/llama.cpp/discussions/5263#discussioncomment-8395384)
22
-
23
- ## Prompt format
24
-
25
- No prompt template for this model.
26
-
27
- ## Download a file (not the whole branch) from below:
28
-
29
- | Filename | Quant type | File Size | Description |
30
- | -------- | ---------- | --------- | ----------- |
31
- | [codegemma-7b-Q8_0.gguf](https://huggingface.co/bartowski/codegemma-7b-GGUF/blob/main/codegemma-7b-Q8_0.gguf) | Q8_0 | 9.07GB | Extremely high quality, generally unneeded but max available quant. |
32
- | [codegemma-7b-Q6_K.gguf](https://huggingface.co/bartowski/codegemma-7b-GGUF/blob/main/codegemma-7b-Q6_K.gguf) | Q6_K | 7.01GB | Very high quality, near perfect, *recommended*. |
33
- | [codegemma-7b-Q5_K_M.gguf](https://huggingface.co/bartowski/codegemma-7b-GGUF/blob/main/codegemma-7b-Q5_K_M.gguf) | Q5_K_M | 6.14GB | High quality, *recommended*. |
34
- | [codegemma-7b-Q5_K_S.gguf](https://huggingface.co/bartowski/codegemma-7b-GGUF/blob/main/codegemma-7b-Q5_K_S.gguf) | Q5_K_S | 5.98GB | High quality, *recommended*. |
35
- | [codegemma-7b-Q4_K_M.gguf](https://huggingface.co/bartowski/codegemma-7b-GGUF/blob/main/codegemma-7b-Q4_K_M.gguf) | Q4_K_M | 5.32GB | Good quality, uses about 4.83 bits per weight, *recommended*. |
36
- | [codegemma-7b-Q4_K_S.gguf](https://huggingface.co/bartowski/codegemma-7b-GGUF/blob/main/codegemma-7b-Q4_K_S.gguf) | Q4_K_S | 5.04GB | Slightly lower quality with more space savings, *recommended*. |
37
- | [codegemma-7b-IQ4_NL.gguf](https://huggingface.co/bartowski/codegemma-7b-GGUF/blob/main/codegemma-7b-IQ4_NL.gguf) | IQ4_NL | 5.01GB | Decent quality, slightly smaller than Q4_K_S with similar performance *recommended*. |
38
- | [codegemma-7b-IQ4_XS.gguf](https://huggingface.co/bartowski/codegemma-7b-GGUF/blob/main/codegemma-7b-IQ4_XS.gguf) | IQ4_XS | 4.76GB | Decent quality, smaller than Q4_K_S with similar performance, *recommended*. |
39
- | [codegemma-7b-Q3_K_L.gguf](https://huggingface.co/bartowski/codegemma-7b-GGUF/blob/main/codegemma-7b-Q3_K_L.gguf) | Q3_K_L | 4.70GB | Lower quality but usable, good for low RAM availability. |
40
- | [codegemma-7b-Q3_K_M.gguf](https://huggingface.co/bartowski/codegemma-7b-GGUF/blob/main/codegemma-7b-Q3_K_M.gguf) | Q3_K_M | 4.36GB | Even lower quality. |
41
- | [codegemma-7b-IQ3_M.gguf](https://huggingface.co/bartowski/codegemma-7b-GGUF/blob/main/codegemma-7b-IQ3_M.gguf) | IQ3_M | 4.10GB | Medium-low quality, new method with decent performance comparable to Q3_K_M. |
42
- | [codegemma-7b-IQ3_S.gguf](https://huggingface.co/bartowski/codegemma-7b-GGUF/blob/main/codegemma-7b-IQ3_S.gguf) | IQ3_S | 3.98GB | Lower quality, new method with decent performance, recommended over Q3_K_S quant, same size with better performance. |
43
- | [codegemma-7b-Q3_K_S.gguf](https://huggingface.co/bartowski/codegemma-7b-GGUF/blob/main/codegemma-7b-Q3_K_S.gguf) | Q3_K_S | 3.98GB | Low quality, not recommended. |
44
- | [codegemma-7b-IQ3_XS.gguf](https://huggingface.co/bartowski/codegemma-7b-GGUF/blob/main/codegemma-7b-IQ3_XS.gguf) | IQ3_XS | 3.80GB | Lower quality, new method with decent performance, slightly better than Q3_K_S. |
45
- | [codegemma-7b-IQ3_XXS.gguf](https://huggingface.co/bartowski/codegemma-7b-GGUF/blob/main/codegemma-7b-IQ3_XXS.gguf) | IQ3_XXS | 3.48GB | Lower quality, new method with decent performance, comparable to Q3 quants. |
46
- | [codegemma-7b-Q2_K.gguf](https://huggingface.co/bartowski/codegemma-7b-GGUF/blob/main/codegemma-7b-Q2_K.gguf) | Q2_K | 3.48GB | Very low quality but surprisingly usable. |
47
- | [codegemma-7b-IQ2_M.gguf](https://huggingface.co/bartowski/codegemma-7b-GGUF/blob/main/codegemma-7b-IQ2_M.gguf) | IQ2_M | 3.13GB | Very low quality, uses SOTA techniques to also be surprisingly usable. |
48
- | [codegemma-7b-IQ2_S.gguf](https://huggingface.co/bartowski/codegemma-7b-GGUF/blob/main/codegemma-7b-IQ2_S.gguf) | IQ2_S | 2.91GB | Very low quality, uses SOTA techniques to be usable. |
49
- | [codegemma-7b-IQ2_XS.gguf](https://huggingface.co/bartowski/codegemma-7b-GGUF/blob/main/codegemma-7b-IQ2_XS.gguf) | IQ2_XS | 2.81GB | Very low quality, uses SOTA techniques to be usable. |
50
- | [codegemma-7b-IQ2_XXS.gguf](https://huggingface.co/bartowski/codegemma-7b-GGUF/blob/main/codegemma-7b-IQ2_XXS.gguf) | IQ2_XXS | 2.58GB | Lower quality, uses SOTA techniques to be usable. |
51
- | [codegemma-7b-IQ1_M.gguf](https://huggingface.co/bartowski/codegemma-7b-GGUF/blob/main/codegemma-7b-IQ1_M.gguf) | IQ1_M | 2.32GB | Extremely low quality, *not* recommended. |
52
- | [codegemma-7b-IQ1_S.gguf](https://huggingface.co/bartowski/codegemma-7b-GGUF/blob/main/codegemma-7b-IQ1_S.gguf) | IQ1_S | 2.16GB | Extremely low quality, *not* recommended. |
53
-
54
- ## Which file should I choose?
55
-
56
- A great write up with charts showing various performances is provided by Artefact2 [here](https://gist.github.com/Artefact2/b5f810600771265fc1e39442288e8ec9)
57
-
58
- The first thing to figure out is how big a model you can run. To do this, you'll need to figure out how much RAM and/or VRAM you have.
59
-
60
- If you want your model running as FAST as possible, you'll want to fit the whole thing on your GPU's VRAM. Aim for a quant with a file size 1-2GB smaller than your GPU's total VRAM.
61
-
62
- If you want the absolute maximum quality, add both your system RAM and your GPU's VRAM together, then similarly grab a quant with a file size 1-2GB Smaller than that total.
63
-
64
- Next, you'll need to decide if you want to use an 'I-quant' or a 'K-quant'.
65
-
66
- If you don't want to think too much, grab one of the K-quants. These are in format 'QX_K_X', like Q5_K_M.
67
-
68
- If you want to get more into the weeds, you can check out this extremely useful feature chart:
69
-
70
- [llama.cpp feature matrix](https://github.com/ggerganov/llama.cpp/wiki/Feature-matrix)
71
-
72
- But basically, if you're aiming for below Q4, and you're running cuBLAS (Nvidia) or rocBLAS (AMD), you should look towards the I-quants. These are in format IQX_X, like IQ3_M. These are newer and offer better performance for their size.
73
-
74
- These I-quants can also be used on CPU and Apple Metal, but will be slower than their K-quant equivalent, so speed vs performance is a tradeoff you'll have to decide.
75
-
76
- The I-quants are *not* compatible with Vulcan, which is also AMD, so if you have an AMD card double check if you're using the rocBLAS build or the Vulcan build. At the time of writing this, LM Studio has a preview with ROCm support, and other inference engines have specific builds for ROCm.
77
-
78
- Want to support my work? Visit my ko-fi page here: https://ko-fi.com/bartowski
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  license_link: https://ai.google.dev/gemma/terms
11
  quantized_by: bartowski
12
  pipeline_tag: text-generation
13
+ lm_studio:
14
+ param_count: 7b
15
+ use_case: coding
16
+ release_date: 09-04-2024
17
+ model_creator: google
18
+ prompt_template: none
19
+ system_prompt: none
20
+ base_model: gemma
21
+ original_repo: google/codegemma-7b
22
  ---
23
 
24
+ ## 💫 Community Model> CodeGemma 7b by Google
25
+
26
+ *👾 [LM Studio](https://lmstudio.ai) Community models highlights program. Highlighting new & noteworthy models by the community. Join the conversation on [Discord](https://discord.gg/aPQfnNkxGC)*.
27
+
28
+ **Model creator:** [Google](https://huggingface.co/google)<br>
29
+ **Original model**: [google/codegemma-7b](https://huggingface.co/google/codegemma-7b)<br>
30
+ **GGUF quantization:** provided by [bartowski](https://huggingface.co/bartowski) based on `llama.cpp` release [b2589](https://github.com/ggerganov/llama.cpp/releases/tag/b2589)<br>
31
+
32
+ ## Model Summary:
33
+ CodeGemma 7B is the first in a series of coding models released by Google. This is a code completion model, and as such, cannot be prompted in the same way a chat or instruct model can be prompted.<br>
34
+ This model is perfect for code completion and use in tools like co-pilot, where its small size will make completions show up instantly while still being high performance.<br>
35
+ This model should not be used as a chat model, and will not answer questions.
36
+
37
+ ## Prompt Template:
38
+
39
+ This model does not support a typical prompt template, but instead uses the following tokens for specifying input parts:
40
+
41
+ - <|fim_prefix|> precedes the context before the completion we want to run.
42
+ - <|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.-
43
+ - <|fim_middle|> is the prompt that invites the model to run the generation.
44
+
45
+ In addition to these, there's also <|file_separator|>, which is used to provide multi-file contexts.
46
+
47
+ Select `LM Studio Blank Preset` to use your own proper format as below.
48
+
49
+ ## Use case and examples
50
+
51
+ This model will excel at code generation and fill-in-the-middle.
52
+
53
+ ### Coding 1
54
+
55
+ ```
56
+ <|fim_prefix|>import datetime
57
+ def calculate_age(birth_year):
58
+ """Calculates a person's age based on their birth year."""
59
+ current_year = datetime.date.today().year
60
+ <|fim_suffix|>
61
+ return age<|fim_middle|>
62
+ age = current_year - birth_year<|file_separator|>test_calculate_age.py
63
+ import pytest
64
+ from calculate_age import calculate_age
65
+
66
+ def test_calculate_age_positive():
67
+ assert calculate_age(1990) == 33
68
+
69
+ def test_calculate_age_negative():
70
+ assert calculate_age(2023) == -1
71
+
72
+ def test_calculate_age_future():
73
+ assert calculate_age(2030) == -7
74
+
75
+ def test_calculate_age_zero():
76
+ assert calculate_age(0) == -2023<|file_separator|>
77
+ ```
78
+
79
+ Explanation: Here the model was given the fill-in-middle prefix and suffix. The model is then told to generate the fim_middle with the token `<|fim_middle|>` to which is replies with the code that would complete the function.<br>
80
+ It then gave a file_separator token to indicate a new file called test_calculate_age.py and wrote up several (albeit incorrect) unit tests.
81
+
82
+ ### Coding 2
83
+
84
+ ```
85
+ <|fim_prefix|>public class MergeSort {
86
+
87
+ public static void mergeSort(int[] arr) {
88
+ int n = arr.length;
89
+ if (n < 2) {
90
+ return;
91
+ }
92
+ <|fim_suffix|>
93
+ mergeSort(left);
94
+ mergeSort(right);
95
+ merge(arr, left, right);
96
+ }
97
+
98
+ public static void merge(int[] arr, int[] left, int[] right) {
99
+ int i = 0;
100
+ int j = 0;
101
+ int k = 0;
102
+ while (i < left.length && j < right.length) {
103
+ if (left[i] <= right[j]) {
104
+ arr[k] = left[i];
105
+ i++;
106
+ } else {
107
+ arr[k] = right[j];
108
+ j++;
109
+ }
110
+ k++;
111
+ }
112
+ while (i < left.length) {
113
+ arr[k] = left[i];
114
+ i++;
115
+ k++;
116
+ }
117
+ while (j < right.length) {
118
+ arr[k] = right[j];
119
+ j++;
120
+ k++;
121
+ }
122
+ }
123
+
124
+ public static void main(String[] args) {
125
+ int[] arr = {5, 2, 4, 6, 1, 3};
126
+ mergeSort(arr);
127
+ for (int i = 0; i < arr.length; i++) {
128
+ System.out.print(arr[i] + " ");
129
+ }
130
+ }
131
+ }
132
+ <|fim_middle|>
133
+ int mid = n / 2;
134
+ int[] left = new int[mid];
135
+ int[] right = new int[n - mid];
136
+ for (int i = 0; i < mid; i++) {
137
+ left[i] = arr[i];
138
+ }
139
+ for (int i = mid; i < n; i++) {
140
+ right[i - mid] = arr[i];
141
+ }<|file_separator|>
142
+ ```
143
+
144
+ Explanation: The model was given the majority of a merge sort implementation in Java with a portion in the middle removed. The model was able to fill in the missing code based on the surrounding details.
145
+
146
+ ### Coding 3
147
+
148
+ ```
149
+ <|fim_prefix|>arr = [1, 5, 3, 76, 12, 154, 2, 56]
150
+
151
+ # Sort the array then print only the even numbers
152
+ <|fim_suffix|><|fim_middle|>
153
+ puts arr.sort.select { |num| num.even? }
154
+
155
+ # Sort the array then print only the odd numbers
156
+ puts arr.sort.select { |num| num.odd? }
157
+
158
+ # Sort the array then print only the numbers greater than 10
159
+ puts arr.sort.select { |num| num > 10 }<|file_separator|><|file_separator|>
160
+ ```
161
+
162
+ Explanation: While this model cannot be directly prompted, it can be hinted in the right direction by preceeding the fill in middle token by a comment explaning what comes next, then using <|fim_suffix|> followed immediately by <|fim_middle|><br>
163
+ In this example, the comment suggest that what comes next is sorting the array and printing out each one that is even. The model accurately fills in what should be at <|fim_suffix|>.<br>
164
+ Interestingly in this example, the model chose to use Ruby as the language to complete this, since it fits the given syntax.
165
+
166
+ ## Technical Details
167
+
168
+ CodeGemma 7b is based on the Gemma 7b model with additional training on web documents, mathematics, and code, with a mixture of 80% code and 20% natural language.
169
+
170
+ The code used is based on publicly avaialble code repositories.
171
+
172
+ The model was trained exclusively for the purposes of code completion and excels at it.
173
+
174
+ Additional details can be found on Google's official report PDF [here](https://storage.googleapis.com/deepmind-media/gemma/codegemma_report.pdf)
175
+
176
+ ## Special thanks
177
+
178
+ 🙏 Special thanks to [Georgi Gerganov](https://github.com/ggerganov) and the whole team working on [llama.cpp](https://github.com/ggerganov/llama.cpp/) for making all of this possible.
179
+
180
+ 🙏 Special thanks to [Kalomaze](https://github.com/kalomaze) for his dataset (linked [here](https://github.com/ggerganov/llama.cpp/discussions/5263)) that was used for calculating the imatrix for these quants, which improves the overall quality!
181
+
182
+ ## Disclaimers
183
+
184
+ LM Studio is not the creator, originator, or owner of any Model featured in the Community Model Program. Each Community Model is created and provided by third parties. LM Studio does not endorse, support, represent or guarantee the completeness, truthfulness, accuracy, or reliability of any Community Model. You understand that Community Models can produce content that might be offensive, harmful, inaccurate or otherwise inappropriate, or deceptive. Each Community Model is the sole responsibility of the person or entity who originated such Model. LM Studio may not monitor or control the Community Models and cannot, and does not, take responsibility for any such Model. LM Studio disclaims all warranties or guarantees about the accuracy, reliability or benefits of the Community Models. LM Studio further disclaims any warranty that the Community Model will meet your requirements, be secure, uninterrupted or available at any time or location, or error-free, viruses-free, or that any errors will be corrected, or otherwise. You will be solely responsible for any damage resulting from your use of or access to the Community Models, your downloading of any Community Model, or use of any other Community Model provided by or through LM Studio.