Update README.md
Browse files
README.md
CHANGED
@@ -18,76 +18,284 @@ inference:
|
|
18 |
license: gemma
|
19 |
license_link: https://ai.google.dev/gemma/terms
|
20 |
quantized_by: bartowski
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
---
|
22 |
|
23 |
-
##
|
24 |
|
25 |
-
|
26 |
|
27 |
-
|
|
|
|
|
28 |
|
29 |
-
|
|
|
|
|
30 |
|
31 |
-
## Prompt
|
|
|
|
|
|
|
|
|
32 |
|
33 |
```
|
34 |
-
<
|
35 |
{prompt}<end_of_turn>
|
36 |
<start_of_turn>model
|
37 |
-
|
38 |
```
|
39 |
|
40 |
Note that this model does not support a System prompt.
|
41 |
|
42 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
| [codegemma-7b-it-Q5_K_M.gguf](https://huggingface.co/bartowski/codegemma-7b-it-GGUF/blob/main/codegemma-7b-it-Q5_K_M.gguf) | Q5_K_M | 6.14GB | High quality, *recommended*. |
|
49 |
-
| [codegemma-7b-it-Q5_K_S.gguf](https://huggingface.co/bartowski/codegemma-7b-it-GGUF/blob/main/codegemma-7b-it-Q5_K_S.gguf) | Q5_K_S | 5.98GB | High quality, *recommended*. |
|
50 |
-
| [codegemma-7b-it-Q4_K_M.gguf](https://huggingface.co/bartowski/codegemma-7b-it-GGUF/blob/main/codegemma-7b-it-Q4_K_M.gguf) | Q4_K_M | 5.32GB | Good quality, uses about 4.83 bits per weight, *recommended*. |
|
51 |
-
| [codegemma-7b-it-Q4_K_S.gguf](https://huggingface.co/bartowski/codegemma-7b-it-GGUF/blob/main/codegemma-7b-it-Q4_K_S.gguf) | Q4_K_S | 5.04GB | Slightly lower quality with more space savings, *recommended*. |
|
52 |
-
| [codegemma-7b-it-IQ4_NL.gguf](https://huggingface.co/bartowski/codegemma-7b-it-GGUF/blob/main/codegemma-7b-it-IQ4_NL.gguf) | IQ4_NL | 5.01GB | Decent quality, slightly smaller than Q4_K_S with similar performance *recommended*. |
|
53 |
-
| [codegemma-7b-it-IQ4_XS.gguf](https://huggingface.co/bartowski/codegemma-7b-it-GGUF/blob/main/codegemma-7b-it-IQ4_XS.gguf) | IQ4_XS | 4.76GB | Decent quality, smaller than Q4_K_S with similar performance, *recommended*. |
|
54 |
-
| [codegemma-7b-it-Q3_K_L.gguf](https://huggingface.co/bartowski/codegemma-7b-it-GGUF/blob/main/codegemma-7b-it-Q3_K_L.gguf) | Q3_K_L | 4.70GB | Lower quality but usable, good for low RAM availability. |
|
55 |
-
| [codegemma-7b-it-Q3_K_M.gguf](https://huggingface.co/bartowski/codegemma-7b-it-GGUF/blob/main/codegemma-7b-it-Q3_K_M.gguf) | Q3_K_M | 4.36GB | Even lower quality. |
|
56 |
-
| [codegemma-7b-it-IQ3_M.gguf](https://huggingface.co/bartowski/codegemma-7b-it-GGUF/blob/main/codegemma-7b-it-IQ3_M.gguf) | IQ3_M | 4.10GB | Medium-low quality, new method with decent performance comparable to Q3_K_M. |
|
57 |
-
| [codegemma-7b-it-IQ3_S.gguf](https://huggingface.co/bartowski/codegemma-7b-it-GGUF/blob/main/codegemma-7b-it-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. |
|
58 |
-
| [codegemma-7b-it-Q3_K_S.gguf](https://huggingface.co/bartowski/codegemma-7b-it-GGUF/blob/main/codegemma-7b-it-Q3_K_S.gguf) | Q3_K_S | 3.98GB | Low quality, not recommended. |
|
59 |
-
| [codegemma-7b-it-IQ3_XS.gguf](https://huggingface.co/bartowski/codegemma-7b-it-GGUF/blob/main/codegemma-7b-it-IQ3_XS.gguf) | IQ3_XS | 3.80GB | Lower quality, new method with decent performance, slightly better than Q3_K_S. |
|
60 |
-
| [codegemma-7b-it-IQ3_XXS.gguf](https://huggingface.co/bartowski/codegemma-7b-it-GGUF/blob/main/codegemma-7b-it-IQ3_XXS.gguf) | IQ3_XXS | 3.48GB | Lower quality, new method with decent performance, comparable to Q3 quants. |
|
61 |
-
| [codegemma-7b-it-Q2_K.gguf](https://huggingface.co/bartowski/codegemma-7b-it-GGUF/blob/main/codegemma-7b-it-Q2_K.gguf) | Q2_K | 3.48GB | Very low quality but surprisingly usable. |
|
62 |
-
| [codegemma-7b-it-IQ2_M.gguf](https://huggingface.co/bartowski/codegemma-7b-it-GGUF/blob/main/codegemma-7b-it-IQ2_M.gguf) | IQ2_M | 3.13GB | Very low quality, uses SOTA techniques to also be surprisingly usable. |
|
63 |
-
| [codegemma-7b-it-IQ2_S.gguf](https://huggingface.co/bartowski/codegemma-7b-it-GGUF/blob/main/codegemma-7b-it-IQ2_S.gguf) | IQ2_S | 2.91GB | Very low quality, uses SOTA techniques to be usable. |
|
64 |
-
| [codegemma-7b-it-IQ2_XS.gguf](https://huggingface.co/bartowski/codegemma-7b-it-GGUF/blob/main/codegemma-7b-it-IQ2_XS.gguf) | IQ2_XS | 2.81GB | Very low quality, uses SOTA techniques to be usable. |
|
65 |
-
| [codegemma-7b-it-IQ2_XXS.gguf](https://huggingface.co/bartowski/codegemma-7b-it-GGUF/blob/main/codegemma-7b-it-IQ2_XXS.gguf) | IQ2_XXS | 2.58GB | Lower quality, uses SOTA techniques to be usable. |
|
66 |
-
| [codegemma-7b-it-IQ1_M.gguf](https://huggingface.co/bartowski/codegemma-7b-it-GGUF/blob/main/codegemma-7b-it-IQ1_M.gguf) | IQ1_M | 2.32GB | Extremely low quality, *not* recommended. |
|
67 |
-
| [codegemma-7b-it-IQ1_S.gguf](https://huggingface.co/bartowski/codegemma-7b-it-GGUF/blob/main/codegemma-7b-it-IQ1_S.gguf) | IQ1_S | 2.16GB | Extremely low quality, *not* recommended. |
|
68 |
|
69 |
-
|
70 |
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
-
|
76 |
|
77 |
-
|
78 |
|
79 |
-
|
80 |
|
81 |
-
|
82 |
|
83 |
-
|
84 |
|
85 |
-
|
86 |
|
87 |
-
|
88 |
|
89 |
-
|
90 |
|
91 |
-
|
92 |
|
93 |
-
|
|
|
18 |
license: gemma
|
19 |
license_link: https://ai.google.dev/gemma/terms
|
20 |
quantized_by: bartowski
|
21 |
+
lm_studio:
|
22 |
+
param_count: 8b
|
23 |
+
use_case: coding
|
24 |
+
release_date: 09-04-2024
|
25 |
+
model_creator: google
|
26 |
+
prompt_template: Google Gemma Instruct
|
27 |
+
system_prompt: none
|
28 |
+
base_model: gemma
|
29 |
+
original_repo: google/codegemma-7b-it
|
30 |
---
|
31 |
|
32 |
+
## 💫 Community Model> CodeGemma 7b Instruct by Google
|
33 |
|
34 |
+
*👾 [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)*.
|
35 |
|
36 |
+
**Model creator:** [Google](https://huggingface.co/google)<br>
|
37 |
+
**Original model**: [google/codegemma-7b-it](https://huggingface.co/google/codegemma-7b-it)<br>
|
38 |
+
**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>
|
39 |
|
40 |
+
## Model Summary:
|
41 |
+
CodeGemma 7b Instruct is the first in a series of coding models released by Google. As an instruct model, it specializes in being asked coding related questions, but can also function as an autocomplete/fill-in-middle model for tools like co-pilot.<br>
|
42 |
+
This model is perfect for general coding questions or code generation.
|
43 |
|
44 |
+
## Prompt Template:
|
45 |
+
|
46 |
+
Choose the 'Google Gemma Instruct' preset in your LM Studio.
|
47 |
+
|
48 |
+
Under the hood, the model will see a prompt that's formatted like so:
|
49 |
|
50 |
```
|
51 |
+
<start_of_turn>user
|
52 |
{prompt}<end_of_turn>
|
53 |
<start_of_turn>model
|
|
|
54 |
```
|
55 |
|
56 |
Note that this model does not support a System prompt.
|
57 |
|
58 |
+
## Use case and examples
|
59 |
+
|
60 |
+
This model should be used for coding purposes.
|
61 |
+
|
62 |
+
### Coding 1
|
63 |
+
|
64 |
+
```
|
65 |
+
<start_of_turn>user
|
66 |
+
Write a quicksort in C++<end_of_turn>
|
67 |
+
<start_of_turn>model
|
68 |
+
#include <iostream>
|
69 |
+
|
70 |
+
using namespace std;
|
71 |
+
|
72 |
+
int partition(int arr[], int low, int high) {
|
73 |
+
int pivot = arr[high];
|
74 |
+
int i = (low - 1);
|
75 |
+
|
76 |
+
for (int j = low; j <= high - 1; j++) {
|
77 |
+
if (arr[j] <= pivot) {
|
78 |
+
i++;
|
79 |
+
swap(arr[i], arr[j]);
|
80 |
+
}
|
81 |
+
}
|
82 |
+
swap(arr[i + 1], arr[high]);
|
83 |
+
return (i + 1);
|
84 |
+
}
|
85 |
+
|
86 |
+
void quickSort(int arr[], int low, int high) {
|
87 |
+
if (low < high) {
|
88 |
+
int pi = partition(arr, low, high);
|
89 |
+
|
90 |
+
quickSort(arr, low, pi - 1);
|
91 |
+
quickSort(arr, pi + 1, high);
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
int main() {
|
96 |
+
int arr[] = {10, 7, 8, 9, 1, 5};
|
97 |
+
int n = sizeof(arr) / sizeof(arr[0]);
|
98 |
+
|
99 |
+
quickSort(arr, 0, n - 1);
|
100 |
+
|
101 |
+
cout << "Sorted array: ";
|
102 |
+
for (int i = 0; i < n; i++) {
|
103 |
+
cout << arr[i] << " ";
|
104 |
+
}
|
105 |
+
|
106 |
+
return 0;
|
107 |
+
}
|
108 |
+
<end_of_turn>
|
109 |
+
```
|
110 |
+
|
111 |
+
### Coding 2
|
112 |
+
|
113 |
+
```
|
114 |
+
<start_of_turn>user
|
115 |
+
Write a merge sort in java<end_of_turn>
|
116 |
+
<start_of_turn>model
|
117 |
+
|
118 |
+
public class MergeSort {
|
119 |
+
|
120 |
+
public static void mergeSort(int[] arr) {
|
121 |
+
int n = arr.length;
|
122 |
+
if (n < 2) {
|
123 |
+
return;
|
124 |
+
}
|
125 |
+
int mid = n / 2;
|
126 |
+
int[] left = new int[mid];
|
127 |
+
int[] right = new int[n - mid];
|
128 |
+
for (int i = 0; i < mid; i++) {
|
129 |
+
left[i] = arr[i];
|
130 |
+
}
|
131 |
+
for (int i = mid; i < n; i++) {
|
132 |
+
right[i - mid] = arr[i];
|
133 |
+
}
|
134 |
+
mergeSort(left);
|
135 |
+
mergeSort(right);
|
136 |
+
merge(arr, left, right);
|
137 |
+
}
|
138 |
+
|
139 |
+
public static void merge(int[] arr, int[] left, int[] right) {
|
140 |
+
int i = 0;
|
141 |
+
int j = 0;
|
142 |
+
int k = 0;
|
143 |
+
while (i < left.length && j < right.length) {
|
144 |
+
if (left[i] <= right[j]) {
|
145 |
+
arr[k] = left[i];
|
146 |
+
i++;
|
147 |
+
} else {
|
148 |
+
arr[k] = right[j];
|
149 |
+
j++;
|
150 |
+
}
|
151 |
+
k++;
|
152 |
+
}
|
153 |
+
while (i < left.length) {
|
154 |
+
arr[k] = left[i];
|
155 |
+
i++;
|
156 |
+
k++;
|
157 |
+
}
|
158 |
+
while (j < right.length) {
|
159 |
+
arr[k] = right[j];
|
160 |
+
j++;
|
161 |
+
k++;
|
162 |
+
}
|
163 |
+
}
|
164 |
+
|
165 |
+
public static void main(String[] args) {
|
166 |
+
int[] arr = {5, 2, 4, 6, 1, 3};
|
167 |
+
mergeSort(arr);
|
168 |
+
for (int i = 0; i < arr.length; i++) {
|
169 |
+
System.out.print(arr[i] + " ");
|
170 |
+
}
|
171 |
+
}
|
172 |
+
}
|
173 |
+
<end_of_turn>
|
174 |
+
```
|
175 |
+
|
176 |
+
### Coding 3
|
177 |
+
|
178 |
+
```
|
179 |
+
<bos><start_of_turn>user
|
180 |
+
How do you write a for loop in react?<end_of_turn>
|
181 |
+
<start_of_turn>model
|
182 |
+
The syntax for a for loop in React is:
|
183 |
+
|
184 |
+
for (let i = 0; i < array.length; i++) {
|
185 |
+
// Code to be executed for each iteration
|
186 |
+
}
|
187 |
+
|
188 |
+
Where:
|
189 |
|
190 |
+
* `i` is the loop variable, which starts at 0 and increments by 1 with each iteration.
|
191 |
+
* `array` is the array you want to iterate over.
|
192 |
+
* `array.length` is the length of the array.
|
193 |
+
* `// Code to be executed for each iteration` is the code you want to execute for each iteration of the loop.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
|
195 |
+
Here is an example of how to use a for loop to render a list of items:
|
196 |
|
197 |
+
const items = ["item 1", "item 2", "item 3"];
|
198 |
+
|
199 |
+
const listItems = items.map((item, index) => (
|
200 |
+
<li key={index}>{item}</li>
|
201 |
+
));
|
202 |
+
|
203 |
+
return (
|
204 |
+
<ul>
|
205 |
+
{listItems}
|
206 |
+
</ul>
|
207 |
+
);
|
208 |
|
209 |
+
In this example, the `map()` method is used to create a new array of `li` elements. The `key` prop is used to uniquely identify each `li` element.
|
210 |
+
|
211 |
+
Here are some other things to keep in mind when using for loops in React:
|
212 |
+
|
213 |
+
* You can use any variable name for the loop variable.
|
214 |
+
* You can use any condition for the loop condition.
|
215 |
+
* You can use any code inside the loop.
|
216 |
+
* You can use nested for loops.
|
217 |
+
|
218 |
+
Here are some resources that you may find helpful:
|
219 |
+
|
220 |
+
* **For Loop in JavaScript:** https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for
|
221 |
+
* **Map() method:** https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map
|
222 |
+
* **Key prop:** https://reactjs.org/docs/lists-and-keys.html#keys<end_of_turn>
|
223 |
+
```
|
224 |
+
|
225 |
+
## Coding related question
|
226 |
+
|
227 |
+
```
|
228 |
+
<bos><start_of_turn>user
|
229 |
+
When would you use an array versus a dictionary?<end_of_turn>
|
230 |
+
<start_of_turn>model
|
231 |
+
**Arrays** and **dictionaries** are both data structures used in computer programming, but they have different purposes and characteristics.
|
232 |
+
|
233 |
+
**Arrays** are ordered collections of elements of the same data type. They are indexed by their position in the array, starting from 0. Arrays are ideal for storing and accessing data in a sequential manner.
|
234 |
+
|
235 |
+
**Dictionaries**, on the other hand, are unordered collections of key-value pairs. Keys are unique identifiers that are used to access the corresponding values. Dictionaries are ideal for storing and accessing data based on a specific key.
|
236 |
+
|
237 |
+
**When to use an array:**
|
238 |
+
|
239 |
+
* When you need to store a fixed number of elements of the same data type.
|
240 |
+
* When you need to access elements by their position in the array.
|
241 |
+
* When you need to iterate over the elements in a specific order.
|
242 |
+
|
243 |
+
**When to use a dictionary:**
|
244 |
+
|
245 |
+
* When you need to store a variable number of elements of different data types.
|
246 |
+
* When you need to access elements by their key.
|
247 |
+
* When you need to quickly check if a key exists in the dictionary.
|
248 |
+
|
249 |
+
**Example:**
|
250 |
+
|
251 |
+
**Array:**
|
252 |
+
|
253 |
+
# Create an array of integers
|
254 |
+
numbers = [1, 2, 3, 4, 5]
|
255 |
+
|
256 |
+
# Access the first element
|
257 |
+
print(numbers[0]) # Output: 1
|
258 |
+
|
259 |
+
# Iterate over the elements
|
260 |
+
for number in numbers:
|
261 |
+
print(number)
|
262 |
+
|
263 |
+
**Dictionary:**
|
264 |
+
|
265 |
+
# Create a dictionary of names and ages
|
266 |
+
names_ages = {"John": 30, "Jane": 25, "Peter": 40}
|
267 |
+
|
268 |
+
# Access the age of John
|
269 |
+
print(names_ages["John"]) # Output: 30
|
270 |
+
|
271 |
+
# Check if a key exists
|
272 |
+
if "Mary" in names_ages:
|
273 |
+
print("Mary is in the dictionary")
|
274 |
+
else:
|
275 |
+
print("Mary is not in the dictionary")
|
276 |
+
|
277 |
+
**In summary:**
|
278 |
+
|
279 |
+
* Use an array when you need to store a fixed number of elements of the same data type and access them by their position.
|
280 |
+
* Use a dictionary when you need to store a variable number of elements of different data types and access them by their key.<end_of_turn>
|
281 |
+
```
|
282 |
|
283 |
+
## Technical Details
|
284 |
|
285 |
+
CodeGemma 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.
|
286 |
|
287 |
+
The code used is based on publicly avaialble code repositories.
|
288 |
|
289 |
+
The instruct version was further trained on mathematical datasets in an attempt to improve its mathematical reasoning capabilities, as well as synthetic code generation combined with a second LLM for evaluation and reinforcement feedback.
|
290 |
|
291 |
+
Additional details can be found on Google's official report PDF [here](https://storage.googleapis.com/deepmind-media/gemma/codegemma_report.pdf)
|
292 |
|
293 |
+
## Special thanks
|
294 |
|
295 |
+
🙏 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.
|
296 |
|
297 |
+
🙏 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!
|
298 |
|
299 |
+
## Disclaimers
|
300 |
|
301 |
+
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.
|