Downloads · 30 days
106
16% of all-time downloads
snzhang/GPT2-Poem-Small
GPT2-Poem-Small is a text generation model from snzhang. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
The model is used to generate Chinese ancient poems and couplets. It is based on the IDEA-CCNL/Wenzhong-GPT2-110M
Downloads · 30 days
106
16% of all-time downloads
All-time downloads
680
Public
Repo size
261 MB
Likes
0
Public
Click a slice to open those files.
.bin261 MB · 99%
From the Hugging Face model README
The model is used to generate Chinese ancient poems and couplets. It is based on the IDEA-CCNL/Wenzhong-GPT2-110M
You can use the model directly with a pipeline for text generation:
When the parameter skip_special_tokens is True:
>>> from transformers import BertTokenizer, GPT2LMHeadModel,TextGenerationPipeline
>>> tokenizer = BertTokenizer.from_pretrained("snzhang/GPT2-Poem-Small")
>>> model = GPT2LMHeadModel.from_pretrained("snzhang/GPT2-Poem-Small")
>>> text_generator = TextGenerationPipeline(model, tokenizer)
>>> text_generator("笔底江山助磅礴", max_length=50, do_sample=True)
[{'generated_text':'笔底江山助磅礴,万卷诗书见成章。'}]
And you can add the prefix "(唐诗:your title)"、"(宋词:your title)" and "(对联)" to make generation more precise.
Training data contains 71,334 Chinese ancient poems and couplets which are collected by Chinese Poetry and Couplet Dataset
You can get more details in GPT2-Poem-Small