Phrase-to-Story Generator
A fine-tuned GPT-2 model specifically trained for generating creative stories from simple phrases.
Model Details
- Base Model: GPT-2
- Training: Fine-tuned on diverse creative writing prompts
- Use Case: Convert short phrases into engaging stories
- Language: English
- License: MIT
Usage
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())
Training Details
This model was fine-tuned on a curated dataset of phrase-to-story pairs, focusing on:
- Fantasy and adventure themes
- Creative narrative development
- Coherent story structure
- Engaging character development
Sample Outputs
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.
Model Performance
- Generates coherent stories of 50-200 words
- Maintains thematic consistency with input phrases
- Creates engaging narrative arcs
- Demonstrates creative language use
Updates
- Latest: 2025-09-03 11:39:58 - Updated model with improved training
- Version: 2.0
- Training Data: Enhanced with high-quality story examples
Limitations
- Best results with 1-4 word input phrases
- English language only
- Creative fiction focus (not factual content)
- May require multiple generations for optimal results
Ethical Considerations
This model is designed for creative writing assistance and entertainment. Users should:
- Review generated content for appropriateness
- Not rely on outputs for factual information
- Use responsibly for creative purposes
Created by yashu16 | GitHub | Hugging Face
- Downloads last month
- 6