JacopoAbate
commited on
Commit
•
74d9e0d
1
Parent(s):
e12c0fb
Update README.md
Browse files
README.md
CHANGED
@@ -9,4 +9,46 @@ tags:
|
|
9 |
- it
|
10 |
- mistral
|
11 |
- chatml
|
12 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
- it
|
10 |
- mistral
|
11 |
- chatml
|
12 |
+
---
|
13 |
+
|
14 |
+
# Model Information
|
15 |
+
|
16 |
+
xxxx is a SFT and LoRA finetuned version of Mistral-7B-v0.2
|
17 |
+
|
18 |
+
It has been trained on a mixture of opensource datasets, like SQUAD-it (https://huggingface.co/datasets/squad_it), and some internally made datasets.
|
19 |
+
It is not just a Q&A, it is a Q&A + Context model, with the goal being it being used for RAGs and application in need of a context.
|
20 |
+
|
21 |
+
|
22 |
+
## Usage
|
23 |
+
|
24 |
+
```python
|
25 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
26 |
+
|
27 |
+
device = "cuda"
|
28 |
+
|
29 |
+
model = AutoModelForCausalLM.from_pretrained("MoxoffSpA/xxxx")
|
30 |
+
tokenizer = AutoTokenizer.from_pretrained("MoxoffSpA/xxxx")
|
31 |
+
|
32 |
+
question = """Quanto è alta la torre di Pisa?"""
|
33 |
+
context = """
|
34 |
+
La Torre di Pisa è un campanile del XII secolo, famoso per la sua inclinazione. Alta circa 56 metri.
|
35 |
+
"""
|
36 |
+
prompt = f"Rispondi alla seguente domanda con meno parle possibili basandoti sul contesto fornito. Domanda: {question}, contesto: {context}"
|
37 |
+
|
38 |
+
messages = [
|
39 |
+
{"role": "user", "content": prompt},
|
40 |
+
]
|
41 |
+
|
42 |
+
encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt")
|
43 |
+
|
44 |
+
model_inputs = encodeds.to(device)
|
45 |
+
model.to(device)
|
46 |
+
|
47 |
+
generated_ids = model.generate(model_inputs, max_new_tokens=1000, do_sample=True)
|
48 |
+
decoded = tokenizer.batch_decode(generated_ids)
|
49 |
+
print(decoded[0])
|
50 |
+
```
|
51 |
+
|
52 |
+
|
53 |
+
## The Moxoff Team
|
54 |
+
Marco D'Ambra, Jacopo Abate, Gianpaolo Francesco Trotta
|