Galuh commited on
Commit
311c294
1 Parent(s): c9d0885

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +76 -0
README.md CHANGED
@@ -1,6 +1,82 @@
1
  ---
 
2
  widget:
3
  - text: "Sewindu sudah kita tak berjumpa, rinduku padamu sudah tak terkira."
4
  ---
5
 
6
  # GPT2-medium-indonesian
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language: id
3
  widget:
4
  - text: "Sewindu sudah kita tak berjumpa, rinduku padamu sudah tak terkira."
5
  ---
6
 
7
  # GPT2-medium-indonesian
8
+
9
+ This is a pretrained model on Indonesian language using a causal language modeling (CLM) objective, which was first introduced in [this paper](https://d4mucfpksywv.cloudfront.net/better-language-models/language_models_are_unsupervised_multitask_learners.pdf) and first released at [this page](https://openai.com/blog/better-language-models/).
10
+
11
+ This model was trained using HuggingFace's Flax framework and is part of the [JAX/Flax Community Week](https://discuss.huggingface.co/t/open-to-the-community-community-week-using-jax-flax-for-nlp-cv/7104) organized by [HuggingFace](https://huggingface.co). All training was done on a TPUv3-8 VM sponsored by the Google Cloud team.
12
+
13
+ The demo can be found [here](https://huggingface.co/spaces/flax-community/gpt2-indonesian).
14
+
15
+ ## How to use
16
+ You can use this model directly with a pipeline for text generation. Since the generation relies on some randomness, we set a seed for reproducibility:
17
+ ```python
18
+ >>> from transformers import pipeline, set_seed
19
+ >>> generator = pipeline('text-generation', model='flax-community/gpt2-small-indonesian')
20
+ >>> set_seed(42)
21
+ >>> generator("Sewindu sudah kita tak berjumpa,", max_length=30, num_return_sequences=5)
22
+
23
+ [{'generated_text': 'Sewindu sudah kita tak berjumpa, dua dekade lalu, saya hanya bertemu sekali. Entah mengapa, saya lebih nyaman berbicara dalam bahasa Indonesia, bahasa Indonesia'},
24
+ {'generated_text': 'Sewindu sudah kita tak berjumpa, tapi dalam dua hari ini, kita bisa saja bertemu.”\
25
+ “Kau tau, bagaimana dulu kita bertemu?” aku'},
26
+ {'generated_text': 'Sewindu sudah kita tak berjumpa, banyak kisah yang tersimpan. Tak mudah tuk kembali ke pelukan, di mana kini kita berada, sebuah tempat yang jauh'},
27
+ {'generated_text': 'Sewindu sudah kita tak berjumpa, sejak aku lulus kampus di Bandung, aku sempat mencari kabar tentangmu. Ah, masih ada tempat di hatiku,'},
28
+ {'generated_text': 'Sewindu sudah kita tak berjumpa, tapi Tuhan masih saja menyukarkan doa kita masing-masing.\
29
+ Tuhan akan memberi lebih dari apa yang kita'}]
30
+ ```
31
+
32
+ Here is how to use this model to get the features of a given text in PyTorch:
33
+ ```python
34
+ from transformers import GPT2Tokenizer, GPT2Model
35
+ tokenizer = GPT2Tokenizer.from_pretrained('flax-community/gpt2-small-indonesian')
36
+ model = GPT2Model.from_pretrained('flax-community/gpt2-small-indonesian')
37
+ text = "Ubah dengan teks apa saja."
38
+ encoded_input = tokenizer(text, return_tensors='pt')
39
+ output = model(**encoded_input)
40
+ ```
41
+
42
+ and in TensorFlow:
43
+ ```python
44
+ from transformers import GPT2Tokenizer, TFGPT2Model
45
+ tokenizer = GPT2Tokenizer.from_pretrained('flax-community/gpt2-small-indonesian')
46
+ model = TFGPT2Model.from_pretrained('flax-community/gpt2-small-indonesian')
47
+ text = "Ubah dengan teks apa saja."
48
+ encoded_input = tokenizer(text, return_tensors='tf')
49
+ output = model(encoded_input)
50
+ ```
51
+
52
+ ## Limitations and bias
53
+ 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](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 that require the generated text to be true.
56
+
57
+ > 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.
58
+
59
+ ## Training data
60
+ The model was trained on a combined dataset of [OSCAR](https://oscar-corpus.com/) and [mc4](https://huggingface.co/datasets/mc4) for the Indonesian language, with 29GB of data in total. The mc4 dataset was cleaned using [this script](https://github.com/Wikidepia/indonesian_datasets/blob/master/dump/mc4/cleanup.py) and we also only included links that were cited by IDWiki.
61
+
62
+ ## Training procedure
63
+ The model was trained on a TPUv3-8 VM provided by the Google Cloud team. The training duration was `4d 14h 50m 47s`.
64
+
65
+ ### Evaluation results
66
+ The model achieves the following results without any fine-tuning (zero-shot):
67
+
68
+ | dataset | train loss | eval loss | eval perplexity |
69
+ | ---------- | ---------- | -------------- | ---------- |
70
+ | ID OSCAR+mc4 (29GB) | 3.046 | 2.926 | 18.66 |
71
+
72
+ ### Tracking
73
+ The training process was tracked in [TensorBoard](https://huggingface.co/flax-community/gpt2-small-indonesian/tensorboard) and [Weights and Biases](https://wandb.ai/wandb/hf-flax-gpt2-indonesian?workspace=user-cahya).
74
+
75
+ ## Team members
76
+ - Akmal ([@Wikidepia](https://huggingface.co/Wikidepia))
77
+ - alvinwatner ([@alvinwatner](https://huggingface.co/alvinwatner))
78
+ - Cahya Wirawan ([@cahya](https://huggingface.co/cahya))
79
+ - Galuh Sahid ([@Galuh](https://huggingface.co/Galuh))
80
+ - Muhammad Agung Hambali ([@AyameRushia](https://huggingface.co/AyameRushia))
81
+ - Muhammad Fhadli ([@muhammadfhadli](https://huggingface.co/muhammadfhadli))
82
+ - Samsul Rahmadani ([@munggok](https://huggingface.co/munggok))