Downloads · 30 days
18
11% of all-time downloads
yashu16/phrase-to-story-generator
phrase-to-story-generator is a text generation model from yashu16. Use it when you need the model to write or continue text. The card lists the license as mit.
A fine-tuned GPT-2 model specifically trained for generating creative stories from simple phrases.
Downloads · 30 days
18
11% of all-time downloads
All-time downloads
159
Public
Parameters
124M
1.5 GB on disk
Likes
0
Public
Click a slice to open those files.
.pt996 MB · 50%
From the Hugging Face model README
A fine-tuned GPT-2 model specifically trained for generating creative stories from simple phrases.
from transformers import GPT2LMHeadModel, GPT2Tokenizer
import torch
# Load the model
tokenizer = GPT2Tokenizer.from_pretrained("yashu16/phrase-to-story-generator")
model = GPT2LMHeadModel.from_pretrained("yashu16/phrase-to-story-generator")
# Generate a story
phrase = "magical forest adventure"
prompt = f"Story prompt: {phrase}\n\nStory:"
inputs = tokenizer.encode(prompt, return_tensors="pt")
with torch.no_grad():
outputs = model.generate(
inputs,
max_length=200,
temperature=0.8,
do_sample=True,
pad_token_id=tokenizer.eos_token_id
)
story = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(story.split("Story:")[-1].strip())
This model was fine-tuned on a curated dataset of phrase-to-story pairs, focusing on:
Input: "magical forest adventure" Output: A captivating story about enchanted forests, mystical creatures, and heroic journeys.
Input: "space exploration mission" Output: An exciting tale of cosmic discovery, alien encounters, and interstellar adventures.
This model is designed for creative writing assistance and entertainment. Users should:
Created by yashu16 | GitHub | Hugging Face