Update README.md
Browse files
README.md
CHANGED
@@ -15,219 +15,22 @@ inference: false
|
|
15 |
|
16 |
# Bielik-7B-Instruct-v0.1-3bit-HQQ
|
17 |
|
18 |
-
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
## Model
|
23 |
-
|
24 |
-
The [SpeakLeash](https://speakleash.org/) team is working on their own set of instructions in Polish, which is continuously being expanded and refined by annotators. A portion of these instructions, which had been manually verified and corrected, has been utilized for training purposes. Moreover, due to the limited availability of high-quality instructions in Polish, publicly accessible collections of instructions in English were used - [OpenHermes-2.5](https://huggingface.co/datasets/teknium/OpenHermes-2.5) and [orca-math-word-problems-200k](https://huggingface.co/datasets/microsoft/orca-math-word-problems-200k), which accounted for half of the instructions used in training. The instructions varied in quality, leading to a deterioration in model’s performance. To counteract this while still allowing ourselves to utilize forementioned datasets,several improvements were introduced:
|
25 |
-
* Weighted tokens level loss - a strategy inspired by [offline reinforcement learning](https://arxiv.org/abs/2005.01643) and [C-RLFT](https://arxiv.org/abs/2309.11235)
|
26 |
-
* Adaptive learning rate inspired by the study on [Learning Rates as a Function of Batch Size](https://arxiv.org/abs/2006.09092)
|
27 |
-
* Masked user instructions
|
28 |
-
|
29 |
-
Bielik-7B-Instruct-v0.1 has been trained with the use of an original open source framework called [ALLaMo](https://github.com/chrisociepa/allamo) implemented by [Krzysztof Ociepa](https://www.linkedin.com/in/krzysztof-ociepa-44886550/). This framework allows users to train language models with architecture similar to LLaMA and Mistral in fast and efficient way.
|
30 |
|
|
|
31 |
|
32 |
### Model description:
|
33 |
|
34 |
* **Developed by:** [SpeakLeash](https://speakleash.org/)
|
35 |
* **Language:** Polish
|
36 |
* **Model type:** causal decoder-only
|
|
|
37 |
* **Finetuned from:** [Bielik-7B-v0.1](https://huggingface.co/speakleash/Bielik-7B-v0.1)
|
38 |
* **License:** CC BY NC 4.0 (non-commercial use)
|
39 |
* **Model ref:** speakleash:e38140bea0d48f1218540800bbc67e89
|
40 |
|
41 |
-
## Training
|
42 |
-
|
43 |
-
* Framework: [ALLaMo](https://github.com/chrisociepa/allamo)
|
44 |
-
* Visualizations: [W&B](https://wandb.ai)
|
45 |
-
|
46 |
-
<p align="center">
|
47 |
-
<img src="https://huggingface.co/speakleash/Bielik-7B-Instruct-v0.1/raw/main/sft_train_loss.png">
|
48 |
-
</p>
|
49 |
-
<p align="center">
|
50 |
-
<img src="https://huggingface.co/speakleash/Bielik-7B-Instruct-v0.1/raw/main/sft_train_ppl.png">
|
51 |
-
</p>
|
52 |
-
<p align="center">
|
53 |
-
<img src="https://huggingface.co/speakleash/Bielik-7B-Instruct-v0.1/raw/main/sft_train_lr.png">
|
54 |
-
</p>
|
55 |
-
|
56 |
-
### Training hyperparameters:
|
57 |
-
|
58 |
-
| **Hyperparameter** | **Value** |
|
59 |
-
|-----------------------------|------------------|
|
60 |
-
| Micro Batch Size | 1 |
|
61 |
-
| Batch Size | up to 4194304 |
|
62 |
-
| Learning Rate (cosine, adaptive) | 7e-6 -> 6e-7 |
|
63 |
-
| Warmup Iterations | 50 |
|
64 |
-
| All Iterations | 55440 |
|
65 |
-
| Optimizer | AdamW |
|
66 |
-
| β1, β2 | 0.9, 0.95 |
|
67 |
-
| Adam_eps | 1e−8 |
|
68 |
-
| Weight Decay | 0.05 |
|
69 |
-
| Grad Clip | 1.0 |
|
70 |
-
| Precision | bfloat16 (mixed) |
|
71 |
-
|
72 |
-
|
73 |
-
### Quant and MLX versions:
|
74 |
-
We know that some people want to explore smaller models or don't have the resources to run a full model. Therefore, we have prepared quantized versions of the Bielik-7B-Instruct-v0.1 model. We are also mindful of Apple Silicon.
|
75 |
-
<br>
|
76 |
-
<br>
|
77 |
-
Quantized versions (for non-GPU / weaker GPU):
|
78 |
-
- https://huggingface.co/speakleash/Bielik-7B-Instruct-v0.1-GGUF
|
79 |
-
- https://huggingface.co/speakleash/Bielik-7B-Instruct-v0.1-GPTQ
|
80 |
-
- https://huggingface.co/speakleash/Bielik-7B-Instruct-v0.1-AWQ
|
81 |
-
- https://huggingface.co/speakleash/Bielik-7B-Instruct-v0.1-EXL2
|
82 |
-
|
83 |
-
For Apple Silicon:
|
84 |
-
- https://huggingface.co/speakleash/Bielik-7B-Instruct-v0.1-MLX
|
85 |
-
|
86 |
-
|
87 |
-
### Instruction format
|
88 |
-
|
89 |
-
In order to leverage instruction fine-tuning, your prompt should be surrounded by `[INST]` and `[/INST]` tokens. The very first instruction should start with the beginning of a sentence token. The generated completion will be finished by the end-of-sentence token.
|
90 |
-
|
91 |
-
E.g.
|
92 |
-
```
|
93 |
-
prompt = "<s>[INST] Jakie mamy pory roku? [/INST]"
|
94 |
-
completion = "W Polsce mamy 4 pory roku: wiosna, lato, jesień i zima.</s>"
|
95 |
-
```
|
96 |
-
|
97 |
-
This format is available as a [chat template](https://huggingface.co/docs/transformers/main/chat_templating) via the `apply_chat_template()` method:
|
98 |
-
|
99 |
-
```python
|
100 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
101 |
-
|
102 |
-
device = "cuda" # the device to load the model onto
|
103 |
-
|
104 |
-
model_name = "speakleash/Bielik-7B-Instruct-v0.1"
|
105 |
-
|
106 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
107 |
-
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16)
|
108 |
-
|
109 |
-
messages = [
|
110 |
-
{"role": "user", "content": "Jakie mamy pory roku w Polsce?"},
|
111 |
-
{"role": "assistant", "content": "W Polsce mamy 4 pory roku: wiosna, lato, jesień i zima."},
|
112 |
-
{"role": "user", "content": "Która jest najcieplejsza?"}
|
113 |
-
]
|
114 |
-
|
115 |
-
input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt")
|
116 |
-
|
117 |
-
model_inputs = input_ids.to(device)
|
118 |
-
model.to(device)
|
119 |
-
|
120 |
-
generated_ids = model.generate(model_inputs, max_new_tokens=1000, do_sample=True)
|
121 |
-
decoded = tokenizer.batch_decode(generated_ids)
|
122 |
-
print(decoded[0])
|
123 |
-
```
|
124 |
-
|
125 |
-
## Evaluation
|
126 |
-
|
127 |
-
|
128 |
-
Models have been evaluated on [Open PL LLM Leaderboard](https://huggingface.co/spaces/speakleash/open_pl_llm_leaderboard) 5-shot. The benchmark evaluates models in NLP tasks like sentiment analysis, categorization, text classification but does not test chatting skills. Here are presented:
|
129 |
-
- Average - average score among all tasks normalized by baseline scores
|
130 |
-
- Reranking - reranking task, commonly used in RAG
|
131 |
-
- Reader (Generator) - open book question answering task, commonly used in RAG
|
132 |
-
- Perplexity (lower is better) - as a bonus, does not correlate with other scores and should not be used for model comparison
|
133 |
-
|
134 |
-
As of April 3, 2024, the following table showcases the current scores of pretrained and continuously pretrained models according to the Open PL LLM Leaderboard, evaluated in a 5-shot setting:
|
135 |
-
|
136 |
-
| | Average | RAG Reranking | RAG Reader | Perplexity |
|
137 |
-
|--------------------------------------------------------------------------------------|----------:|--------------:|-----------:|-----------:|
|
138 |
-
| **7B parameters models:** | | | | |
|
139 |
-
| Baseline (majority class) | 0.00 | 53.36 | - | - |
|
140 |
-
| Voicelab/trurl-2-7b | 18.85 | 60.67 | 77.19 | 1098.88 |
|
141 |
-
| meta-llama/Llama-2-7b-chat-hf | 21.04 | 54.65 | 72.93 | 4018.74 |
|
142 |
-
| mistralai/Mistral-7B-Instruct-v0.1 | 26.42 | 56.35 | 73.68 | 6909.94 |
|
143 |
-
| szymonrucinski/Curie-7B-v1 | 26.72 | 55.58 | 85.19 | 389.17 |
|
144 |
-
| HuggingFaceH4/zephyr-7b-beta | 33.15 | 71.65 | 71.27 | 3613.14 |
|
145 |
-
| HuggingFaceH4/zephyr-7b-alpha | 33.97 | 71.47 | 73.35 | 4464.45 |
|
146 |
-
| internlm/internlm2-chat-7b-sft | 36.97 | 73.22 | 69.96 | 4269.63 |
|
147 |
-
| internlm/internlm2-chat-7b | 37.64 | 72.29 | 71.17 | 3892.50 |
|
148 |
-
| [Bielik-7B-Instruct-v0.1](https://huggingface.co/speakleash/Bielik-7B-Instruct-v0.1) | 39.28 | 61.89 | **86.00** | 277.92 |
|
149 |
-
| mistralai/Mistral-7B-Instruct-v0.2 | 40.29 | 72.58 | 79.39 | 2088.08 |
|
150 |
-
| teknium/OpenHermes-2.5-Mistral-7B | 42.64 | 70.63 | 80.25 | 1463.00 |
|
151 |
-
| openchat/openchat-3.5-1210 | 44.17 | 71.76 | 82.15 | 1923.83 |
|
152 |
-
| speakleash/mistral_7B-v2/spkl-all_sft_v2/e1_base/spkl-all_2e6-e1_70c70cc6 (experimental) | 45.44 | 71.27 | 91.50 | 279.24 |
|
153 |
-
| Nexusflow/Starling-LM-7B-beta | 45.69 | 74.58 | 81.22 | 1161.54 |
|
154 |
-
| openchat/openchat-3.5-0106 | 47.32 | 74.71 | 83.60 | 1106.56 |
|
155 |
-
| berkeley-nest/Starling-LM-7B-alpha | **47.46** | **75.73** | 82.86 | 1438.04 |
|
156 |
-
| | | | | |
|
157 |
-
| **Models with different sizes:** | | | | |
|
158 |
-
| Azurro/APT3-1B-Instruct-v1 (1B) | -13.80 | 52.11 | 12.23 | 739.09 |
|
159 |
-
| Voicelab/trurl-2-13b-academic (13B) | 29.45 | 68.19 | 79.88 | 733.91 |
|
160 |
-
| upstage/SOLAR-10.7B-Instruct-v1.0 (10.7B) | 46.07 | 76.93 | 82.86 | 789.58 |
|
161 |
-
| | | | | |
|
162 |
-
| **7B parameters pretrained and continously pretrained models:** | | | | |
|
163 |
-
| OPI-PG/Qra-7b | 11.13 | 54.40 | 75.25 | 203.36 |
|
164 |
-
| meta-llama/Llama-2-7b-hf | 12.73 | 54.02 | 77.92 | 850.45 |
|
165 |
-
| internlm/internlm2-base-7b | 20.68 | 52.39 | 69.85 | 3110.92 |
|
166 |
-
| [Bielik-7B-v0.1](https://huggingface.co/speakleash/Bielik-7B-v0.1) | 29.38 | 62.13 | **88.39** | 123.31 |
|
167 |
-
| mistralai/Mistral-7B-v0.1 | 30.67 | 60.35 | 85.39 | 857.32 |
|
168 |
-
| internlm/internlm2-7b | 33.03 | 69.39 | 73.63 | 5498.23 |
|
169 |
-
| alpindale/Mistral-7B-v0.2-hf | 33.05 | 60.23 | 85.21 | 932.60 |
|
170 |
-
| speakleash/mistral-apt3-7B/spi-e0_hf (experimental) | 35.50 | 62.14 | **87.48** | 132.78 |
|
171 |
-
|
172 |
-
SpeakLeash models have one of the best scores in the RAG Reader task.
|
173 |
-
We have managed to increase Average score by almost 9 pp. in comparison to Mistral-7B-v0.1.
|
174 |
-
In our subjective evaluations of chatting skills SpeakLeash models perform better than other models with higher Average scores.
|
175 |
-
|
176 |
-
The results in the above table were obtained without utilizing instruction templates for instructional models, instead treating them like base models.
|
177 |
-
This approach could skew the results, as instructional models are optimized with specific instructions in mind.
|
178 |
-
|
179 |
-
## Limitations and Biases
|
180 |
-
|
181 |
-
Bielik-7B-Instruct-v0.1 is a quick demonstration that the base model can be easily fine-tuned to achieve compelling and promising performance. It does not have any moderation mechanisms. We're looking forward to engaging with the community in ways to make the model respect guardrails, allowing for deployment in environments requiring moderated outputs.
|
182 |
-
|
183 |
-
Bielik-7B-Instruct-v0.1 can produce factually incorrect output, and should not be relied on to produce factually accurate data. Bielik-7B-Instruct-v0.1 was trained on various public datasets. While great efforts have been taken to clear the training data, it is possible that this model can generate lewd, false, biased or otherwise offensive outputs.
|
184 |
-
|
185 |
-
## License
|
186 |
-
|
187 |
-
Because of an unclear legal situation, we have decided to publish the model under CC BY NC 4.0 license - it allows for non-commercial use. The model can be used for scientific purposes and privately, as long as the license conditions are met.
|
188 |
-
|
189 |
-
## Citation
|
190 |
-
Please cite this model using the following format:
|
191 |
-
|
192 |
-
```
|
193 |
-
@misc{Bielik7Bv01,
|
194 |
-
title = {Introducing Bielik-7B-Instruct-v0.1: Instruct Polish Language Model},
|
195 |
-
author = {Ociepa, Krzysztof and Flis, Łukasz and Wróbel, Krzysztof and Kondracki, Sebastian and {SpeakLeash Team} and {Cyfronet Team}},
|
196 |
-
year = {2024},
|
197 |
-
url = {https://huggingface.co/speakleash/Bielik-7B-Instruct-v0.1},
|
198 |
-
note = {Accessed: 2024-04-01}, % change this date
|
199 |
-
urldate = {2024-04-01} % change this date
|
200 |
-
}
|
201 |
-
```
|
202 |
-
|
203 |
-
## Responsible for training the model
|
204 |
-
|
205 |
-
* [Krzysztof Ociepa](https://www.linkedin.com/in/krzysztof-ociepa-44886550/)<sup>SpeakLeash</sup> - team leadership, conceptualizing, data preparation, process optimization and oversight of training
|
206 |
-
* [Łukasz Flis](https://www.linkedin.com/in/lukasz-flis-0a39631/)<sup>Cyfronet AGH</sup> - coordinating and supervising the training
|
207 |
-
* [Krzysztof Wróbel](https://www.linkedin.com/in/wrobelkrzysztof/)<sup>SpeakLeash</sup> - benchmarks
|
208 |
-
* [Sebastian Kondracki](https://www.linkedin.com/in/sebastian-kondracki/)<sup>SpeakLeash</sup> - coordinating and preparation of instructions
|
209 |
-
* [Maria Filipkowska](https://www.linkedin.com/in/maria-filipkowska/)<sup>SpeakLeash</sup> - preparation of instructions
|
210 |
-
* [Paweł Kiszczak](https://www.linkedin.com/in/paveu-kiszczak/)<sup>SpeakLeash</sup> - preparation of instructions
|
211 |
-
* [Adrian Gwoździej](https://www.linkedin.com/in/adrgwo/)<sup>SpeakLeash</sup> - data quality and instructions cleaning
|
212 |
-
* [Igor Ciuciura](https://www.linkedin.com/in/igor-ciuciura-1763b52a6/)<sup>SpeakLeash</sup> - instructions cleaning
|
213 |
-
* [Jacek Chwiła](https://www.linkedin.com/in/jacek-chwila/)<sup>SpeakLeash</sup> - instructions cleaning
|
214 |
-
|
215 |
-
The model could not have been created without the commitment and work of the entire SpeakLeash team, whose contribution is invaluable. Thanks to the hard work of many individuals, it was possible to gather a large amount of content in Polish and establish collaboration between the open-science SpeakLeash project and the HPC center: ACK Cyfronet AGH. Individuals who contributed to the creation of the model through their commitment to the open-science SpeakLeash project:
|
216 |
-
[Grzegorz Urbanowicz](https://www.linkedin.com/in/grzegorz-urbanowicz-05823469/),
|
217 |
-
[Szymon Baczyński](https://www.linkedin.com/in/szymon-baczynski/),
|
218 |
-
[Paweł Cyrta](https://www.linkedin.com/in/cyrta),
|
219 |
-
[Jan Maria Kowalski](https://www.linkedin.com/in/janmariakowalski/),
|
220 |
-
[Karol Jezierski](https://www.linkedin.com/in/karol-jezierski/),
|
221 |
-
[Kamil Nonckiewicz](https://www.linkedin.com/in/kamil-nonckiewicz/),
|
222 |
-
[Izabela Babis](https://www.linkedin.com/in/izabela-babis-2274b8105/),
|
223 |
-
[Nina Babis](https://www.linkedin.com/in/nina-babis-00055a140/),
|
224 |
-
[Waldemar Boszko](https://www.linkedin.com/in/waldemarboszko),
|
225 |
-
[Remigiusz Kinas](https://www.linkedin.com/in/remigiusz-kinas/),
|
226 |
-
and many other wonderful researchers and enthusiasts of the AI world.
|
227 |
-
|
228 |
-
Members of the ACK Cyfronet AGH team providing valuable support and expertise:
|
229 |
-
[Szymon Mazurek](https://www.linkedin.com/in/sz-mazurek-ai/).
|
230 |
-
|
231 |
## Contact Us
|
232 |
|
233 |
If you have any questions or suggestions, please use the discussion tab. If you want to contact us directly, join our [Discord SpeakLeash](https://discord.gg/3G9DVM39).
|
|
|
15 |
|
16 |
# Bielik-7B-Instruct-v0.1-3bit-HQQ
|
17 |
|
18 |
+
This repo contains HQQ (3-bit) format model files for [SpeakLeash](https://speakleash.org/)'s [Bielik-7B-Instruct-v0.1](https://huggingface.co/speakleash/Bielik-7B-Instruct-v0.1).
|
19 |
|
20 |
+
<b><u>DISCLAIMER: Be aware that quantised models show reduced response quality and possible hallucinations!</u></b><br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
+
Simple Colab notebook for testing: https://colab.research.google.com/drive/1Al9glPVCuOXbtDsks8cMcuzkuu8YDzpg?usp=sharing
|
23 |
|
24 |
### Model description:
|
25 |
|
26 |
* **Developed by:** [SpeakLeash](https://speakleash.org/)
|
27 |
* **Language:** Polish
|
28 |
* **Model type:** causal decoder-only
|
29 |
+
* **Quant from:** [Bielik-7B-Instruct-v0.1](https://huggingface.co/speakleash/Bielik-7B-Instruct-v0.1)
|
30 |
* **Finetuned from:** [Bielik-7B-v0.1](https://huggingface.co/speakleash/Bielik-7B-v0.1)
|
31 |
* **License:** CC BY NC 4.0 (non-commercial use)
|
32 |
* **Model ref:** speakleash:e38140bea0d48f1218540800bbc67e89
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
## Contact Us
|
35 |
|
36 |
If you have any questions or suggestions, please use the discussion tab. If you want to contact us directly, join our [Discord SpeakLeash](https://discord.gg/3G9DVM39).
|