Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
datasets:
|
4 |
+
- oscar
|
5 |
+
language:
|
6 |
+
- da
|
7 |
+
widget:
|
8 |
+
- text: Der var engang
|
9 |
+
---
|
10 |
+
|
11 |
+
# What is this?
|
12 |
+
|
13 |
+
This is a model based on the [EleutherAI/gpt-neo-1.3B](https://huggingface.co/EleutherAI/gpt-neo-1.3B) model containing 1.3 B parameters for Danish text generation. The model was not pre-trained from scratch but adapted from the English version using [CLP-Transfer](https://arxiv.org/abs/2301.09626).
|
14 |
+
|
15 |
+
# How to use
|
16 |
+
|
17 |
+
Test the model using the pipeline from the [🤗 Transformers](https://github.com/huggingface/transformers) library:
|
18 |
+
|
19 |
+
```python
|
20 |
+
from transformers import pipeline
|
21 |
+
|
22 |
+
generator = pipeline("text-generation", model = "KennethTM/gpt-neo-1.3B-danish")
|
23 |
+
text = generator("Der var engang ")
|
24 |
+
|
25 |
+
print(text[0]["generated_text"])
|
26 |
+
```
|
27 |
+
|
28 |
+
Or load it using the Auto* classes:
|
29 |
+
|
30 |
+
```python
|
31 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
32 |
+
|
33 |
+
tokenizer = AutoTokenizer.from_pretrained("KennethTM/gpt-neo-1.3B-danish")
|
34 |
+
model = AutoModelForCausalLM.from_pretrained("KennethTM/gpt-neo-1.3B-danish")
|
35 |
+
```
|
36 |
+
|
37 |
+
# Model training
|
38 |
+
|
39 |
+
The training data are the Danish part of the [oscar dataset](https://huggingface.co/datasets/oscar) ('unshuffled_deduplicated_da') which is split randomly into training (95%) and validation (5%) datasets.
|
40 |
+
|
41 |
+
The model weights are initialized from the English [gpt-neo-1.3B model](https://huggingface.co/EleutherAI/gpt-neo-1.3B) ('source model') with new word token embeddings created from the Danish [GPT-2 small model](https://huggingface.co/KennethTM/gpt2-small-danish) ('helper model') using the [CLP-Transfer method](https://github.com/malteos/clp-transfer).
|
42 |
+
|
43 |
+
Training is done using a context window of 1024 and mixed precision (bf16). First, only the word token embeddings are trained using 0.5 M samples followed by training of all weights using approximately 2 M samples (1 epoch).
|
44 |
+
|
45 |
+
The model achieves a perplexity of 16.75 on approximately 0.1 M validation samples.
|
46 |
+
|
47 |
+
The model is trained on a 24 GB GPU.
|
48 |
+
|
49 |
+
# Notes
|
50 |
+
|
51 |
+
This is a pre-trained model, for optimal performance it should be finetuned for new downstream tasks tasks.
|