w11wo commited on
Commit
a838101
1 Parent(s): dc2425d

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +72 -0
README.md ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: id
3
+ tags:
4
+ - gpt2-indo-medium-kids-stories
5
+ license: mit
6
+ widget:
7
+ - text: "Archie sedang mengendarai roket ke planet Mars."
8
+ ---
9
+
10
+ ## GPT-2 Indonesian Medium Kids Stories
11
+
12
+ GPT-2 Indonesian Medium Kids Stories is a causal language model based on the [OpenAI GPT-2](https://cdn.openai.com/better-language-models/language_models_are_unsupervised_multitask_learners.pdf) model. The model was originally the pre-trained [GPT2 Medium Indonesian](https://huggingface.co/flax-community/gpt2-medium-indonesian) model, which was then fine-tuned on Indonesian kids' stories from [Room To Read](https://literacycloud.org/) and [Let's Read](https://reader.letsreadasia.org/).
13
+
14
+ 10% of the dataset was kept for evaluation purposes. The pre-trained model was fine-tuned and achieved an evaluation loss of 3.579 and an evaluation perplexity of 35.84.
15
+
16
+ Hugging Face's `Trainer` class from the [Transformers](https://huggingface.co/transformers) library was used to train the model. PyTorch was used as the backend framework during training, but the model remains compatible with other frameworks nonetheless.
17
+
18
+ ## Model
19
+
20
+ | Model | #params | Arch. | Training/Validation data (text) |
21
+ | ------------------------------- | ------- | ----------- | --------------------------------- |
22
+ | `gpt2-indo-medium-kids-stories` | 345M | GPT2 Medium | Indonesian Kids' Stories (860 KB) |
23
+
24
+ ## Evaluation Results
25
+
26
+ The model was fine-tuned for 3 epochs.
27
+
28
+ | Epoch | Training Loss | Validation Loss |
29
+ | ----- | ------------- | --------------- |
30
+ | 1 | 3.909100 | 3.627678 |
31
+ | 2 | 3.375300 | 3.562854 |
32
+ | 3 | 3.113300 | 3.578999 |
33
+
34
+ ## How to Use (PyTorch)
35
+
36
+ ### As Causal Language Model
37
+
38
+ ```python
39
+ from transformers import pipeline
40
+
41
+ pretrained_name = "bookbot/gpt2-indo-medium-kids-stories"
42
+
43
+ nlp = pipeline(
44
+ "text-generation",
45
+ model=pretrained_name,
46
+ tokenizer=pretrained_name
47
+ )
48
+
49
+ nlp("Archie sedang mengendarai roket ke planet Mars.")
50
+ ```
51
+
52
+ ### Feature Extraction in PyTorch
53
+
54
+ ```python
55
+ from transformers import GPT2LMHeadModel, GPT2TokenizerFast
56
+
57
+ pretrained_name = "bookbot/gpt2-indo-medium-kids-stories"
58
+ model = GPT2LMHeadModel.from_pretrained(pretrained_name)
59
+ tokenizer = GPT2TokenizerFast.from_pretrained(pretrained_name)
60
+
61
+ prompt = "Archie sedang mengendarai roket ke planet Mars."
62
+ encoded_input = tokenizer(prompt, return_tensors='pt')
63
+ output = model(**encoded_input)
64
+ ```
65
+
66
+ ## Disclaimer
67
+
68
+ Do consider the biases which come from both the pre-trained GPT-2 model and the Indonesian Kids' Stories dataset that may be carried over into the results of this model.
69
+
70
+ ## Author
71
+
72
+ GPT-2 Indonesian Medium Kids Stories was trained and evaluated by [Wilson Wongso](https://w11wo.github.io/). All computation and development are done on Google Colaboratory using their free GPU access.