Update README.md
Browse files
README.md
CHANGED
@@ -1,7 +1,62 @@
|
|
1 |
---
|
|
|
2 |
license: apache-2.0
|
3 |
---
|
4 |
|
5 |
-
|
6 |
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
library_name: transformers
|
3 |
license: apache-2.0
|
4 |
---
|
5 |
|
6 |
+
# Model card for Mistral-Instruct-Ukrainian-SFT
|
7 |
|
8 |
+
Supervised finetuning of Mistral-7B-Instruct-v0.2 on Ukrainian datasets.
|
9 |
+
|
10 |
+
|
11 |
+
## Instruction format
|
12 |
+
|
13 |
+
In order to leverage instruction fine-tuning, your prompt should be surrounded by `[INST]` and `[/INST]` tokens.
|
14 |
+
|
15 |
+
E.g.
|
16 |
+
```
|
17 |
+
text = "[INST]Відповідайте лише буквою правильної відповіді: Елементи експресіонізму наявні у творі: A. «Камінний хрест», B. «Інститутка», C. «Маруся», D. «Людина»[/INST]"
|
18 |
+
```
|
19 |
+
|
20 |
+
This format is available as a [chat template](https://huggingface.co/docs/transformers/main/chat_templating) via the `apply_chat_template()` method:
|
21 |
+
|
22 |
+
## Model Architecture
|
23 |
+
This instruction model is based on Mistral-7B-v0.2, a transformer model with the following architecture choices:
|
24 |
+
- Grouped-Query Attention
|
25 |
+
- Sliding-Window Attention
|
26 |
+
- Byte-fallback BPE tokenizer
|
27 |
+
|
28 |
+
## Datasets
|
29 |
+
- [UA-SQUAD](https://huggingface.co/datasets/FIdo-AI/ua-squad/resolve/main/ua_squad_dataset.json)
|
30 |
+
- [Ukrainian StackExchange](https://huggingface.co/datasets/zeusfsx/ukrainian-stackexchange)
|
31 |
+
- [UAlpaca Dataset](https://github.com/robinhad/kruk/blob/main/data/cc-by-nc/alpaca_data_translated.json)
|
32 |
+
- [Ukrainian Subset from Belebele Dataset](https://github.com/facebookresearch/belebele)
|
33 |
+
- [Ukrainian Subset from XQA](https://github.com/thunlp/XQA)
|
34 |
+
|
35 |
+
## 💻 Usage
|
36 |
+
|
37 |
+
```python
|
38 |
+
!pip install -qU transformers accelerate
|
39 |
+
|
40 |
+
from transformers import AutoTokenizer
|
41 |
+
import transformers
|
42 |
+
import torch
|
43 |
+
|
44 |
+
model = "Radu1999/Mistral-Instruct-Ukrainian-SFT"
|
45 |
+
messages = [{"role": "user", "content": "What is a large language model?"}]
|
46 |
+
|
47 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
48 |
+
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
49 |
+
pipeline = transformers.pipeline(
|
50 |
+
"text-generation",
|
51 |
+
model=model,
|
52 |
+
torch_dtype=torch.bfloat16,
|
53 |
+
device_map="auto",
|
54 |
+
)
|
55 |
+
|
56 |
+
outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
57 |
+
print(outputs[0]["generated_text"])
|
58 |
+
```
|
59 |
+
|
60 |
+
## Author
|
61 |
+
|
62 |
+
Radu Chivereanu
|