efederici commited on
Commit
029515b
1 Parent(s): 2acf7af

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +102 -0
README.md ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - sft
4
+ - it
5
+ - mistral
6
+ - chatml
7
+ - axolotl
8
+ model-index:
9
+ - name: maestrale-chat-v0.3-beta
10
+ results: []
11
+ license: cc-by-nc-4.0
12
+ language:
13
+ - it
14
+ prompt_template: >-
15
+ <|im_start|>system {system_message}<|im_end|> <|im_start|>user
16
+ {prompt}<|im_end|> <|im_start|>assistant
17
+ ---
18
+
19
+ <div style="width: auto; margin-left: auto; margin-right: auto">
20
+ <img src="https://i.imgur.com/ITs0WjZ.jpg" alt="Mii-LLM" style="width: 100%; min-width: 400px; display: block; margin: auto;">
21
+ </div>
22
+ <div style="display: flex; justify-content: space-between; width: 100%;">
23
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
24
+ <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>
25
+ </div>
26
+ </div>
27
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
28
+ <!-- header end -->
29
+
30
+ # Maestrale chat beta ༄
31
+
32
+ By @efederici and @mferraretto
33
+
34
+ ## Model description
35
+
36
+ - **Language Model**: Mistral-7b for the Italian language, continued pre-training for Italian on a curated large-scale high-quality corpus.
37
+ - **Fine-Tuning**: SFT performed on convs/instructions for three epochs.
38
+
39
+ **v0.3**
40
+ - Function calling
41
+ - Reduced default system prompt to avoid wasting tokens (pre-alignment)
42
+
43
+ This model uses ChatML prompt format:
44
+ ```
45
+ <|im_start|>system
46
+ Sei un assistente utile.<|im_end|>
47
+ <|im_start|>user
48
+ {prompt}<|im_end|>
49
+ <|im_start|>assistant
50
+ ```
51
+
52
+ ## Usage:
53
+ ```python
54
+ from transformers import (
55
+ AutoTokenizer,
56
+ AutoModelForCausalLM,
57
+ GenerationConfig,
58
+ TextStreamer
59
+ )
60
+ import torch
61
+
62
+ tokenizer = AutoTokenizer.from_pretrained("mii-llm/maestrale-chat-v0.3-beta")
63
+ model = AutoModelForCausalLM.from_pretrained("mii-llm/maestrale-chat-v0.3-beta", load_in_8bit=True, device_map="auto")
64
+
65
+ gen = GenerationConfig(
66
+ do_sample=True,
67
+ temperature=0.7,
68
+ repetition_penalty=1.2,
69
+ top_k=50,
70
+ top_p=0.95,
71
+ max_new_tokens=500,
72
+ pad_token_id=tokenizer.eos_token_id,
73
+ eos_token_id=tokenizer.convert_tokens_to_ids("<|im_end|>")
74
+ )
75
+
76
+ messages = [
77
+ {"role": "system", "content": "Sei un assistente utile."},
78
+ {"role": "user", "content": "{prompt}"}
79
+ ]
80
+
81
+ with torch.no_grad(), torch.backends.cuda.sdp_kernel(
82
+ enable_flash=True,
83
+ enable_math=False,
84
+ enable_mem_efficient=False
85
+ ):
86
+ temp = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
87
+ inputs = tokenizer(temp, return_tensors="pt").to("cuda")
88
+
89
+ streamer = TextStreamer(tokenizer, skip_prompt=True)
90
+
91
+ _ = model.generate(
92
+ **inputs,
93
+ streamer=streamer,
94
+ generation_config=gen
95
+ )
96
+ ```
97
+
98
+ ## Intended uses & limitations
99
+
100
+ It's an alpha version, it's not `aligned`. It's a first test. We are working on alignment data and evals.
101
+
102
+ [<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)