tide commited on
Commit
2d14ed0
1 Parent(s): 0a09a66

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +56 -0
README.md CHANGED
@@ -1,3 +1,59 @@
1
  ---
 
 
2
  license: cc-by-sa-4.0
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language:
3
+ - ja
4
  license: cc-by-sa-4.0
5
+ datasets:
6
+ - wikipedia
7
+ - cc100
8
+ widget:
9
+ - text: "早稲田 大学 で 自然 言語 処理 を"
10
  ---
11
+
12
+ # nlp-waseda/gpt2-small-japanese
13
+
14
+ This model is Japanese GPT-2 pretrained on Japanese Wikipedia and CC-100.
15
+
16
+ ## Intended uses & limitations
17
+
18
+ You can use the raw model for text generation or fine-tune it to a downstream task.
19
+
20
+ Note that the texts should be segmented into words using Juman++ in advance.
21
+
22
+ ### How to use
23
+
24
+ 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:
25
+
26
+ ```python
27
+ >>> from transformers import pipeline, set_seed
28
+ >>> generator = pipeline('text-generation', model='nlp-waseda/gpt2-small-japanese')
29
+ >>> set_seed(42)
30
+ >>> generator("早稲田 大学 で 自然 言語 処理 を", max_length=30, do_sample=True, pad_token_id=2, num_return_sequences=5)
31
+ [{'generated_text': '早稲田 大学 で 自然 言語 処理 を 学び 、 帰国 後 、 早稲田 大学 理工 学部 に 入学 し ます 。 卒業 後 、 早稲田 大学 工学 研究 科 、'},
32
+ {'generated_text': '早稲田 大学 で 自然 言語 処理 を 学び 、 アメリカ の 大学 で 学士 号 を 取得 、 修士 の 取得 で 博士 号 を 取得 。 2008 年'},
33
+ {'generated_text': '早稲田 大学 で 自然 言語 処理 を 勉強 して い ます 。 学部 は 日本 語 学科 を 専攻 して い ます 。 英語 が 話せる と いう'},
34
+ {'generated_text': '早稲田 大学 で 自然 言語 処理 を 専攻 して いた 。 2011 年 に 第 26 回 日本 化学 会 学生 委員 会 奨励 賞 ( 第 2 年次 審査'},
35
+ {'generated_text': '早稲田 大学 で 自然 言語 処理 を 中心 と する 言語 学 研究 を 行って いる 。 東京 都 ・ 豊島 区 の お 見合い 相手 。'}]
36
+ ```
37
+
38
+ Here is how to use this model to get the features of a given text in PyTorch:
39
+
40
+ ```python
41
+ from transformers import ReformerTokenizer, GPT2Model
42
+ tokenizer = ReformerTokenizer.from_pretrained('nlp-waseda/gpt2-small-japanese')
43
+ model = GPT2Model.from_pretrained('nlp-waseda/gpt2-small-japanese')
44
+ text = "早稲田 大学 で 自然 言語 処理 を"
45
+ encoded_input = tokenizer(text, return_tensors='pt')
46
+ output = model(**encoded_input)
47
+ ```
48
+
49
+ ## Training data
50
+
51
+ The GPT-2 model was pretrained on Japanese Wikipedia, dumped on 2022-03-20, and the Japanese portion of CC-100.
52
+
53
+ ## Training procedure
54
+
55
+ ### Preprocessing
56
+
57
+ The texts are normalized using zenhan, segmented into words using Juman++, and tokenized using SentencePiece. Juman++ 2.0.0-rc3 was used for pretraining.
58
+
59
+ The model was trained on 8 NVIDIA A100 GPUs.