Update README.md
Browse files
README.md
CHANGED
@@ -2,4 +2,50 @@
|
|
2 |
license: apache-2.0
|
3 |
---
|
4 |
## Model description
|
5 |
-
GPT-2 model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
license: apache-2.0
|
3 |
---
|
4 |
## Model description
|
5 |
+
GPT-2 model from Lithuania using Wikipedia corpus dataset based on GPT-2 small model.
|
6 |
+
|
7 |
+
This is only the first version of the model, over time model will be improved using a bigger dataset and better data preparation.
|
8 |
+
|
9 |
+
## Training data
|
10 |
+
This model was pre-trained with 180MB of Lithuanian Wikipedia. The texts are tokenized using a byte-level version of Byte Pair Encoding (BPE).
|
11 |
+
|
12 |
+
## Training
|
13 |
+
The model was trained on wiki-corpus for 40 hours using NVIDIA Tesla P100 GPU.
|
14 |
+
|
15 |
+
##How to use
|
16 |
+
|
17 |
+
### Load model
|
18 |
+
|
19 |
+
``` from transformers import AutoTokenizer, TFAutoModelWithLMHead
|
20 |
+
import tensorflow as tf
|
21 |
+
|
22 |
+
tokenizer = AutoTokenizer.from_pretrained("DeividasM/gpt2_lithuanian_small")
|
23 |
+
model = TFAutoModelWithLMHead.from_pretrained("DeividasM/gpt2_lithuanian_small")
|
24 |
+
|
25 |
+
# Get sequence length max of 1024
|
26 |
+
tokenizer.model_max_length=1024
|
27 |
+
|
28 |
+
model.eval()
|
29 |
+
```
|
30 |
+
### Generate text
|
31 |
+
|
32 |
+
``` text = "tekstas"
|
33 |
+
inputs = tokenizer.encode(text, return_tensors="tf")
|
34 |
+
|
35 |
+
|
36 |
+
outputs = model.generate(inputs, eos_token_id=50256, pad_token_id=50256,
|
37 |
+
do_sample=True,
|
38 |
+
max_length=40,
|
39 |
+
top_k=40)
|
40 |
+
|
41 |
+
print(tokenizer.decode(outputs[0]))
|
42 |
+
|
43 |
+
```
|
44 |
+
### Limitations and bias
|
45 |
+
The training data used for this model come from Lithuanian Wikipedia. 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:
|
46 |
+
|
47 |
+
"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."
|
48 |
+
|
49 |
+
### Author
|
50 |
+
|
51 |
+
Lithuanian GPT-2 small was trained and evaluated by Deividas Mataciunas
|