0x71d3 commited on
Commit
5fb9822
1 Parent(s): 70ffbc0

add readme

Browse files
Files changed (1) hide show
  1. README.md +58 -0
README.md ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - ja
4
+ license: cc-by-sa-4.0
5
+ datasets:
6
+ - wikipedia
7
+ widget:
8
+ - text: "早稲田 大学 で 自然 言語 処理 を"
9
+ ---
10
+
11
+ # nlp-waseda/gpt2-small-japanese-wikipedia
12
+
13
+ This model is Japanese GPT-2 pretrained on Japanese Wikipedia.
14
+
15
+ ## Intended uses & limitations
16
+
17
+ You can use the raw model for text generation or fine-tune it to a downstream task.
18
+
19
+ Note that the texts should be segmented into words using Juman++ in advance.
20
+
21
+ ### How to use
22
+
23
+ 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:
24
+
25
+ ```python
26
+ >>> from transformers import pipeline, set_seed
27
+ >>> generator = pipeline('text-generation', model='nlp-waseda/gpt2-small-japanese-wikipedia')
28
+ >>> set_seed(42)
29
+ >>> generator("早稲田 大学 で 自然 言語 処理 を", max_length=30, do_sample=True, pad_token_id=2, num_return_sequences=5)
30
+ [{'generated_text': '早稲田 大学 で 自然 言語 処理 を 学び 、 1969 年 に は 同 大学院 を 修了 。 東京 芝浦 電気 株式 会社 に 就職 後 、 情報 処理'},
31
+ {'generated_text': '早稲田 大学 で 自然 言語 処理 を 学び 、 帰国 後 は 立教 大学 理学部 助手 を 務めた 。 1978 年 に 神奈川 県立 湘南 高等 学校 校長 に 就任'},
32
+ {'generated_text': '早稲田 大学 で 自然 言語 処理 を 研究 。 1972 年 に 早稲田 大学 文学部 ドイツ 文学 専攻 を 卒業 し 、 同 年 から 1979 年 まで 上智 大学'},
33
+ {'generated_text': '早稲田 大学 で 自然 言語 処理 を 専攻 する 。 1979 年 東京 農工 大学 農学 部 卒業 。 1980 年 同 大学院 農学 研究 科 修士 課程 修了 。'},
34
+ {'generated_text': '早稲田 大学 で 自然 言語 処理 を 専攻 し ながら 、 日本 で 活動 する 自然 言語 研究 家 。 大学 時代 は 東京 大学 理学部 の 助手 を 務め'}]
35
+ ```
36
+
37
+ Here is how to use this model to get the features of a given text in PyTorch:
38
+
39
+ ```python
40
+ from transformers import ReformerTokenizer, GPT2Model
41
+ tokenizer = ReformerTokenizer.from_pretrained('nlp-waseda/gpt2-small-japanese-wikipedia')
42
+ model = GPT2Model.from_pretrained('nlp-waseda/gpt2-small-japanese-wikipedia')
43
+ text = "早稲田 大学 で 自然 言語 処理 を"
44
+ encoded_input = tokenizer(text, return_tensors='pt')
45
+ output = model(**encoded_input)
46
+ ```
47
+
48
+ ## Training data
49
+
50
+ The GPT-2 model was pretrained on Japanese Wikipedia, dumped on 2021-12-20.
51
+
52
+ ## Training procedure
53
+
54
+ ### Preprocessing
55
+
56
+ The texts are normalized using zenhan, segmented into words using Juman++, and tokenized using SentencePiece. Juman++ 2.0.0-rc3 was used for pretraining.
57
+
58
+ The model was trained on 8 NVIDIA A100 GPUs.