Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,96 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: cc-by-nc-4.0
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-nc-4.0
|
| 3 |
+
---
|
| 4 |
+
<div style="width: auto; margin-left: auto; margin-right: auto">
|
| 5 |
+
<img src="https://i.imgur.com/3MUzS0kl.jpg" alt="Mii-LLM" style="width: 100%; min-width: 400px; display: block; margin: auto;">
|
| 6 |
+
</div>
|
| 7 |
+
<div style="display: flex; justify-content: space-between; width: 100%;">
|
| 8 |
+
<div style="display: flex; flex-direction: column; align-items: flex-end;">
|
| 9 |
+
<p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://buy.stripe.com/8wM00Sf3vb3H3pmfYY">Want to contribute? Please donate! This will let us work on better datasets and models!</a></p>
|
| 10 |
+
</div>
|
| 11 |
+
</div>
|
| 12 |
+
<hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
|
| 13 |
+
<!-- header end -->
|
| 14 |
+
|
| 15 |
+
# Maestrale chat beta ༄
|
| 16 |
+
|
| 17 |
+
By @efederici and @mferraretto
|
| 18 |
+
|
| 19 |
+
## Model description
|
| 20 |
+
|
| 21 |
+
- **Language Model**: Mistral-7b for the Italian language, continued pre-training for Italian on a curated large-scale high-quality corpus, merged with [occiglot](https://huggingface.co/occiglot/occiglot-7b-eu5).
|
| 22 |
+
- **Fine-Tuning**: SFT performed on 1.7M convs/instructions for 2 epochs.
|
| 23 |
+
|
| 24 |
+
**v0.4**
|
| 25 |
+
- Agent
|
| 26 |
+
- Improved truthfullness
|
| 27 |
+
- Improved Math & Reasoning capabilities
|
| 28 |
+
- More latin translations, poems, ...
|
| 29 |
+
|
| 30 |
+
This model uses ChatML prompt format:
|
| 31 |
+
```
|
| 32 |
+
<|im_start|>system
|
| 33 |
+
Sei un assistente utile.<|im_end|>
|
| 34 |
+
<|im_start|>user
|
| 35 |
+
{prompt}<|im_end|>
|
| 36 |
+
<|im_start|>assistant
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
## Scores
|
| 40 |
+
|
| 41 |
+
| Tasks |Version|Filter|n-shot| Metric |Value | |Stderr|
|
| 42 |
+
|------------|------:|------|-----:|--------|-----:|---|-----:|
|
| 43 |
+
|hellaswag_it| 1|none | 0|acc |0.5220|± |0.0052|
|
| 44 |
+
| | |none | 0|acc_norm|0.6887|± |0.0048|
|
| 45 |
+
|arc_it | 1|none | 0|acc |0.1762|± |0.0111|
|
| 46 |
+
| | |none | 0|acc_norm|0.5090|± |0.0146|
|
| 47 |
+
|m_mmlu_it | 0|none | 5|acc |0.569 |± |0.0043|
|
| 48 |
+
|
| 49 |
+
## Usage:
|
| 50 |
+
|
| 51 |
+
```python
|
| 52 |
+
from transformers import (
|
| 53 |
+
AutoTokenizer,
|
| 54 |
+
AutoModelForCausalLM,
|
| 55 |
+
GenerationConfig,
|
| 56 |
+
TextStreamer
|
| 57 |
+
)
|
| 58 |
+
import torch
|
| 59 |
+
|
| 60 |
+
tokenizer = AutoTokenizer.from_pretrained("mii-llm/maestrale-chat-v0.4-alpha-sft")
|
| 61 |
+
model = AutoModelForCausalLM.from_pretrained("mii-llm/maestrale-chat-v0.4-alpha-sft", load_in_8bit=True, device_map="auto")
|
| 62 |
+
|
| 63 |
+
gen = GenerationConfig(
|
| 64 |
+
do_sample=True,
|
| 65 |
+
temperature=0.7,
|
| 66 |
+
repetition_penalty=1.2,
|
| 67 |
+
top_k=50,
|
| 68 |
+
top_p=0.95,
|
| 69 |
+
max_new_tokens=500,
|
| 70 |
+
pad_token_id=tokenizer.eos_token_id,
|
| 71 |
+
eos_token_id=tokenizer.convert_tokens_to_ids("<|im_end|>")
|
| 72 |
+
)
|
| 73 |
+
|
| 74 |
+
streamer = TextStreamer(tokenizer, skip_prompt=True)
|
| 75 |
+
|
| 76 |
+
messages = [
|
| 77 |
+
{"role": "system", "content": "Sei un assistente utile."},
|
| 78 |
+
{"role": "user", "content": "{prompt}"}
|
| 79 |
+
]
|
| 80 |
+
|
| 81 |
+
with torch.no_grad():
|
| 82 |
+
temp = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 83 |
+
inputs = tokenizer(temp, return_tensors="pt").to("cuda")
|
| 84 |
+
|
| 85 |
+
_ = model.generate(
|
| 86 |
+
**inputs,
|
| 87 |
+
streamer=streamer,
|
| 88 |
+
generation_config=gen
|
| 89 |
+
)
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
## Intended uses & limitations
|
| 93 |
+
|
| 94 |
+
It's an alpha version; it's not `safe`, but it can refuse to answer.
|
| 95 |
+
|
| 96 |
+
[<img src="https://raw.githubusercontent.com/OpenAccess-AI-Collective/axolotl/main/image/axolotl-badge-web.png" alt="Built with Axolotl" width="200" height="32"/>](https://github.com/OpenAccess-AI-Collective/axolotl)
|