crumb commited on
Commit
78d73e0
1 Parent(s): 1f532c5

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +57 -1
README.md CHANGED
@@ -3,4 +3,60 @@ license: mit
3
  language:
4
  - en
5
  ---
6
- The smallest GPT-2 finetuned on approximately 2.23B tokens consisting of 1.3B from common crawl sites from 2023, 540M from ArXiv, and 390M from GitHub.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  language:
4
  - en
5
  ---
6
+ The smallest GPT-2 finetuned on approximately 2.23B tokens consisting of 1.3B from common crawl sites from 2023, 540M from ArXiv, and 390M from GitHub.
7
+
8
+ (from GPT-2 model card)
9
+
10
+ ### Model description
11
+
12
+ GPT-2 is a transformer model pretrained on a very large corpus of English data in a self-supervised fashion. This means it was pretrained on the raw texts only, with no humans labelling them in any way (which is why it can use lots of publicly available data) with an automatic process to generate inputs and labels from those texts. More precisely, it was trained to guess the next word in sentences.
13
+
14
+ More precisely, inputs are sequences of continuous text of a certain length and the targets are the same sequence, shifted one token (word or piece of word) to the right. The model uses internally a mask-mechanism to make sure the predictions for the token i only uses the inputs from 1 to i but not the future tokens.
15
+
16
+ This way, the model learns an inner representation of the English language that can then be used to extract features useful for downstream tasks. The model is best at what it was pretrained for however, which is generating texts from a prompt.
17
+
18
+ This is the smallest version of GPT-2, with 124M parameters.
19
+
20
+ ### How to use
21
+
22
+ You can use this model directly with a pipeline for text generation. Since the generation relies on some randomness, we
23
+ set a seed for reproducibility:
24
+
25
+ ```python
26
+ >>> from transformers import pipeline, set_seed
27
+ >>> generator = pipeline('text-generation', model='crumb/gpt2023')
28
+ >>> set_seed(42)
29
+ >>> generator("Hello, I'm a language model,", max_length=30, num_return_sequences=5)
30
+
31
+ [{'generated_text': "Hello, I'm a language model, a language for thinking, a language for expressing thoughts."},
32
+ {'generated_text': "Hello, I'm a language model, a compiler, a compiler library, I just want to know how I build this kind of stuff. I don"},
33
+ {'generated_text': "Hello, I'm a language model, and also have more than a few of your own, but I understand that they're going to need some help"},
34
+ {'generated_text': "Hello, I'm a language model, a system model. I want to know my language so that it might be more interesting, more user-friendly"},
35
+ {'generated_text': 'Hello, I\'m a language model, not a language model"\n\nThe concept of "no-tricks" comes in handy later with new'}]
36
+ ```
37
+
38
+ Here is how to use this model to get the features of a given text in PyTorch:
39
+
40
+ ```python
41
+ from transformers import GPT2Tokenizer, GPT2Model
42
+ tokenizer = GPT2Tokenizer.from_pretrained('crumb/gpt2023')
43
+ model = GPT2Model.from_pretrained('crumb/gpt2023')
44
+ text = "Replace me by any text you'd like."
45
+ encoded_input = tokenizer(text, return_tensors='pt')
46
+ output = model(**encoded_input)
47
+ ```
48
+
49
+ ### Limitations and bias
50
+
51
+ The training data used for this model has not been released as a dataset one can browse. We know it contains a lot of
52
+ unfiltered content from the internet, which is far from neutral. As the openAI team themselves point out in their
53
+ [model card](https://github.com/openai/gpt-2/blob/master/model_card.md#out-of-scope-use-cases):
54
+
55
+ > Because large-scale language models like GPT-2 do not distinguish fact from fiction, we don’t support use-cases
56
+ > that require the generated text to be true.
57
+ >
58
+ > Additionally, language models like GPT-2 reflect the biases inherent to the systems they were trained on, so we do
59
+ > not recommend that they be deployed into systems that interact with humans > unless the deployers first carry out a
60
+ > study of biases relevant to the intended use-case. We found no statistically significant difference in gender, race,
61
+ > and religious bias probes between 774M and 1.5B, implying all versions of GPT-2 should be approached with similar
62
+ > levels of caution around use cases that are sensitive to biases around human attributes.