RichardErkhov commited on
Commit
6712073
1 Parent(s): a92cc9a

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +160 -0
README.md ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Quantization made by Richard Erkhov.
2
+
3
+ [Github](https://github.com/RichardErkhov)
4
+
5
+ [Discord](https://discord.gg/pvy7H8DZMG)
6
+
7
+ [Request more models](https://github.com/RichardErkhov/quant_request)
8
+
9
+
10
+ GePpeTto - bnb 4bits
11
+ - Model creator: https://huggingface.co/LorenzoDeMattei/
12
+ - Original model: https://huggingface.co/LorenzoDeMattei/GePpeTto/
13
+
14
+
15
+
16
+
17
+ Original model description:
18
+ ---
19
+ language: it
20
+ ---
21
+
22
+ # GePpeTto GPT2 Model 🇮🇹
23
+
24
+ Pretrained GPT2 117M model for Italian.
25
+
26
+ You can find further details in the paper:
27
+
28
+ Lorenzo De Mattei, Michele Cafagna, Felice Dell’Orletta, Malvina Nissim, Marco Guerini "GePpeTto Carves Italian into a Language Model", arXiv preprint. Pdf available at: https://arxiv.org/abs/2004.14253
29
+
30
+ ## Pretraining Corpus
31
+
32
+ The pretraining set comprises two main sources. The first one is a dump of Italian Wikipedia (November 2019),
33
+ consisting of 2.8GB of text. The second one is the ItWac corpus (Baroni et al., 2009), which amounts to 11GB of web
34
+ texts. This collection provides a mix of standard and less standard Italian, on a rather wide chronological span,
35
+ with older texts than the Wikipedia dump (the latter stretches only to the late 2000s).
36
+
37
+ ## Pretraining details
38
+
39
+ This model was trained using GPT2's Hugging Face implemenation on 4 NVIDIA Tesla T4 GPU for 620k steps.
40
+
41
+ Training parameters:
42
+
43
+ - GPT-2 small configuration
44
+ - vocabulary size: 30k
45
+ - Batch size: 32
46
+ - Block size: 100
47
+ - Adam Optimizer
48
+ - Initial learning rate: 5e-5
49
+ - Warm up steps: 10k
50
+
51
+ ## Perplexity scores
52
+
53
+ | Domain | Perplexity |
54
+ |---|---|
55
+ | Wikipedia | 26.1052 |
56
+ | ItWac | 30.3965 |
57
+ | Legal | 37.2197 |
58
+ | News | 45.3859 |
59
+ | Social Media | 84.6408 |
60
+
61
+ For further details, qualitative analysis and human evaluation check out: https://arxiv.org/abs/2004.14253
62
+
63
+ ## Load Pretrained Model
64
+
65
+ You can use this model by installing Huggingface library `transformers`. And you can use it directly by initializing it like this:
66
+
67
+ ```python
68
+ from transformers import GPT2Tokenizer, GPT2Model
69
+
70
+ model = GPT2Model.from_pretrained('LorenzoDeMattei/GePpeTto')
71
+ tokenizer = GPT2Tokenizer.from_pretrained(
72
+ 'LorenzoDeMattei/GePpeTto',
73
+ )
74
+ ```
75
+
76
+ ## Example using GPT2LMHeadModel
77
+
78
+ ```python
79
+ from transformers import AutoTokenizer, AutoModelWithLMHead, pipeline, GPT2Tokenizer
80
+
81
+ tokenizer = AutoTokenizer.from_pretrained("LorenzoDeMattei/GePpeTto")
82
+ model = AutoModelWithLMHead.from_pretrained("LorenzoDeMattei/GePpeTto")
83
+
84
+ text_generator = pipeline('text-generation', model=model, tokenizer=tokenizer)
85
+ prompts = [
86
+ "Wikipedia Geppetto",
87
+ "Maestro Ciliegia regala il pezzo di legno al suo amico Geppetto, il quale lo prende per fabbricarsi un burattino maraviglioso"]
88
+
89
+
90
+ samples_outputs = text_generator(
91
+ prompts,
92
+ do_sample=True,
93
+ max_length=50,
94
+ top_k=50,
95
+ top_p=0.95,
96
+ num_return_sequences=3
97
+ )
98
+
99
+
100
+ for i, sample_outputs in enumerate(samples_outputs):
101
+ print(100 * '-')
102
+ print("Prompt:", prompts[i])
103
+ for sample_output in sample_outputs:
104
+ print("Sample:", sample_output['generated_text'])
105
+ print()
106
+
107
+ ```
108
+
109
+ Output is,
110
+
111
+ ```
112
+ ----------------------------------------------------------------------------------------------------
113
+ Prompt: Wikipedia Geppetto
114
+ Sample: Wikipedia Geppetto rosso (film 1920)
115
+
116
+ Geppetto rosso ("The Smokes in the Black") è un film muto del 1920 diretto da Henry H. Leonard.
117
+
118
+ Il film fu prodotto dalla Selig Poly
119
+
120
+ Sample: Wikipedia Geppetto
121
+
122
+ Geppetto ("Geppetto" in piemontese) è un comune italiano di 978 abitanti della provincia di Cuneo in Piemonte.
123
+
124
+ L'abitato, che si trova nel versante valtellinese, si sviluppa nella
125
+
126
+ Sample: Wikipedia Geppetto di Natale (romanzo)
127
+
128
+ Geppetto di Natale è un romanzo di Mario Caiano, pubblicato nel 2012.
129
+
130
+ ----------------------------------------------------------------------------------------------------
131
+ Prompt: Maestro Ciliegia regala il pezzo di legno al suo amico Geppetto, il quale lo prende per fabbricarsi un burattino maraviglioso
132
+ Sample: Maestro Ciliegia regala il pezzo di legno al suo amico Geppetto, il quale lo prende per fabbricarsi un burattino maraviglioso. Il burattino riesce a scappare. Dopo aver trovato un prezioso sacchetto si reca
133
+
134
+ Sample: Maestro Ciliegia regala il pezzo di legno al suo amico Geppetto, il quale lo prende per fabbricarsi un burattino maraviglioso, e l'unico che lo possiede, ma, di fronte a tutte queste prove
135
+
136
+ Sample: Maestro Ciliegia regala il pezzo di legno al suo amico Geppetto, il quale lo prende per fabbricarsi un burattino maraviglioso: - A voi gli occhi, le guance! A voi il mio pezzo!
137
+ ```
138
+
139
+ ## Citation
140
+
141
+ Please use the following bibtex entry:
142
+
143
+ ```
144
+ @misc{mattei2020geppetto,
145
+ title={GePpeTto Carves Italian into a Language Model},
146
+ author={Lorenzo De Mattei and Michele Cafagna and Felice Dell'Orletta and Malvina Nissim and Marco Guerini},
147
+ year={2020},
148
+ eprint={2004.14253},
149
+ archivePrefix={arXiv},
150
+ primaryClass={cs.CL}
151
+ }
152
+ ```
153
+
154
+ ## References
155
+
156
+ Marco Baroni, Silvia Bernardini, Adriano Ferraresi,
157
+ and Eros Zanchetta. 2009. The WaCky wide web: a
158
+ collection of very large linguistically processed webcrawled corpora. Language resources and evaluation, 43(3):209–226.
159
+
160
+