GPT-2 fine-tuned for short story generation
Gpt-2 for short story generation with genres.
Model description
Gpt-2 model fine-tuned on sample of BookCorpus dataset for short story generation, allows for the following genres (tokens to use as input under parenthesis):
- Romance (romance)
- Adventure (adventure)
- Mystery & detective (mystery-&-detective)
- Fantasy (fantasy)
- Humor & comedy (humor-&-comedy)
- Paranormal (paranormal)
- Science fiction (science-fiction)
Heavily inspired by https://huggingface.co/pranavpsv
Intended uses & limitations
This can be used for text generation.
How to use:
>>> from transformers import pipeline, TextGenerationPipeline, GPT2LMHeadModel, AutoTokenizer
>>> model_name = "aspis/gpt2-genre-story-generation"
>>> model = GPT2LMHeadModel.from_pretrained(model_name)
>>> tokenizer = AutoTokenizer.from_pretrained(model_name)
>>> generator = TextGenerationPipeline(model=model, tokenizer=tokenizer)
# Input should be of format "<BOS> <Genre token> Optional starter text"
>>> input_prompt = "<BOS> <adventure>"
>>> story = generator(input_prompt, max_length=80, do_sample=True,
repetition_penalty=1.5, temperature=1.2,
top_p=0.95, top_k=50)
>>> print(story)
[{'generated_text': '<BOS> <adventure> "How come they got that one?" asked Louran. The leader of the House, a young man with blonde hair and an odd grin...that didn\'t look so bad to her if she did have a smile on its face. She had known about this before. And now he\'d admitted it himself;'}]
Training data
The model was trained using the BookCorpus dataset by getting the different genres per book and dividing the text into paragraphs.
- Downloads last month
- 314
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social
visibility and check back later, or deploy to Inference Endpoints (dedicated)
instead.