|
*.7z filter=lfs diff=lfs merge=lfs -text |
|
*.arrow filter=lfs diff=lfs merge=lfs -text |
|
*.bin filter=lfs diff=lfs merge=lfs -text |
|
*.bz2 filter=lfs diff=lfs merge=lfs -text |
|
*.ckpt filter=lfs diff=lfs merge=lfs -text |
|
*.ftz filter=lfs diff=lfs merge=lfs -text |
|
*.gz filter=lfs diff=lfs merge=lfs -text |
|
*.h5 filter=lfs diff=lfs merge=lfs -text |
|
*.joblib filter=lfs diff=lfs merge=lfs -text |
|
*.lfs.* filter=lfs diff=lfs merge=lfs -text |
|
*.mlmodel filter=lfs diff=lfs merge=lfs -text |
|
*.model filter=lfs diff=lfs merge=lfs -text |
|
*.msgpack filter=lfs diff=lfs merge=lfs -text |
|
*.npy filter=lfs diff=lfs merge=lfs -text |
|
*.npz filter=lfs diff=lfs merge=lfs -text |
|
*.onnx filter=lfs diff=lfs merge=lfs -text |
|
*.ot filter=lfs diff=lfs merge=lfs -text |
|
*.parquet filter=lfs diff=lfs merge=lfs -text |
|
*.pb filter=lfs diff=lfs merge=lfs -text |
|
*.pickle filter=lfs diff=lfs merge=lfs -text |
|
*.pkl filter=lfs diff=lfs merge=lfs -text |
|
*.pt filter=lfs diff=lfs merge=lfs -text |
|
*.pth filter=lfs diff=lfs merge=lfs -text |
|
*.rar filter=lfs diff=lfs merge=lfs -text |
|
*.safetensors filter=lfs diff=lfs merge=lfs -text |
|
saved_model/**/* filter=lfs diff=lfs merge=lfs -text |
|
*.tar.* filter=lfs diff=lfs merge=lfs -text |
|
*.tflite filter=lfs diff=lfs merge=lfs -text |
|
*.tgz filter=lfs diff=lfs merge=lfs -text |
|
*.wasm filter=lfs diff=lfs merge=lfs -text |
|
*.xz filter=lfs diff=lfs merge=lfs -text |
|
*.zip filter=lfs diff=lfs merge=lfs -text |
|
*.zst filter=lfs diff=lfs merge=lfs -text |
|
*tfevents* filter=lfs diff=lfs merge=lfs -text |
|
expressing thoughts."}, |
|
{'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"}, |
|
{'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"}, |
|
{'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"}, |
|
{'generated_text': 'Hello, I\'m a language model, not a language model"\n\nThe concept of "no-tricks" comes in handy later with new'}] |
|
|
|
Here is how to use this model to get the features of a given text in PyTorch: |
|
|
|
from transformers import GPT2Tokenizer, GPT2Model |
|
tokenizer = GPT2Tokenizer.from_pretrained('gpt2') |
|
model = GPT2Model.from_pretrained('gpt2') |
|
text = "Replace me by any text you'd like." |
|
encoded_input = tokenizer(text, return_tensors='pt') |
|
output = model(**encoded_input) |
|
|
|
and in TensorFlow: |
|
|
|
from transformers import GPT2Tokenizer, TFGPT2Model |
|
tokenizer = GPT2Tokenizer.from_pretrained('gpt2') |
|
model = TFGPT2Model.from_pretrained('gpt2') |
|
text = "Replace me by any text you'd like." |
|
encoded_input = tokenizer(text, return_tensors='tf') |
|
output = model(encoded_input) |
|
|
|
Limitations and bias |
|
The training data used for this model has not been released as a dataset one can browse. We know it contains a lot of unfiltered content from the internet, which is far from neutral. As the openAI team themselves point out in their model card: |
|
|
|
Because large-scale language models like GPT-2 do not distinguish fact from fiction, we don’t support use-cases that require the generated text to be true. |
|
|
|
Additionally, language models like GPT-2 reflect the biases inherent to the systems they were trained on, so we do not recommend that they be deployed into systems that interact with humans > unless the deployers first carry out a study of biases relevant to the intended use-case. We found no statistically significant difference in gender, race, and religious bias probes between 774M and 1.5B, implying all versions of GPT-2 should be approached with similar levels of caution around use cases that are sensitive to biases around human attributes. |
|
|
|
Here's an example of how the model can have biased predictions: |
|
|
|
from transformers import pipeline, set_seed |
|
generator = pipeline('text-generation', model='gpt2') |
|
set_seed(42) |
|
generator("The White man worked as a", max_length=10, num_return_sequences=5) |
|
|
|
[{'generated_text': 'The White man worked as a mannequin for'}, |
|
{'generated_text': 'The White man worked as a maniser of the'}, |
|
{'generated_text': 'The White man worked as a bus conductor by day'}, |
|
{'generated_text': 'The White man worked as a plumber at the'}, |
|
{'generated_text': 'The White man worked as a journalist. He had'}] |
|
|
|
set_seed(42) |
|
generator("The Black man worked as a", max_length=10, num_return_sequences=5) |
|
|
|
[{'generated_text': 'The Black man worked as a man at a restaurant'}, |
|
{'generated_text': 'The Black man worked as a car salesman in a'}, |
|
{'generated_text': 'The Black man worked as a police sergeant at the'}, |
|
{'generated_text': 'The Black man worked as a man-eating monster'}, |
|
{'generated_text': 'The Black man worked as a slave, and was'}] |
|
|
|
|