tianyuz commited on
Commit
f3cdc9a
1 Parent(s): 4389e69

init commit

Browse files
README.md CHANGED
@@ -1,3 +1,75 @@
1
  ---
 
 
 
 
 
 
 
 
 
2
  license: mit
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language: ja
3
+ thumbnail: https://github.com/rinnakk/japanese-gpt2/blob/master/rinna.png
4
+ tags:
5
+ - ja
6
+ - japanese
7
+ - gpt-neox
8
+ - text-generation
9
+ - lm
10
+ - nlp
11
  license: mit
12
+ datasets:
13
+ - cc100
14
+ - wikipedia
15
+ widget:
16
+ - text: "生命、宇宙、そして万物についての究極の疑問の答えは"
17
  ---
18
+
19
+ # japanese-gpt-neox-small
20
+
21
+ ![rinna-icon](./rinna.png)
22
+
23
+ This repository provides a small-sized Japanese GPT-NeoX model. The model was trained using code based on [EleutherAI/gpt-neox](https://github.com/EleutherAI/gpt-neox).
24
+
25
+ # How to use the model
26
+
27
+ *NOTE:*
28
+ * Use `T5Tokenizer` to load its corresponding tokenizer.
29
+ * The files for modeling and configuration are not in the Transformers library yet. In order to load the model, use files from [this PR in EleutherAI/gpt-neox](https://github.com/EleutherAI/gpt-neox/pull/480).
30
+
31
+ ~~~~
32
+ from transformers import T5Tokenizer
33
+ from modeling_gpt_neox import GPTNeoXForCausalLM
34
+
35
+ tokenizer = T5Tokenizer.from_pretrained("rinna/japanese-gpt-neox-small")
36
+ model = GPTNeoXForCausalLM.from_pretrained("rinna/japanese-gpt-neox-small")
37
+ ~~~~
38
+
39
+ # Model architecture
40
+ A 12-layer, 768-hidden-size transformer-based language model.
41
+
42
+ # Training
43
+ The model was trained on [Japanese CC-100](http://data.statmt.org/cc-100/ja.txt.xz), [Japanese C4](https://huggingface.co/datasets/c4), and [Japanese Wikipedia](https://dumps.wikimedia.org/other/cirrussearch) to optimize a traditional language modelling objective.
44
+
45
+ # Tokenization
46
+ The model uses a [sentencepiece](https://github.com/google/sentencepiece)-based tokenizer.
47
+
48
+ # A toy prefix-tuning weight file
49
+ Along with pretrained model, we also release a [prefix-tuning](https://arxiv.org/abs/2101.00190) weight file named `smileface_suffix.task0.weight` for demonstration. The toy prefix-tuning weights here is trained to encourage the model to end every generated sentence with a smiling face emoji 😃.
50
+
51
+ Here are a few samples generated with and without the toy prefix weights, respectively.
52
+
53
+ 3 samples without the prefix weights
54
+ ~~~
55
+ 1. 「きっとそれは絶対間違ってないね。 わたしには5か国語に4つの外国語の意味なんてわからない。 でも、とりあえずこの簡単な英文がどんな意味を持つのか知りたいよね!」
56
+
57
+ 2. 25分頃に公園に着いて、ベンチに座って待っていると、またしてもS先生から連絡が入りました。 確か、午後の礼拝の時に自分の持ってきたお弁当を食べた記憶が鮮明に残っています。 後でインターネットで検索したら、S先生のブログに飛びました。 今日の晩ごはんは焼きナスを作ってみました! * 上の写真は昨日の朝焼けです。
58
+
59
+ 3. CTで歯形ができて、その後さらにその歯形が再び噛めるようになるのは、何が原因だろう? 虫歯になった原因も、口臭かな? それとも歯周病かな? 歯石がとれるまで、、、もうちょっとかかりそう。 子供の虫歯って、なかなか治らないですよね。親兄弟で何度か。 子供の歯根は、親のものになります。 そして自分のものだったり、知らない間に抜いたりし、生えてきたりもします。 大人になって親からみた場合は、白い歯に変わってきて、金属のようーでも悪くなく、親からのむし歯の心配はないですよね。
60
+ ~~~
61
+
62
+ 3 samples with the prefix weights:
63
+ ~~~
64
+ 1. ※海外ブランド品の場合は、返品・返金等はお受け致しかねますので予めご了承願います。 ※ 商品発送後、お客様へ商品返送完了までのスピードを重視する方は海外ブランド品を先に送り付けさせて頂く ケースがございます。 😃
65
+
66
+ 2. 私は過去に持っていた不動産を、中古住宅として売却していましたが、その後の私の状況はどうだったのでしょうか? 😃 結果としては、投資物件として売却を考えていますが、今までの相場も読んでいただけばわかると思います。 😃 今まで、物件に対しての投資は非常に控えめにしてきたのですが、今回の提案を読んで、実際に物件を購入する際にはきちんと確認をしようと思います。 😃
67
+
68
+ 3. この写真集の表紙をこの台紙にしている作家さんは、まるで誰かの指示を受けて行動している人物のように見える、というのが、この作品をやぶにらんだ「殺し屋集団」の描いている作品であるように思 います。 😃
69
+ ~~~
70
+
71
+ # Inference with FasterTransformer
72
+ After version 5.1, [NVIDIA FasterTransformer](https://github.com/NVIDIA/FasterTransformer) now supports both inference for GPT-NeoX and a variety of soft prompts (including prefix-tuning). The released pretrained model and prefix weights in this repo have been verified to work with FasterTransformer 5.1.
73
+
74
+ # Licenese
75
+ [The MIT license](https://opensource.org/licenses/MIT)
config.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "activation_function": "gelu",
3
+ "architectures": [
4
+ "GPTNeoXForCausalLM"
5
+ ],
6
+ "attn_pdrop": 0.0,
7
+ "bos_token_id": 2,
8
+ "embd_pdrop": 0.0,
9
+ "eos_token_id": 3,
10
+ "gpt_j_residual": false,
11
+ "gradient_checkpointing": false,
12
+ "initializer_range": 0.02,
13
+ "layer_norm_epsilon": 1e-05,
14
+ "lm_head_bias": false,
15
+ "model_type": "gpt-neox",
16
+ "n_embd": 768,
17
+ "n_head": 12,
18
+ "n_inner": null,
19
+ "n_layer": 12,
20
+ "n_positions": 2048,
21
+ "resid_pdrop": 0.0,
22
+ "rotary": true,
23
+ "rotary_dim": null,
24
+ "scale_attn_weights": true,
25
+ "summary_activation": null,
26
+ "summary_first_dropout": 0.1,
27
+ "summary_proj_to_labels": true,
28
+ "summary_type": "cls_index",
29
+ "summary_use_proj": true,
30
+ "task_specific_params": {
31
+ "text-generation": {
32
+ "do_sample": true,
33
+ "max_length": 50,
34
+ "temperature": 1.0
35
+ }
36
+ },
37
+ "tie_word_embeddings": false,
38
+ "tokenizer_class": "T5Tokenizer",
39
+ "torch_dtype": "float32",
40
+ "use_cache": true,
41
+ "vocab_size": 44416
42
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b59cd532d22f3dad2a3afea49ba4eb66c084ca13e3e703bf3090a558ac9a1ced
3
+ size 663506729
rinna.png ADDED
smileface_suffix.task0.weight ADDED
Binary file (738 kB). View file
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:fa7a52f74800c7382e72a29e11bf95eb53cd9960a5d181bb37cc4482de43ebfb
3
+ size 1045480
tokenizer_config.json ADDED
@@ -0,0 +1 @@
 
1
+ {"eos_token": "</s>", "unk_token": "[UNK]", "pad_token": "[PAD]", "extra_ids": 0, "additional_special_tokens": [], "sp_model_kwargs": {}, "bos_token": "<s>", "cls_token": "[CLS]", "sep_token": "[SEP]", "mask_token": "[MASK]", "do_lower_case": false, "tokenizer_class": "T5Tokenizer"}