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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Quantization made by Richard Erkhov.
|
2 |
+
|
3 |
+
[Github](https://github.com/RichardErkhov)
|
4 |
+
|
5 |
+
[Discord](https://discord.gg/pvy7H8DZMG)
|
6 |
+
|
7 |
+
[Request more models](https://github.com/RichardErkhov/quant_request)
|
8 |
+
|
9 |
+
|
10 |
+
polyglot-math-4x7b - GGUF
|
11 |
+
- Model creator: https://huggingface.co/macadeliccc/
|
12 |
+
- Original model: https://huggingface.co/macadeliccc/polyglot-math-4x7b/
|
13 |
+
|
14 |
+
|
15 |
+
| Name | Quant method | Size |
|
16 |
+
| ---- | ---- | ---- |
|
17 |
+
| [polyglot-math-4x7b.Q2_K.gguf](https://huggingface.co/RichardErkhov/macadeliccc_-_polyglot-math-4x7b-gguf/blob/main/polyglot-math-4x7b.Q2_K.gguf) | Q2_K | 8.24GB |
|
18 |
+
| [polyglot-math-4x7b.IQ3_XS.gguf](https://huggingface.co/RichardErkhov/macadeliccc_-_polyglot-math-4x7b-gguf/blob/main/polyglot-math-4x7b.IQ3_XS.gguf) | IQ3_XS | 9.21GB |
|
19 |
+
| [polyglot-math-4x7b.IQ3_S.gguf](https://huggingface.co/RichardErkhov/macadeliccc_-_polyglot-math-4x7b-gguf/blob/main/polyglot-math-4x7b.IQ3_S.gguf) | IQ3_S | 9.73GB |
|
20 |
+
| [polyglot-math-4x7b.Q3_K_S.gguf](https://huggingface.co/RichardErkhov/macadeliccc_-_polyglot-math-4x7b-gguf/blob/main/polyglot-math-4x7b.Q3_K_S.gguf) | Q3_K_S | 9.72GB |
|
21 |
+
| [polyglot-math-4x7b.IQ3_M.gguf](https://huggingface.co/RichardErkhov/macadeliccc_-_polyglot-math-4x7b-gguf/blob/main/polyglot-math-4x7b.IQ3_M.gguf) | IQ3_M | 9.92GB |
|
22 |
+
| [polyglot-math-4x7b.Q3_K.gguf](https://huggingface.co/RichardErkhov/macadeliccc_-_polyglot-math-4x7b-gguf/blob/main/polyglot-math-4x7b.Q3_K.gguf) | Q3_K | 10.79GB |
|
23 |
+
| [polyglot-math-4x7b.Q3_K_M.gguf](https://huggingface.co/RichardErkhov/macadeliccc_-_polyglot-math-4x7b-gguf/blob/main/polyglot-math-4x7b.Q3_K_M.gguf) | Q3_K_M | 10.79GB |
|
24 |
+
| [polyglot-math-4x7b.Q3_K_L.gguf](https://huggingface.co/RichardErkhov/macadeliccc_-_polyglot-math-4x7b-gguf/blob/main/polyglot-math-4x7b.Q3_K_L.gguf) | Q3_K_L | 11.68GB |
|
25 |
+
| [polyglot-math-4x7b.IQ4_XS.gguf](https://huggingface.co/RichardErkhov/macadeliccc_-_polyglot-math-4x7b-gguf/blob/main/polyglot-math-4x7b.IQ4_XS.gguf) | IQ4_XS | 12.15GB |
|
26 |
+
| [polyglot-math-4x7b.Q4_0.gguf](https://huggingface.co/RichardErkhov/macadeliccc_-_polyglot-math-4x7b-gguf/blob/main/polyglot-math-4x7b.Q4_0.gguf) | Q4_0 | 12.69GB |
|
27 |
+
| [polyglot-math-4x7b.IQ4_NL.gguf](https://huggingface.co/RichardErkhov/macadeliccc_-_polyglot-math-4x7b-gguf/blob/main/polyglot-math-4x7b.IQ4_NL.gguf) | IQ4_NL | 12.81GB |
|
28 |
+
| [polyglot-math-4x7b.Q4_K_S.gguf](https://huggingface.co/RichardErkhov/macadeliccc_-_polyglot-math-4x7b-gguf/blob/main/polyglot-math-4x7b.Q4_K_S.gguf) | Q4_K_S | 12.8GB |
|
29 |
+
| [polyglot-math-4x7b.Q4_K.gguf](https://huggingface.co/RichardErkhov/macadeliccc_-_polyglot-math-4x7b-gguf/blob/main/polyglot-math-4x7b.Q4_K.gguf) | Q4_K | 13.61GB |
|
30 |
+
| [polyglot-math-4x7b.Q4_K_M.gguf](https://huggingface.co/RichardErkhov/macadeliccc_-_polyglot-math-4x7b-gguf/blob/main/polyglot-math-4x7b.Q4_K_M.gguf) | Q4_K_M | 13.61GB |
|
31 |
+
| [polyglot-math-4x7b.Q4_1.gguf](https://huggingface.co/RichardErkhov/macadeliccc_-_polyglot-math-4x7b-gguf/blob/main/polyglot-math-4x7b.Q4_1.gguf) | Q4_1 | 14.09GB |
|
32 |
+
| [polyglot-math-4x7b.Q5_0.gguf](https://huggingface.co/RichardErkhov/macadeliccc_-_polyglot-math-4x7b-gguf/blob/main/polyglot-math-4x7b.Q5_0.gguf) | Q5_0 | 15.48GB |
|
33 |
+
| [polyglot-math-4x7b.Q5_K_S.gguf](https://huggingface.co/RichardErkhov/macadeliccc_-_polyglot-math-4x7b-gguf/blob/main/polyglot-math-4x7b.Q5_K_S.gguf) | Q5_K_S | 15.48GB |
|
34 |
+
| [polyglot-math-4x7b.Q5_K.gguf](https://huggingface.co/RichardErkhov/macadeliccc_-_polyglot-math-4x7b-gguf/blob/main/polyglot-math-4x7b.Q5_K.gguf) | Q5_K | 15.96GB |
|
35 |
+
| [polyglot-math-4x7b.Q5_K_M.gguf](https://huggingface.co/RichardErkhov/macadeliccc_-_polyglot-math-4x7b-gguf/blob/main/polyglot-math-4x7b.Q5_K_M.gguf) | Q5_K_M | 15.96GB |
|
36 |
+
| [polyglot-math-4x7b.Q5_1.gguf](https://huggingface.co/RichardErkhov/macadeliccc_-_polyglot-math-4x7b-gguf/blob/main/polyglot-math-4x7b.Q5_1.gguf) | Q5_1 | 16.88GB |
|
37 |
+
| [polyglot-math-4x7b.Q6_K.gguf](https://huggingface.co/RichardErkhov/macadeliccc_-_polyglot-math-4x7b-gguf/blob/main/polyglot-math-4x7b.Q6_K.gguf) | Q6_K | 18.46GB |
|
38 |
+
| [polyglot-math-4x7b.Q8_0.gguf](https://huggingface.co/RichardErkhov/macadeliccc_-_polyglot-math-4x7b-gguf/blob/main/polyglot-math-4x7b.Q8_0.gguf) | Q8_0 | 23.9GB |
|
39 |
+
|
40 |
+
|
41 |
+
|
42 |
+
|
43 |
+
Original model description:
|
44 |
+
---
|
45 |
+
language:
|
46 |
+
- en
|
47 |
+
- zh
|
48 |
+
- ja
|
49 |
+
license: apache-2.0
|
50 |
+
model-index:
|
51 |
+
- name: polyglot-math-4x7b
|
52 |
+
results:
|
53 |
+
- task:
|
54 |
+
type: text-generation
|
55 |
+
name: Text Generation
|
56 |
+
dataset:
|
57 |
+
name: AI2 Reasoning Challenge (25-Shot)
|
58 |
+
type: ai2_arc
|
59 |
+
config: ARC-Challenge
|
60 |
+
split: test
|
61 |
+
args:
|
62 |
+
num_few_shot: 25
|
63 |
+
metrics:
|
64 |
+
- type: acc_norm
|
65 |
+
value: 63.74
|
66 |
+
name: normalized accuracy
|
67 |
+
source:
|
68 |
+
url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=macadeliccc/polyglot-math-4x7b
|
69 |
+
name: Open LLM Leaderboard
|
70 |
+
- task:
|
71 |
+
type: text-generation
|
72 |
+
name: Text Generation
|
73 |
+
dataset:
|
74 |
+
name: HellaSwag (10-Shot)
|
75 |
+
type: hellaswag
|
76 |
+
split: validation
|
77 |
+
args:
|
78 |
+
num_few_shot: 10
|
79 |
+
metrics:
|
80 |
+
- type: acc_norm
|
81 |
+
value: 84.85
|
82 |
+
name: normalized accuracy
|
83 |
+
source:
|
84 |
+
url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=macadeliccc/polyglot-math-4x7b
|
85 |
+
name: Open LLM Leaderboard
|
86 |
+
- task:
|
87 |
+
type: text-generation
|
88 |
+
name: Text Generation
|
89 |
+
dataset:
|
90 |
+
name: MMLU (5-Shot)
|
91 |
+
type: cais/mmlu
|
92 |
+
config: all
|
93 |
+
split: test
|
94 |
+
args:
|
95 |
+
num_few_shot: 5
|
96 |
+
metrics:
|
97 |
+
- type: acc
|
98 |
+
value: 63.57
|
99 |
+
name: accuracy
|
100 |
+
source:
|
101 |
+
url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=macadeliccc/polyglot-math-4x7b
|
102 |
+
name: Open LLM Leaderboard
|
103 |
+
- task:
|
104 |
+
type: text-generation
|
105 |
+
name: Text Generation
|
106 |
+
dataset:
|
107 |
+
name: TruthfulQA (0-shot)
|
108 |
+
type: truthful_qa
|
109 |
+
config: multiple_choice
|
110 |
+
split: validation
|
111 |
+
args:
|
112 |
+
num_few_shot: 0
|
113 |
+
metrics:
|
114 |
+
- type: mc2
|
115 |
+
value: 53.78
|
116 |
+
source:
|
117 |
+
url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=macadeliccc/polyglot-math-4x7b
|
118 |
+
name: Open LLM Leaderboard
|
119 |
+
- task:
|
120 |
+
type: text-generation
|
121 |
+
name: Text Generation
|
122 |
+
dataset:
|
123 |
+
name: Winogrande (5-shot)
|
124 |
+
type: winogrande
|
125 |
+
config: winogrande_xl
|
126 |
+
split: validation
|
127 |
+
args:
|
128 |
+
num_few_shot: 5
|
129 |
+
metrics:
|
130 |
+
- type: acc
|
131 |
+
value: 78.45
|
132 |
+
name: accuracy
|
133 |
+
source:
|
134 |
+
url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=macadeliccc/polyglot-math-4x7b
|
135 |
+
name: Open LLM Leaderboard
|
136 |
+
- task:
|
137 |
+
type: text-generation
|
138 |
+
name: Text Generation
|
139 |
+
dataset:
|
140 |
+
name: GSM8k (5-shot)
|
141 |
+
type: gsm8k
|
142 |
+
config: main
|
143 |
+
split: test
|
144 |
+
args:
|
145 |
+
num_few_shot: 5
|
146 |
+
metrics:
|
147 |
+
- type: acc
|
148 |
+
value: 56.63
|
149 |
+
name: accuracy
|
150 |
+
source:
|
151 |
+
url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=macadeliccc/polyglot-math-4x7b
|
152 |
+
name: Open LLM Leaderboard
|
153 |
+
---
|
154 |
+
# Polyglot-math-4x7b-24b
|
155 |
+
|
156 |
+
![polyglot](polyglot-math.png)
|
157 |
+
|
158 |
+
Polyglot-4x7b is a Mixture of Experts approach to a multilingual model.
|
159 |
+
|
160 |
+
The model is a merge of models that are capable of Chinese and Japanese output.
|
161 |
+
|
162 |
+
+ meta-math/MetaMath-Mistral-7B
|
163 |
+
+ oshizo/japanese-e5-mistral-7b_slerp
|
164 |
+
+ cognitivecomputations/dolphin-2.6-mistral-7b-dpo-laser
|
165 |
+
+ s3nh/Mistral-7B-Evol-Instruct-Chinese
|
166 |
+
|
167 |
+
I fit the gsm8k evaluation for this model on 20GB of VRAM.
|
168 |
+
|
169 |
+
# Code Example
|
170 |
+
|
171 |
+
Inference [Colab](https://colab.research.google.com/drive/1tYSb63IKZDsiQ5BIJU8Oc92phxugAmB3?usp=sharing)
|
172 |
+
|
173 |
+
```python
|
174 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
175 |
+
|
176 |
+
def generate_response(prompt):
|
177 |
+
"""
|
178 |
+
Generate a response from the model based on the input prompt.
|
179 |
+
|
180 |
+
Args:
|
181 |
+
prompt (str): Prompt for the model.
|
182 |
+
|
183 |
+
Returns:
|
184 |
+
str: The generated response from the model.
|
185 |
+
"""
|
186 |
+
# Tokenize the input prompt
|
187 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
188 |
+
|
189 |
+
# Generate output tokens
|
190 |
+
outputs = model.generate(**inputs, max_new_tokens=256, eos_token_id=tokenizer.eos_token_id, pad_token_id=tokenizer.pad_token_id)
|
191 |
+
|
192 |
+
# Decode the generated tokens to a string
|
193 |
+
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
194 |
+
|
195 |
+
return response
|
196 |
+
|
197 |
+
# Load the model and tokenizer
|
198 |
+
model_id = "macadeliccc/polyglot-math-4x7b"
|
199 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
200 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, load_in_4bit=True)
|
201 |
+
|
202 |
+
# Math prompts in different languages
|
203 |
+
english_math_prompt = "Explain the proof of Fermat's Last Theorem and its implications in number theory."
|
204 |
+
chinese_math_prompt = "解释费马大定理的证明及其在数论中的意义。"
|
205 |
+
japanese_math_prompt = "フェルマーの最終定理の証明と数論におけるその意義について説明してください。"
|
206 |
+
|
207 |
+
# Generate and print responses for each math prompt
|
208 |
+
print("English Math Response:")
|
209 |
+
print(generate_response(english_math_prompt), "\n")
|
210 |
+
|
211 |
+
print("Chinese Math Response:")
|
212 |
+
print(generate_response(chinese_math_prompt), "\n")
|
213 |
+
|
214 |
+
print("Japanese Math Response:")
|
215 |
+
print(generate_response(japanese_math_prompt), "\n")
|
216 |
+
|
217 |
+
```
|
218 |
+
|
219 |
+
## Example Output
|
220 |
+
|
221 |
+
**The math model was trained in english so it defaults to english, but it still understands the question and can translate the answer.
|
222 |
+
English:
|
223 |
+
|
224 |
+
Explain the proof of Fermat's Last Theorem and its implications in number theory.
|
225 |
+
|
226 |
+
Fermat's Last Theorem (FLT) states that there are no non-trivial integer solutions to the equation $x^n + y^n = z^n$ for any integer $n \geq 3$. The proof of FLT was a long-standing problem in number theory, and it was finally proven in 1995 by Andrew Wiles.
|
227 |
+
|
228 |
+
The proof of FLT is quite complex and involves many different techniques and ideas from number theory, algebra, and analysis. The main idea behind the proof is to use elliptic curves and modular forms to construct a system of equations that can be used to show that there are no non-trivial integer solutions to the equation $x^n + y^n = z^n$ for any integer $n \geq 3$.
|
229 |
+
|
230 |
+
The implications of FLT in number theory are far-reaching. The proof of FLT relies on many different techniques and ideas from number theory, and it has led to the development of new techniques and ideas in the field.
|
231 |
+
This is a simple implementation of the quicksort algorithm in python. The function `quicksort` takes an array as input and returns a sorted array. The algorithm works by selecting a pivot element from the array and partitioning the other elements into two sub-arrays, according to whether they are less than or greater than the pivot. The process is then repeated recursively on the sub-arrays until the entire array is sorted.
|
232 |
+
|
233 |
+
Chinese Response:
|
234 |
+
|
235 |
+
解释费马大定理的证明及其在数论中的意义。
|
236 |
+
|
237 |
+
Fermat's Last Theorem (FLT) is a statement in number theory that states that there are no non-trivial integer solutions to the equation $x^n + y^n = z^n$ for any integer $n \geq 3$.
|
238 |
+
|
239 |
+
The proof of FLT was a long-standing open problem in mathematics. In 1993, Andrew Wiles, a British mathematician, published a proof of FLT using the techniques of elliptic curves and modular forms.
|
240 |
+
|
241 |
+
The proof of FLT is considered one of the most important achievements in mathematics in the 20th century. It is a testament to the power of mathematics and the dedication of mathematicians to solve difficult problems.
|
242 |
+
|
243 |
+
The proof of FLT has also had a significant impact on the field of number theory. It has led to the development of new techniques and theorems, and has inspired further research in the field.
|
244 |
+
|
245 |
+
In summary, the proof of FLT is a significant achievement in mathematics that has had a profound impact on the field of number theory. It is a testament to the power of mathematics and the dedication of mathematicians
|
246 |
+
|
247 |
+
Japanese Response:
|
248 |
+
|
249 |
+
フェルマーの最終定理の証明と数論におけるその意義について説明してください。
|
250 |
+
|
251 |
+
The Fermat's Last Theorem (FLT) is a statement in number theory that states that there are no non-trivial integer solutions to the equation $a^n + b^n = c^n$ for any positive integer $n$ greater than 2.
|
252 |
+
|
253 |
+
The proof of FLT was a long-standing open problem in mathematics. In 1993, Andrew Wiles, a British mathematician, published a proof of FLT using the techniques of elliptic curves and modular forms.
|
254 |
+
|
255 |
+
The proof of FLT is considered one of the most important achievements in mathematics in the 20th century. It is a prime example of the power of abstract algebra and number theory in solving difficult problems in mathematics.
|
256 |
+
|
257 |
+
The proof of FLT also has implications for other areas of mathematics, such as algebraic geometry and number theory. For example, the proof of FLT relies on the Taniyama-Shimura-Weil conjecture, which states that every elliptic curve is a modular form. This conjecture was proven by Wiles and his collaborators, and it has since been used to prove other theorems
|
258 |
+
|
259 |
+
|
260 |
+
|
261 |
+
# Evaluations
|
262 |
+
|
263 |
+
|Tasks|Version| Filter |n-shot| Metric |Value | |Stderr|
|
264 |
+
|-----|-------|----------|-----:|-----------|-----:|---|-----:|
|
265 |
+
|gsm8k|Yaml |get-answer| 5|exact_match|0.5504|± |0.0137|
|
266 |
+
|
267 |
+
# [Open LLM Leaderboard Evaluation Results](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard)
|
268 |
+
Detailed results can be found [here](https://huggingface.co/datasets/open-llm-leaderboard/details_macadeliccc__polyglot-math-4x7b)
|
269 |
+
|
270 |
+
| Metric |Value|
|
271 |
+
|---------------------------------|----:|
|
272 |
+
|Avg. |66.84|
|
273 |
+
|AI2 Reasoning Challenge (25-Shot)|63.74|
|
274 |
+
|HellaSwag (10-Shot) |84.85|
|
275 |
+
|MMLU (5-Shot) |63.57|
|
276 |
+
|TruthfulQA (0-shot) |53.78|
|
277 |
+
|Winogrande (5-shot) |78.45|
|
278 |
+
|GSM8k (5-shot) |56.63|
|
279 |
+
|
280 |
+
|
281 |
+
|