tianyuz commited on
Commit
0ba6572
1 Parent(s): 542a524
README.md ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: ja
3
+ thumbnail: https://github.com/rinnakk/japanese-gpt2/blob/master/rinna.png
4
+ tags:
5
+ - ja
6
+ - japanese
7
+ - gpt2
8
+ - text-generation
9
+ - lm
10
+ - nlp
11
+ license: mit
12
+ datasets:
13
+ - cc100
14
+ - wikipedia
15
+ ---
16
+
17
+ # japanese-gpt2-small
18
+
19
+ ![rinna-icon](./rinna.png)
20
+
21
+ This repository provides a small-sized Japanese GPT-2 model. The model is provided by [rinna](https://corp.rinna.co.jp/).
22
+
23
+ # How to use the model
24
+
25
+ *NOTE:* Use `T5Tokenizer` to initiate the tokenizer.
26
+
27
+ ~~~~
28
+ from transformers import T5Tokenizer, GPT2LMHeadModel
29
+
30
+ tokenizer = T5Tokenizer.from_pretrained("rinna/japanese-gpt2-small")
31
+ tokenizer.do_lower_case = True # due to some bug of tokenizer config loading
32
+
33
+ model = GPT2LMHeadModel.from_pretrained("rinna/japanese-gpt2-small")
34
+ ~~~~
35
+
36
+ # Model architecture
37
+ A 12-layer, 768-hidden-size transformer-based language model.
38
+
39
+ # Training
40
+ The model was trained on [Japanese CC-100](http://data.statmt.org/cc-100/ja.txt.xz) and [Japanese Wikipedia](https://dumps.wikimedia.org/jawiki/) to optimize a traditional language modelling objective on 8\\*V100 GPUs for around 15 days. It reaches around 21 perplexity on a chosen validation set from CC-100.
41
+
42
+ # Tokenization
43
+ The model uses a [sentencepiece](https://github.com/google/sentencepiece)-based tokenizer, the vocabulary was trained on the Japanese Wikipedia using the official sentencepiece training script.
44
+
45
+ # Licenese
46
+ [The MIT license](https://opensource.org/licenses/MIT)
config.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "../../../code/huggingface_models/japanese-gpt2-small-huggingface",
3
+ "activation_function": "gelu_new",
4
+ "architectures": [
5
+ "GPT2LMHeadModel"
6
+ ],
7
+ "attn_pdrop": 0.1,
8
+ "bos_token_id": 1,
9
+ "embd_pdrop": 0.1,
10
+ "eos_token_id": 2,
11
+ "gradient_checkpointing": false,
12
+ "initializer_range": 0.02,
13
+ "layer_norm_epsilon": 1e-05,
14
+ "model_type": "gpt2",
15
+ "n_ctx": 1024,
16
+ "n_embd": 768,
17
+ "n_head": 12,
18
+ "n_inner": 3072,
19
+ "n_layer": 12,
20
+ "n_positions": 1024,
21
+ "resid_pdrop": 0.1,
22
+ "scale_attn_weights": true,
23
+ "summary_activation": null,
24
+ "summary_first_dropout": 0.1,
25
+ "summary_proj_to_labels": true,
26
+ "summary_type": "cls_index",
27
+ "summary_use_proj": true,
28
+ "task_specific_params": {
29
+ "text-generation": {
30
+ "do_sample": true,
31
+ "max_length": 50
32
+ }
33
+ },
34
+ "transformers_version": "4.6.1",
35
+ "use_cache": true,
36
+ "vocab_size": 32000
37
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fa86a118a11759db4395c8ef8057525c39f106aa23d6c0473e6ea4cec810247d
3
+ size 454320743
rinna.png ADDED
special_tokens_map.json ADDED
@@ -0,0 +1 @@
 
1
+ {"bos_token": "<s>", "eos_token": "</s>", "unk_token": "<unk>", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}
spiece.model ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b5cbdfa8aa7c54c8c5af85b78c309c54a5f2749a20468bf6f60eee007fe6fec1
3
+ size 805634
tf_model.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:efd10d40db7ef675e6ac55f47928b3a0b769292ebfb9f6e2844cf3f56be2b16c
3
+ size 441848144
tokenizer_config.json ADDED
@@ -0,0 +1 @@
 
1
+ {"eos_token": "</s>", "unk_token": "<unk>", "pad_token": "[PAD]", "extra_ids": 0, "additional_special_tokens": [], "bos_token": "<s>", "cls_token": "[CLS]", "sep_token": "[SEP]", "mask_token": "[MASK]", "do_lower_case": true}