m-elio commited on
Commit
506dae4
1 Parent(s): 6a78d31

update model card

Browse files
Files changed (1) hide show
  1. README.md +96 -0
README.md CHANGED
@@ -1,3 +1,99 @@
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-chat-7b-UltraChat-ITA
9
+
10
+ ## Model description
11
+
12
+ <!-- Provide a quick summary of what the model is/does. -->
13
+
14
+ **LLaMAntino-2-chat-7b-UltraChat** is a *Large Language Model (LLM)* that is an instruction-tuned version of **LLaMAntino-2-chat-7b** (an italian-adapted **LLaMA 2 chat**).
15
+ This model aims to provide Italian NLP researchers with an improved model for italian dialogue use cases.
16
+
17
+ The model was trained using *QLora* and using as training data [UltraChat](https://github.com/thunlp/ultrachat) translated to the italian language using [Argos Translate](https://pypi.org/project/argostranslate/1.4.0/).
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:** LLaMA-2-chat
27
+ - **Language(s) (NLP):** Italian
28
+ - **License:** Llama 2 Community License
29
+ - **Finetuned from model:** [swap-uniba/LLaMAntino-2-chat-7b-hf-ITA](https://huggingface.co/swap-uniba/LLaMAntino-2-chat-7b-hf-ITA)
30
+
31
+ ## Prompt Format
32
+
33
+ This prompt format based on the [LLaMA 2 prompt template](https://gpus.llm-utils.org/llama-2-prompt-template/) adapted to the italian language was used:
34
+
35
+ ```python
36
+ "<s>[INST] <<SYS>>\n" \
37
+ "Sei un assistente disponibile, rispettoso e onesto. " \
38
+ "Rispondi sempre nel modo piu' utile possibile, pur essendo sicuro. " \
39
+ "Le risposte non devono includere contenuti dannosi, non etici, razzisti, sessisti, tossici, pericolosi o illegali. " \
40
+ "Assicurati che le tue risposte siano socialmente imparziali e positive. " \
41
+ "Se una domanda non ha senso o non e' coerente con i fatti, spiegane il motivo invece di rispondere in modo non corretto. " \
42
+ "Se non conosci la risposta a una domanda, non condividere informazioni false.\n" \
43
+ "<</SYS>>\n\n" \
44
+ f"{user_msg_1} [/INST] {model_answer_1} </s><s>[INST] {user_msg_2} [/INST] {model_answer_2} </s> ... <s>[INST] {user_msg_N} [/INST] {model_answer_N} </s> "
45
+ ```
46
+
47
+ We recommend using the same prompt in inference to obtain the best results!
48
+
49
+ ## How to Get Started with the Model
50
+
51
+ Below you can find an example of model usage:
52
+
53
+ ```python
54
+ from transformers import AutoModelForCausalLM, AutoTokenizer
55
+
56
+ model_id = "swap-uniba/LLaMAntino-2-chat-7b-hf-UltraChat-ITA"
57
+
58
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
59
+ model = AutoModelForCausalLM.from_pretrained(model_id)
60
+
61
+ user_msg = "Ciao! Come stai?"
62
+
63
+ prompt = "<s>[INST] <<SYS>>\n" \
64
+ "Sei un assistente disponibile, rispettoso e onesto. " \
65
+ "Rispondi sempre nel modo piu' utile possibile, pur essendo sicuro. " \
66
+ "Le risposte non devono includere contenuti dannosi, non etici, razzisti, sessisti, tossici, pericolosi o illegali. " \
67
+ "Assicurati che le tue risposte siano socialmente imparziali e positive. " \
68
+ "Se una domanda non ha senso o non e' coerente con i fatti, spiegane il motivo invece di rispondere in modo non corretto. " \
69
+ "Se non conosci la risposta a una domanda, non condividere informazioni false.\n" \
70
+ "<</SYS>>\n\n" \
71
+ f"{user_msg} [/INST] "
72
+
73
+ input_ids = tokenizer(prompt, return_tensors="pt").input_ids
74
+ outputs = model.generate(input_ids=input_ids, max_length=1024)
75
+
76
+ print(tokenizer.batch_decode(outputs.detach().cpu().numpy()[:, input_ids.shape[1]:], skip_special_tokens=True)[0])
77
+ ```
78
+
79
+ If you are facing issues when loading the model, you can try to load it quantized:
80
+
81
+ ```python
82
+ model = AutoModelForCausalLM.from_pretrained(model_id, load_in_8bit=True)
83
+ ```
84
+
85
+ *Note*: The model loading strategy above requires the [*bitsandbytes*](https://pypi.org/project/bitsandbytes/) and [*accelerate*](https://pypi.org/project/accelerate/) libraries
86
+
87
+ ## Evaluation
88
+
89
+ <!-- This section describes the evaluation protocols and provides the results. -->
90
+
91
+ *Coming soon*!
92
+
93
+ ## Citation
94
+
95
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
96
+
97
+ If you use this model in your research, please cite the following:
98
+
99
+ *Coming soon*!