andreabac3 commited on
Commit
7d6f852
1 Parent(s): 920910a

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +112 -0
README.md ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: gpl-3.0
3
+ datasets:
4
+ - andreabac3/MedQuaAD-Italian-Fauno-Baize
5
+ - andreabac3/StackOverflow-Italian-Fauno-Baize
6
+ - andreabac3/Quora-Italian-Fauno-Baize
7
+ - teelinsan/camoscio_cleaned
8
+ language:
9
+ - it
10
+ - en
11
+ ---
12
+ # Fauno - Italian LLM
13
+
14
+ ![image](fauno.drawio.png)
15
+
16
+ Get ready to meet Fauno - the Italian language model crafted by the [RSTLess Research Group](https://rstless-lab.netlify.app/) from the Sapienza University of Rome.
17
+
18
+ The talented research team behind Fauno includes [Andrea Bacciu](https://andreabac3.github.io/), [Dr. Giovanni Trappolini](https://sites.google.com/view/giovannitrappolini), [Andrea Santilli](https://www.santilli.xyz/), and [Professor Fabrizio Silvestri](https://sites.google.com/diag.uniroma1.it/fabriziosilvestri/home).
19
+
20
+ Fauno represents a cutting-edge development in open-source Italian Large Language Modeling. It's trained on extensive Italian synthetic datasets, encompassing a wide range of fields such as medical data 🩺, technical content from Stack Overflow 💻, Quora discussions 💬, and Alpaca data 🦙 translated into Italian.
21
+
22
+ Hence, our model is able to answer to your questions in Italian 🙋, fix your buggy code 🐛 and understand a minimum of medical literature 💊.
23
+
24
+ ## The 🇮🇹 open-source version of chatGPT!
25
+ Discover the capabilities of Fauno and experience the evolution of Italian language models for yourself.
26
+ ![demo](screenshot_demo.png)
27
+
28
+ ### Why Fauno?
29
+ We started with a model called Baize, named after a legendary creature from Chinese literature. Continuing along this thematic line, we developed our Italian model based on Baize and named it Fauno, inspired by an iconic figure from Roman mythology. This choice underlines the link between the two models, while maintaining a distinctive identity rooted in Italian culture.
30
+
31
+ ## 🔎 Model's details
32
+ Fauno is a fine-tuned version of the LoRa weights of [Baize](https://github.com/project-baize/baize-chatbot), that is an improved version of [LLama](https://github.com/facebookresearch/llama).
33
+
34
+ We translated and cleaned the data of Baize, and then we fine-tuned the 7b, 13b model using a single RTX A6000 (48GB of VRAM) with 19 hours for one epoch.
35
+
36
+ Fauno 13B and 30B are coming soon!
37
+
38
+ ## Model initialization
39
+ ```python
40
+ from transformers import LlamaTokenizer, LlamaForCausalLM, GenerationConfig
41
+ from peft import PeftModel
42
+
43
+ tokenizer = LlamaTokenizer.from_pretrained("decapoda-research/llama-7b-hf")
44
+ model = LlamaForCausalLM.from_pretrained(
45
+ "decapoda-research/llama-7b-hf",
46
+ load_in_8bit=True,
47
+ device_map="auto",
48
+ )
49
+ model = PeftModel.from_pretrained(model, "andreabac3/Fauno-Italian-LLM-7B")
50
+ model.eval()
51
+ ```
52
+
53
+ ## Inference
54
+ ```python
55
+ def evaluate(question: str) -> str:
56
+ prompt = f"The conversation between human and AI assistant.\n[|Human|] {question}.\n[|AI|] "
57
+ inputs = tokenizer(prompt, return_tensors="pt")
58
+ input_ids = inputs["input_ids"].cuda()
59
+ generation_output = model.generate(
60
+ input_ids=input_ids,
61
+ generation_config=generation_config,
62
+ return_dict_in_generate=True,
63
+ output_scores=True,
64
+ max_new_tokens=256
65
+ )
66
+ output = tokenizer.decode(generation_output.sequences[0]).split("[|AI|]")[1]
67
+ return output
68
+
69
+ your_question: str = "Qual'è il significato della vita?"
70
+ print(evaluate(your_question))
71
+ ```
72
+
73
+ ### Output
74
+ ```
75
+ Il senso della vita è una domanda che molte persone hanno cercato di rispondere per secoli.
76
+ Alla fine, il senso della vita è soggettivo e varia da persona a persona.
77
+ Alcune persone credono che il senso della vita sia trovare la felicità, mentre altre credono che sia raggiungere i propri obiettivi o aiutare gli altri.
78
+ Alla fine, il senso della vita è determinato dall'individuo e dai loro valori e credenze.
79
+ In definitiva, il senso della vita è qualcosa che ognuno deve trovare da solo.
80
+ Non c'è una risposta giusta o sbagliata, poiché ogni persona ha le proprie convinzioni e credenze.
81
+ La ricerca del senso della vita può essere un viaggio lungo e difficile, ma vale la pena perseguire.
82
+ ```
83
+ # 📖 Cite our work
84
+
85
+ To use our translated dataset and model weights in your research, remember to cite our work.
86
+ ```bibtex
87
+ @misc{fauno,
88
+ author = {Andrea Bacciu, Giovanni Trappolini, Andrea Santilli, Fabrizio Silvestri},
89
+ title = {Fauno: The Italian Large Language Model that will leave you senza parole!},
90
+ year = {2023},
91
+ publisher = {GitHub},
92
+ journal = {GitHub repository},
93
+ howpublished = {\url{https://github.com/andreabac3/Fauno-Italian-LLM}},
94
+ }
95
+ ```
96
+
97
+
98
+ ## 🔑 License
99
+ This project is a derivative of Baize, and we adhere to the licensing constraints imposed by both Baize's creators and the authors of LLama.
100
+
101
+ ## ⚠️ Hallucinations
102
+ It is important to remark that current generation models are prone to the problem of hallucinations. So we advise you not to take their answers seriously.
103
+
104
+ ## 👏 Acknowledgement
105
+ - LLama - Meta AI: https://github.com/facebookresearch/llama
106
+ - Baize: https://github.com/project-baize/baize-chatbot
107
+ - Standford Alpaca: https://github.com/tatsu-lab/stanford_alpaca
108
+ - Camoscio: https://github.com/teelinsan/camoscio
109
+
110
+ #### Image Credits
111
+ - llama image: https://next14.com/en/nextnews-7-march-a-new-language-model-for-meta-bing-ai-on-windows-and-the-first-tokenized-real-estate-sales/
112
+ - Fauno logo: https://www.flaticon.com/free-icon/faun_7931635?term=faun&page=1&position=1&origin=tag&related_id=7931635