update model card
Browse files
README.md
CHANGED
@@ -1,3 +1,92 @@
|
|
1 |
---
|
2 |
license: llama2
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: llama2
|
3 |
+
language:
|
4 |
+
- it
|
5 |
+
tags:
|
6 |
+
- text-generation-inference
|
7 |
---
|
8 |
+
# Model Card for LLaMAntino-2-13b-evalita
|
9 |
+
|
10 |
+
## Model description
|
11 |
+
|
12 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
13 |
+
|
14 |
+
**LLaMAntino-2-13b-evalita** is a *Large Language Model (LLM)* that is an instruction-tuned version of **LLaMAntino-2-13b** (an italian-adapted **LLaMA 2**).
|
15 |
+
This model aims to provide Italian NLP researchers with a tool to tackle tasks such as *sentiment analysis* and *text categorization*.
|
16 |
+
|
17 |
+
The model was trained following the methodology used for [Alpaca](https://github.com/tatsu-lab/stanford_alpaca) and using as training data [EVALITA 2023 tasks](https://www.evalita.it/campaigns/evalita-2023/tasks/) formatted in an instruction-following style.
|
18 |
+
If you are interested in more details regarding the training procedure, you can find the code we used at the following link:
|
19 |
+
- **Repository:** https://github.com/swapUniba/LLaMAntino
|
20 |
+
|
21 |
+
**NOTICE**: the code has not been released yet, we apologize for the delay, it will be available asap!
|
22 |
+
|
23 |
+
- **Developed by:** Pierpaolo Basile, Elio Musacchio, Marco Polignano, Lucia Siciliani, Giuseppe Fiameni, Giovanni Semeraro
|
24 |
+
- **Funded by:** PNRR project FAIR - Future AI Research
|
25 |
+
- **Compute infrastructure:** [Leonardo](https://www.hpc.cineca.it/systems/hardware/leonardo/) supercomputer
|
26 |
+
- **Model type:** Large Language Model (LLM)
|
27 |
+
- **Language(s) (NLP):** Italian
|
28 |
+
- **License:** Llama 2 Community License
|
29 |
+
- **Finetuned from model:** [swap-uniba/LLaMAntino-2-13b-hf-ITA](https://huggingface.co/swap-uniba/LLaMAntino-2-13b-hf-ITA)
|
30 |
+
|
31 |
+
## Prompt Format
|
32 |
+
|
33 |
+
This prompt format based on the Alpaca model was used for fine-tuning:
|
34 |
+
|
35 |
+
```python
|
36 |
+
"Di seguito è riportata un'istruzione che descrive un'attività, abbinata ad un input che fornisce ulteriore informazione. " \
|
37 |
+
"Scrivi una risposta che soddisfi adeguatamente la richiesta.\n\n" \
|
38 |
+
f"### Istruzione:\n{instruction}\n\n### Input:\n{input}\n\n### Risposta:\n{response}"
|
39 |
+
```
|
40 |
+
|
41 |
+
We recommend using this same prompt in inference to obtain the best results!
|
42 |
+
|
43 |
+
## How to Get Started with the Model
|
44 |
+
|
45 |
+
Below you can find an example of model usage:
|
46 |
+
|
47 |
+
```python
|
48 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
49 |
+
|
50 |
+
model_id = "swap-uniba/LLaMAntino-2-13b-hf-evalita-ITA"
|
51 |
+
|
52 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
53 |
+
model = AutoModelForCausalLM.from_pretrained(model_id)
|
54 |
+
|
55 |
+
instruction_text = "Categorizza le emozioni espresse nel testo fornito in input o determina l'assenza di emozioni. " \
|
56 |
+
"Puoi classificare il testo come neutrale o identificare una o più delle seguenti emozioni: " \
|
57 |
+
"rabbia, anticipazione, disgusto, paura, gioia, tristezza, sorpresa, fiducia, amore."
|
58 |
+
input_text = "Non me lo aspettavo proprio, ma oggi è stata una bellissima giornata, sono contentissimo!"
|
59 |
+
|
60 |
+
prompt = "Di seguito è riportata un'istruzione che descrive un'attività, accompagnata da un input che aggiunge ulteriore informazione. " \
|
61 |
+
f"Scrivi una risposta che completi adeguatamente la richiesta.\n\n" \
|
62 |
+
f"### Istruzione:\n{instruction_text}\n\n" \
|
63 |
+
f"### Input:\n{input_text}\n\n" \
|
64 |
+
f"### Risposta:\n"
|
65 |
+
|
66 |
+
input_ids = tokenizer(prompt, return_tensors="pt").input_ids
|
67 |
+
outputs = model.generate(input_ids=input_ids)
|
68 |
+
|
69 |
+
print(tokenizer.batch_decode(outputs.detach().cpu().numpy(), skip_special_tokens=True)[0][len(prompt):])
|
70 |
+
```
|
71 |
+
|
72 |
+
If you are facing issues when loading the model, you can try to load it quantized:
|
73 |
+
|
74 |
+
```python
|
75 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, token=token, load_in_8bit=True)
|
76 |
+
```
|
77 |
+
|
78 |
+
*Note*: The model loading strategy above requires the [*bitsandbytes*](https://pypi.org/project/bitsandbytes/) and [*accelerate*](https://pypi.org/project/accelerate/) libraries
|
79 |
+
|
80 |
+
## Evaluation
|
81 |
+
|
82 |
+
<!-- This section describes the evaluation protocols and provides the results. -->
|
83 |
+
|
84 |
+
*Coming soon*!
|
85 |
+
|
86 |
+
## Citation
|
87 |
+
|
88 |
+
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
89 |
+
|
90 |
+
If you use this model in your research, please cite the following:
|
91 |
+
|
92 |
+
*Coming soon*!
|