binxu commited on
Commit
e2df3d1
1 Parent(s): e73b4c7

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +20 -0
README.md ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ancient chinese GPT2 model
2
+
3
+ ## Model description
4
+ This model is a GPT2 model trained to generate ancient Chinese text, with `bert-base-chinese` as tokenizer.
5
+
6
+ ## Training data
7
+ It's trained on the classic Chinese texts fetched from ctext.org.
8
+
9
+ ## How to use
10
+ You can use the model directly with a pipeline for text generation:
11
+
12
+ ```python
13
+ from transformers import pipeline, GPT2LMHeadModel
14
+
15
+ model = GPT2LMHeadModel.from_pretrained("binxu/Ziyue-GPT2")
16
+ generator = pipeline('text-generation', model=model, tokenizer='bert-base-chinese')
17
+ outputs = generator("子墨子曰", max_length=50, num_return_sequences=5, num_beams=10, repetition_penalty=1.5)
18
+
19
+ [{'generated_text': '子墨子曰 : 吾 未 得 见 之 时 , 知 有 失 得 之 时 , 有 为 之 者 。 氏 , 圣 王 之 时 , 万 乘 之 世 , 圣 人 不 易 之 道 也 。'}]
20
+ ```