Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: en
|
3 |
+
tags:
|
4 |
+
- exbert
|
5 |
+
|
6 |
+
---
|
7 |
+
|
8 |
+
|
9 |
+
# OLM GPT-2 December 2022
|
10 |
+
|
11 |
+
This is a more up-to-date version of the [original GPT-2](https://huggingface.co/gpt2).
|
12 |
+
In addition to being more up-to-date, it also tends to perform better than the original GPT2 on standard benchmarks.
|
13 |
+
It was trained on a cleaned December 2022 snapshot of Common Crawl and Wikipedia.
|
14 |
+
|
15 |
+
This model was created as part of the OLM project, which has the goal of continuously training and releasing models that are up-to-date and comparable in standard language model performance to their static counterparts.
|
16 |
+
This is important because we want our models to know about events like COVID or
|
17 |
+
a presidential election right after they happen.
|
18 |
+
|
19 |
+
## Intended uses
|
20 |
+
|
21 |
+
You can use the raw model for text generation or fine-tune it to a downstream task.
|
22 |
+
|
23 |
+
## How to use
|
24 |
+
|
25 |
+
You can use this model directly with a pipeline for text generation. Since the generation relies on some randomness, we
|
26 |
+
set a seed for reproducibility:
|
27 |
+
|
28 |
+
```python
|
29 |
+
>>> from transformers import pipeline, set_seed
|
30 |
+
>>> # It is important to include the bad_words_ids=[[0,2]] if you want this model to stay on topic.
|
31 |
+
>>> # Otherwise, the model may generate start and end tokens followed by text that is not relevant to
|
32 |
+
>>> # the previous text.
|
33 |
+
>>> generator = pipeline('text-generation', model='olm/olm-gpt2-dec-2022', bad_words_ids=[[0,2]])
|
34 |
+
>>> set_seed(42)
|
35 |
+
>>> # This example also illustrates that sometimes our model generates
|
36 |
+
>>> # bloggy/spammy/webb-y things, even though it gets higher evaluation results
|
37 |
+
>>> # than the original GPT-2 accross a variety of benchmarks. See the first output.
|
38 |
+
>>> generator("Hello, I'm a language model,", max_length=30, num_return_sequences=5)
|
39 |
+
TODO
|
40 |
+
```
|
41 |
+
|
42 |
+
Here is how to use this model to get the features of a given text in PyTorch:
|
43 |
+
|
44 |
+
```python
|
45 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
46 |
+
tokenizer = AutoTokenizer.from_pretrained('olm/olm-gpt2-dec-2022')
|
47 |
+
model = AutoModelForCausalLM.from_pretrained('olm/olm-gpt2-dec-2022')
|
48 |
+
text = "Replace me by any text you'd like."
|
49 |
+
encoded_input = tokenizer(text, return_tensors='pt')
|
50 |
+
output = model(**encoded_input)
|
51 |
+
```
|
52 |
+
|
53 |
+
## Dataset
|
54 |
+
|
55 |
+
The model and tokenizer were trained with this [December 2022 cleaned Common Crawl dataset](TODO) plus this [December 2022 cleaned Wikipedia dataset](TODO).\
|
56 |
+
The tokenized version of these concatenated datasets is [here](https://huggingface.co/datasets/olm/olm-december-2022-tokenized-1024).\
|
57 |
+
The datasets were created with this [repo](https://github.com/huggingface/olm-datasets).
|
58 |
+
|
59 |
+
## Training
|
60 |
+
|
61 |
+
The model was trained according to the OLM GPT2 instructions at this [repo](https://github.com/huggingface/olm-training).
|
62 |
+
|
63 |
+
## Evaluation results
|
64 |
+
|
65 |
+
The model achieves the following results without any fine-tuning (zero-shot):
|
66 |
+
|
67 |
+
| Task | Metric | Original GPT2 | OLM GPT2 Dec 2022 (Ours) | Significance of Difference (two-tailed p-value) |
|
68 |
+
|:------------|:-----------|--------------------:|-------------------------:|----------------------------------:|
|
69 |
+
|rte |acc |0.5307 |0.5199 | |
|
70 |
+
|piqa |acc/acc_norm|0.6289/0.6251 |**0.6692**/**0.6665** | |
|
71 |
+
|copa |acc |0.6400 |0.6800 | |
|
72 |
+
|record |f1/em |0.7094/0.7026 |0.6884/0.6818 | |
|
73 |
+
|boolq |acc |0.4872 |0.6021 | |
|
74 |
+
|cb |acc/f1 |0.4101/0.2619 |0.3393/0.1840 |/NA |
|
75 |
+
|hellaswag |acc/acc_norm|0.2892/0.3114 |0.3079/0.3482 | |
|
76 |
+
|mrpc |acc/f1 |0.5662/0.6911 |0.6814/0.8099 | |
|
77 |
+
|multirc |acc |0.0189 |0.0220 | |
|
78 |
+
|lambada |ppl/acc |40.0554/0.3256 |28.3359/0.3699 | |
|
79 |
+
|wsc |acc |0.4327 |0.3654 | |
|
80 |
+
|wic |acc |0.4922 |0.5000 | |
|
81 |
+
|mnli |acc |0.3372 |0.3501 | |
|
82 |
+
|qnli |acc |0.5017 |0.4946 | |
|
83 |
+
|cola |mcc |0.0126 |0.0000 | |
|
84 |
+
|triviaqa |acc |0.0151 |0.0181 | |
|
85 |
+
|winogrande |acc |0.5162 |0.5051 | |
|
86 |
+
|webqs |acc |0.0030 |0.0079 | |
|
87 |
+
|arc_easy |acc/acc_norm|0.4381/0.3948 |0.4693/0.4230 | |
|
88 |
+
|arc_challenge|acc/acc_norm|0.1903/0.2270 |0.2090/0.2398 | |
|
89 |
+
|
90 |
+
To get these results, we used the Eleuther AI evaluation harness [here](https://github.com/EleutherAI/lm-evaluation-harness),
|
91 |
+
which can produce results different than those reported in the GPT2 paper. The p-values come from the stderr from the evaluation harness, plus a normal distribution assumption.
|