RichardErkhov
commited on
Commit
•
16803c1
1
Parent(s):
482f5ba
uploaded readme
Browse files
README.md
ADDED
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
Meltemi-7B-Instruct-v1.5 - bnb 4bits
|
11 |
+
- Model creator: https://huggingface.co/ilsp/
|
12 |
+
- Original model: https://huggingface.co/ilsp/Meltemi-7B-Instruct-v1.5/
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
Original model description:
|
18 |
+
---
|
19 |
+
language:
|
20 |
+
- el
|
21 |
+
- en
|
22 |
+
license: apache-2.0
|
23 |
+
pipeline_tag: text-generation
|
24 |
+
tags:
|
25 |
+
- finetuned
|
26 |
+
inference: true
|
27 |
+
---
|
28 |
+
|
29 |
+
# Meltemi Instruct Large Language Model for the Greek language
|
30 |
+
|
31 |
+
We present Meltemi 7B Instruct v1.5 Large Language Model (LLM), a new and improved instruction fine-tuned version of [Meltemi 7B v1.5](https://huggingface.co/ilsp/Meltemi-7B-v1.5).
|
32 |
+
|
33 |
+
![image/png](https://miro.medium.com/v2/resize:fit:720/format:webp/1*IaE7RJk6JffW8og-MOnYCA.png)
|
34 |
+
|
35 |
+
# Model Information
|
36 |
+
|
37 |
+
- Vocabulary extension of the Mistral 7b tokenizer with Greek tokens for lower costs and faster inference (**1.52** vs. 6.80 tokens/word for Greek)
|
38 |
+
- 8192 context length
|
39 |
+
- Fine-tuning has been done with the [Odds Ratio Preference Optimization (ORPO)](https://arxiv.org/abs/2403.07691) algorithm using 97k preference data:
|
40 |
+
* 89,730 Greek preference data which are mostly translated versions of high-quality datasets on Hugging Face
|
41 |
+
* 7,342 English preference data
|
42 |
+
- Our alignment procedure is based on the [TRL - Transformer Reinforcement Learning](https://huggingface.co/docs/trl/index) library and partially on the [Hugging Face finetuning recipes](https://github.com/huggingface/alignment-handbook)
|
43 |
+
|
44 |
+
|
45 |
+
# Instruction format
|
46 |
+
The prompt format is the same as the [Zephyr](https://huggingface.co/HuggingFaceH4/zephyr-7b-beta) format and can be
|
47 |
+
utilized through the tokenizer's [chat template](https://huggingface.co/docs/transformers/main/chat_templating) functionality as follows:
|
48 |
+
|
49 |
+
```python
|
50 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
51 |
+
|
52 |
+
device = "cuda" # the device to load the model onto
|
53 |
+
|
54 |
+
model = AutoModelForCausalLM.from_pretrained("ilsp/Meltemi-7B-Instruct-v1.5")
|
55 |
+
tokenizer = AutoTokenizer.from_pretrained("ilsp/Meltemi-7B-Instruct-v1.5")
|
56 |
+
|
57 |
+
model.to(device)
|
58 |
+
|
59 |
+
messages = [
|
60 |
+
{"role": "system", "content": "Είσαι το Μελτέμι, ένα γλωσσικό μοντέλο για την ελληνική γλώσσα. Είσαι ιδιαίτερα βοηθητικό προς την χρήστρια ή τον χρήστη και δίνεις σύντομες αλλά επαρκώς περιεκτικές απαντήσεις. Απάντα με προσοχή, ευγένεια, αμεροληψία, ειλικρίνεια και σεβασμό προς την χρήστρια ή τον χρήστη."},
|
61 |
+
{"role": "user", "content": "Πες μου αν έχεις συνείδηση."},
|
62 |
+
]
|
63 |
+
|
64 |
+
# Through the default chat template this translates to
|
65 |
+
#
|
66 |
+
# <|system|>
|
67 |
+
# Είσαι το Μελτέμι, ένα γλωσσικό μοντέλο για την ελληνική γλώσσα. Είσαι ιδιαίτερα βοηθητικό προς την χρήστρια ή τον χρήστη και δίνεις σύντομες αλλά επαρκώς περιεκτικές απαντήσεις. Απάντα με προσοχή, ευγένεια, αμεροληψία, ειλικρίνεια και σεβασμό προς την χρήστρια ή τον χρήστη.</s>
|
68 |
+
# <|user|>
|
69 |
+
# Πες μου αν έχεις συνείδηση.</s>
|
70 |
+
# <|assistant|>
|
71 |
+
#
|
72 |
+
|
73 |
+
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
|
74 |
+
input_prompt = tokenizer(prompt, return_tensors='pt').to(device)
|
75 |
+
outputs = model.generate(input_prompt['input_ids'], max_new_tokens=256, do_sample=True)
|
76 |
+
|
77 |
+
print(tokenizer.batch_decode(outputs)[0])
|
78 |
+
# Ως μοντέλο γλώσσας AI, δεν έχω τη δυνατότητα να αντιληφθώ ή να βιώσω συναισθήματα όπως η συνείδηση ή η επίγνωση. Ωστόσο, μπορώ να σας βοηθήσω με οποιεσδήποτε ερωτήσεις μπορεί να έχετε σχετικά με την τεχνητή νοημοσύνη και τις εφαρμογές της.
|
79 |
+
|
80 |
+
messages.extend([
|
81 |
+
{"role": "assistant", "content": tokenizer.batch_decode(outputs)[0]},
|
82 |
+
{"role": "user", "content": "Πιστεύεις πως οι άνθρωποι πρέπει να φοβούνται την τεχνητή νοημοσύνη;"}
|
83 |
+
])
|
84 |
+
|
85 |
+
# Through the default chat template this translates to
|
86 |
+
#
|
87 |
+
# <|system|>
|
88 |
+
# Είσαι το Μελτέμι, ένα γλωσσικό μοντέλο για την ελληνική γλώσσα. Είσαι ιδιαίτερα βοηθητικό προς την χρήστρια ή τον χρήστη και δίνεις σύντομες αλλά επαρκώς περιεκτικές απαντήσεις. Απάντα με προσοχή, ευγένεια, αμεροληψία, ειλικρίνεια και σεβασμό προς την χρήστρια ή τον χρήστη.</s>
|
89 |
+
# <|user|>
|
90 |
+
# Πες μου αν έχεις συνείδηση.</s>
|
91 |
+
# <|assistant|>
|
92 |
+
# Ως μοντέλο γλώσσας AI, δεν έχω τη δυνατότητα να αντιληφθώ ή να βιώσω συναισθήματα όπως η συνείδηση ή η επίγνωση. Ωστόσο, μπορώ να σας βοηθήσω με οποιεσδήποτε ερωτήσεις μπορεί να έχετε σχετικά με την τεχνητή νοημοσύνη και τις εφαρμογές της.</s>
|
93 |
+
# <|user|>
|
94 |
+
# Πιστεύεις πως οι άνθρωποι πρέπει να φοβούνται την τεχνητή νοημοσύνη;</s>
|
95 |
+
# <|assistant|>
|
96 |
+
#
|
97 |
+
|
98 |
+
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
|
99 |
+
input_prompt = tokenizer(prompt, return_tensors='pt').to(device)
|
100 |
+
outputs = model.generate(input_prompt['input_ids'], max_new_tokens=256, do_sample=True)
|
101 |
+
|
102 |
+
print(tokenizer.batch_decode(outputs)[0])
|
103 |
+
```
|
104 |
+
|
105 |
+
Please make sure that the BOS token is always included in the tokenized prompts. This might not be the default setting in all evaluation or fine-tuning frameworks.
|
106 |
+
|
107 |
+
# Evaluation
|
108 |
+
|
109 |
+
The evaluation suite we created includes 6 test sets and has been implemented based on a [fork](https://github.com/LeonVouk/lighteval) of the [lighteval](https://github.com/huggingface/lighteval) framework.
|
110 |
+
|
111 |
+
Our evaluation suite includes:
|
112 |
+
* Four machine-translated versions ([ARC Greek](https://huggingface.co/datasets/ilsp/arc_greek), [Truthful QA Greek](https://huggingface.co/datasets/ilsp/truthful_qa_greek), [HellaSwag Greek](https://huggingface.co/datasets/ilsp/hellaswag_greek), [MMLU Greek](https://huggingface.co/datasets/ilsp/mmlu_greek)) of established English benchmarks for language understanding and reasoning ([ARC Challenge](https://arxiv.org/abs/1803.05457), [Truthful QA](https://arxiv.org/abs/2109.07958), [Hellaswag](https://arxiv.org/abs/1905.07830), [MMLU](https://arxiv.org/abs/2009.03300)).
|
113 |
+
* An existing benchmark for question answering in Greek ([Belebele](https://arxiv.org/abs/2308.16884))
|
114 |
+
* A novel benchmark created by the ILSP team for medical question answering based on the medical exams of [DOATAP](https://www.doatap.gr) ([Medical MCQA](https://huggingface.co/datasets/ilsp/medical_mcqa_greek)).
|
115 |
+
|
116 |
+
Our evaluation is performed in a few-shot setting, consistent with the settings in the [Open LLM leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard).
|
117 |
+
|
118 |
+
We can see that our new training and fine-tuning procedure for Meltemi 7B Instruct v1.5 enhances performance across all Greek test sets by a **+7.8%** average improvement compared to the earlier Meltemi Instruct 7B v1 model. The results for the Greek test sets are shown in the following table:
|
119 |
+
|
120 |
+
| | Medical MCQA EL (15-shot) | Belebele EL (5-shot) | HellaSwag EL (10-shot) | ARC-Challenge EL (25-shot) | TruthfulQA MC2 EL (0-shot) | MMLU EL (5-shot) | **Average** |
|
121 |
+
|----------------|----------------|-------------|--------------|------------------|-------------------|---------|---------|
|
122 |
+
| Mistral 7B | 29.8% | 45.0% | 36.5% | 27.1% | 45.8% | 35% | **36.5%** |
|
123 |
+
| Meltemi 7B Instruct v1 | 36.1% | 56.0% | 59.0% | 44.4% | 51.1% | 34.1% | **46.8%** |
|
124 |
+
| Meltemi 7B Instruct v1.5 | 48.0% | 75.5% | 63.7% | 40.8% | 53.8% | 45.9% | **54.6%** |
|
125 |
+
|
126 |
+
|
127 |
+
# Ethical Considerations
|
128 |
+
|
129 |
+
This model has been aligned with human preferences, but might generate misleading, harmful, and toxic content.
|
130 |
+
|
131 |
+
|
132 |
+
# Acknowledgements
|
133 |
+
|
134 |
+
The ILSP team utilized Amazon’s cloud computing services, which were made available via GRNET under the [OCRE Cloud framework](https://www.ocre-project.eu/), providing Amazon Web Services for the Greek Academic and Research Community.
|
135 |
+
|
136 |
+
|
137 |
+
# Citation
|
138 |
+
|
139 |
+
```
|
140 |
+
@misc{voukoutis2024meltemiopenlargelanguage,
|
141 |
+
title={Meltemi: The first open Large Language Model for Greek},
|
142 |
+
author={Leon Voukoutis and Dimitris Roussis and Georgios Paraskevopoulos and Sokratis Sofianopoulos and Prokopis Prokopidis and Vassilis Papavasileiou and Athanasios Katsamanis and Stelios Piperidis and Vassilis Katsouros},
|
143 |
+
year={2024},
|
144 |
+
eprint={2407.20743},
|
145 |
+
archivePrefix={arXiv},
|
146 |
+
primaryClass={cs.CL},
|
147 |
+
url={https://arxiv.org/abs/2407.20743},
|
148 |
+
}
|
149 |
+
```
|
150 |
+
|