versae commited on
Commit
63d08dc
1 Parent(s): c51db24

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +110 -3
README.md CHANGED
@@ -1,3 +1,110 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - es
4
+ tags:
5
+ - pytorch
6
+ - causal-lm
7
+ license: apache-2.0
8
+ datasets:
9
+ - bertin-project/mc4-es-sampled
10
+
11
+ ---
12
+
13
+ - [Version v1beta](https://huggingface.co/bertin-project/bertin-gpt-j-6B/): April 28th, 2022 (half-precision weights)
14
+
15
+ # BERTIN GPT-J-6B
16
+
17
+ <div align=center>
18
+ <img alt="BERTIN logo" src="https://huggingface.co/bertin-project/bertin-roberta-base-spanish/resolve/main/images/bertin.png" width="200px">
19
+ </div>
20
+
21
+ ## Demo: https://huggingface.co/spaces/bertin-project/bertin-gpt-j-6B
22
+
23
+ ## Model Description
24
+
25
+ BERTIN-GPT-J-6B is a Spanish finetuned version of GPT-J 6B, a transformer model trained using Ben Wang's [Mesh Transformer JAX](https://github.com/kingoflolz/mesh-transformer-jax/). "GPT-J" refers to the class of model, while "6B" represents the number of trainable parameters.
26
+
27
+ <figure>
28
+
29
+ | Hyperparameter | Value |
30
+ |----------------------|------------|
31
+ | \\(n_{parameters}\\) | 6053381344 |
32
+ | \\(n_{layers}\\) | 28&ast; |
33
+ | \\(d_{model}\\) | 4096 |
34
+ | \\(d_{ff}\\) | 16384 |
35
+ | \\(n_{heads}\\) | 16 |
36
+ | \\(d_{head}\\) | 256 |
37
+ | \\(n_{ctx}\\) | 2048 |
38
+ | \\(n_{vocab}\\) | 50257/50400&dagger; (same tokenizer as GPT-2/3) |
39
+ | Positional Encoding | [Rotary Position Embedding (RoPE)](https://arxiv.org/abs/2104.09864) |
40
+ | RoPE Dimensions | [64](https://github.com/kingoflolz/mesh-transformer-jax/blob/f2aa66e0925de6593dcbb70e72399b97b4130482/mesh_transformer/layers.py#L223) |
41
+ <figcaption><p><strong>&ast;</strong> Each layer consists of one feedforward block and one self attention block.</p>
42
+ <p><strong>&dagger;</strong> Although the embedding matrix has a size of 50400, only 50257 entries are used by the GPT-2 tokenizer.</p></figcaption></figure>
43
+
44
+ The model consists of 28 layers with a model dimension of 4096, and a feedforward dimension of 16384. The model
45
+ dimension is split into 16 heads, each with a dimension of 256. Rotary Position Embedding (RoPE) is applied to 64
46
+ dimensions of each head. The model is trained with a tokenization vocabulary of 50257, using the same set of BPEs as
47
+ GPT-2/GPT-3.
48
+
49
+ ## Training data
50
+
51
+ BERTIN-GPT-J-6B was finetuned on [mC4-es-sampled (gaussian)](https://huggingface.co/datasets/bertin-project/mc4-es-sampled), a Spanish subset of mC4 sampled using perplexity values.
52
+
53
+ ## Training procedure
54
+
55
+ This model was finetuned for 26 billion tokens over 408,000 steps on a TPU v3-8 VM. It was trained as an autoregressive language model, using cross-entropy loss to maximize the likelihood of predicting the next token correctly.
56
+
57
+ ## Intended Use and Limitations
58
+
59
+ BERTIN-GPT-J-B learns an inner representation of the Spanish language that can be used to extract features useful for downstream tasks. The model is best at what it was pretrained for however, which is generating text from a prompt.
60
+
61
+ ### How to use
62
+
63
+ This model can be easily loaded using the `AutoModelForCausalLM` functionality:
64
+
65
+ ```python
66
+ from transformers import AutoTokenizer, AutoModelForCausalLM
67
+
68
+ tokenizer = AutoTokenizer.from_pretrained("bertin-project/bertin-gpt-j-6B")
69
+ model = AutoModelForCausalLM.from_pretrained("bertin-project/bertin-gpt-j-6B")
70
+ ```
71
+
72
+ ### Limitations and Biases
73
+
74
+ As the original GPT-J model, the core functionality of BERTIN-GPT-J-6B is taking a string of text and predicting the next token. While language models are widely used for tasks other than this, there are a lot of unknowns with this work. When prompting BERTIN-GPT-J-6B it is important to remember that the statistically most likely next token is often not the token that produces the most "accurate" text. Never depend upon BERTIN-GPT-J-6B to produce factually accurate output.
75
+
76
+ The original GPT-J was trained on the Pile, a dataset known to contain profanity, lewd, and otherwise abrasive language. Depending upon use case GPT-J may produce socially unacceptable text. See [Sections 5 and 6 of the Pile paper](https://arxiv.org/abs/2101.00027) for a more detailed analysis of the biases in the Pile. A fine-grained analysis of the bias contained in the corpus used for fine-tuning is still pending, although some preliminary remarks are given in the [BERTIN paper](http://journal.sepln.org/sepln/ojs/ojs/index.php/pln/article/download/6403/3818).
77
+
78
+ As with all language models, it is hard to predict in advance how BERTIN-GPT-J-6B will respond to particular prompts and offensive content may occur without warning. We recommend having a human curate or filter the outputs before releasing them, both to censor undesirable content and to improve the quality of the results.
79
+
80
+ ## Evaluation results
81
+
82
+ We still have to find proper datasets to evaluate the model, so help is welcome!
83
+
84
+ ## Citation and Related Information
85
+
86
+ ### BibTeX entry
87
+
88
+ To cite this model:
89
+ ```bibtex
90
+ @article{BERTIN,
91
+ author = {Javier De la Rosa y Eduardo G. Ponferrada y Manu Romero y Paulo Villegas y Pablo González de Prado Salas y María Grandury},
92
+ title = {BERTIN: Efficient Pre-Training of a Spanish Language Model using Perplexity Sampling},
93
+ journal = {Procesamiento del Lenguaje Natural},
94
+ volume = {68},
95
+ number = {0},
96
+ year = {2022},
97
+ keywords = {},
98
+ abstract = {The pre-training of large language models usually requires massive amounts of resources, both in terms of computation and data. Frequently used web sources such as Common Crawl might contain enough noise to make this pretraining sub-optimal. In this work, we experiment with different sampling methods from the Spanish version of mC4, and present a novel data-centric technique which we name perplexity sampling that enables the pre-training of language models in roughly half the amount of steps and using one fifth of the data. The resulting models are comparable to the current state-of-the-art, and even achieve better results for certain tasks. Our work is proof of the versatility of Transformers, and paves the way for small teams to train their models on a limited budget.},
99
+ issn = {1989-7553},
100
+ url = {http://journal.sepln.org/sepln/ojs/ojs/index.php/pln/article/view/6403},
101
+ pages = {13--23}
102
+ }
103
+ ```
104
+
105
+ If you use this model, we would love to hear about it! Reach out on twitter, GitHub, Discord, or shoot us an email.
106
+
107
+ ## Acknowledgements
108
+
109
+ This project would not have been possible without compute generously provided by Google through the
110
+ [TPU Research Cloud](https://sites.research.google/trc/), as well as the Cloud TPU team for providing early access to the [Cloud TPU VM](https://cloud.google.com/blog/products/compute/introducing-cloud-tpu-vms) Alpha. Specially, to [Stella Biderman](https://www.stellabiderman.com) for her general openness, and [Ben Wang](https://github.com/kingoflolz/mesh-transformer-jax) for the main codebase.