souljoy commited on
Commit
3370736
1 Parent(s): 26bee8e

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +31 -0
README.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: zh
3
+ datasets: CLUECorpusSmall
4
+ widget:
5
+ - text: 这是很久之前的事情了
6
+ pipeline_tag: text-generation
7
+ ---
8
+
9
+
10
+ # Chinese GPT2 Model
11
+
12
+ ## Model description
13
+
14
+ The model is used to generate Chinese texts.
15
+ ## How to use
16
+
17
+ You can use the model directly with a pipeline for text generation:
18
+
19
+ ```python
20
+ >>> from transformers import BertTokenizer, GPT2LMHeadModel, TextGenerationPipeline
21
+ >>> tokenizer = BertTokenizer.from_pretrained("uer/gpt2-chinese-cluecorpussmall")
22
+ >>> model = GPT2LMHeadModel.from_pretrained("uer/gpt2-chinese-cluecorpussmall")
23
+ >>> text_generator = TextGenerationPipeline(model, tokenizer)
24
+ >>> text_generator("这是很久之前的事情了", max_length=100, do_sample=True)
25
+ [{'generated_text': '这是很久之前的事情了 。 至 今 仍 留 在 我 身 上 , 我 记 忆 犹 新 。 在 接 受 记 者 采 访 时 , 杨 杰 表 白 了 , 当 初 有 没 有 见 过 我 , 我 不 认 为 他 们 是 不 合 适 的 人 。 虽 然 当 时 他 们 不 信 我 , 但 杨 杰 表 示 , 感 觉 那 个 时 候 感 觉 是 好 想 听 他 们 说 话 ,'}]
26
+
27
+ ```
28
+
29
+ ## Training data
30
+
31
+ [CLUECorpusSmall](https://github.com/CLUEbenchmark/CLUECorpus2020/) is used as training data.