Update README.md
Browse files
README.md
CHANGED
|
@@ -10,6 +10,54 @@ tags:
|
|
| 10 |
- trl
|
| 11 |
base_model: unsloth/gemma-2b-it-bnb-4bit
|
| 12 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
# Uploaded model
|
| 15 |
|
|
|
|
| 10 |
- trl
|
| 11 |
base_model: unsloth/gemma-2b-it-bnb-4bit
|
| 12 |
---
|
| 13 |
+
## SQuAD-it Evaluation
|
| 14 |
+
|
| 15 |
+
The Stanford Question Answering Dataset (SQuAD) in Italian (SQuAD-it) is used to evaluate the model's reading comprehension and question-answering capabilities. The following table presents the F1 score and Exact Match (EM) metrics:
|
| 16 |
+
|
| 17 |
+
| Model | F1 Score | Exact Match (EM) |
|
| 18 |
+
|----------------------------------------------|--------------|----------------------|
|
| 19 |
+
| **FinancialSupport/hellfire-2b** | **44.06%** | **26.27%** |
|
| 20 |
+
|
| 21 |
+
## How to Use
|
| 22 |
+
How to use hellfire-2b
|
| 23 |
+
|
| 24 |
+
```python
|
| 25 |
+
import os
|
| 26 |
+
from unsloth import FastLanguageModel
|
| 27 |
+
import torch
|
| 28 |
+
|
| 29 |
+
os.environ['TOKENIZERS_PARALLELISM'] = 'TRUE'
|
| 30 |
+
|
| 31 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
| 32 |
+
model_name = "hellfire-2b", # YOUR MODEL YOU USED FOR TRAINING
|
| 33 |
+
max_seq_length = 10000,
|
| 34 |
+
dtype = torch.bfloat16,
|
| 35 |
+
load_in_4bit = True,
|
| 36 |
+
)
|
| 37 |
+
FastLanguageModel.for_inference(model) # Enable native 2x faster inference
|
| 38 |
+
|
| 39 |
+
alpaca_prompt = """
|
| 40 |
+
Di seguito ti verrà fornito un contesto e poi una domanda. il tuo compito è quello di rispondere alla domanda basandoti esclusivamente sul contesto
|
| 41 |
+
### Contesto:
|
| 42 |
+
{}
|
| 43 |
+
### Domanda:
|
| 44 |
+
{}
|
| 45 |
+
### Risposta:
|
| 46 |
+
{}
|
| 47 |
+
"""
|
| 48 |
+
|
| 49 |
+
inputs = tokenizer(
|
| 50 |
+
[
|
| 51 |
+
alpaca_prompt.format(
|
| 52 |
+
"La torre degli Asinelli è una delle cosiddette due torri di Bologna, simbolo della città, situate in piazza di porta Ravegnana, all'incrocio tra le antiche strade San Donato (ora via Zamboni), San Vitale, Maggiore e Castiglione. Eretta, secondo la tradizione, fra il 1109 e il 1119 dal nobile Gherardo Asinelli, la torre è alta 97,20 metri, pende verso ovest per 2,23 metri e presenta all'interno una scalinata composta da 498 gradini. Ancora non si può dire con certezza quando e da chi fu costruita la torre degli Asinelli. Si presume che la torre debba il proprio nome a Gherardo Asinelli, il nobile cavaliere di fazione ghibellina al quale se ne attribuisce la costruzione, iniziata secondo una consolidata tradizione l'11 ottobre 1109 e terminata dieci anni dopo, nel 1119.", # instruction
|
| 53 |
+
"Quale è alta la torre degli Asinelli?", # input
|
| 54 |
+
"", # output - leave this blank for generation!
|
| 55 |
+
)
|
| 56 |
+
], return_tensors = "pt").to("cuda")
|
| 57 |
+
|
| 58 |
+
outputs = model.generate(**inputs, max_new_tokens = 64, use_cache = False)
|
| 59 |
+
print(tokenizer.batch_decode(outputs))
|
| 60 |
+
```
|
| 61 |
|
| 62 |
# Uploaded model
|
| 63 |
|