Downloads · 30 days
0
DanielFDias/Llama4B_fantasyStoriesUpdated
Llama4B_fantasyStoriesUpdated is a machine learning model from DanielFDias. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
This model is a Large Language Model (LLM) based on the Llama architecture, specifically adapted [or fine-tuned] to generate short fantasy stories. It is designed to take a structured prompt containing keywords, chara…
Downloads · 30 days
0
Access
Public
Updated Apr 7, 2025
Repo size
35.6 MB
Likes
0
Public
Click a slice to open those files.
.safetensors18.4 MB · 52%
From the Hugging Face model README
This model is a Large Language Model (LLM) based on the Llama architecture, specifically adapted [or fine-tuned] to generate short fantasy stories. It is designed to take a structured prompt containing keywords, characters, and plot points (beginning, midway, conclusion) and generate a narrative incorporating these elements.
This model was developed as part of a project documented in this Kaggle Notebook: https://www.kaggle.com/code/danieldias1998/isep-llm-fantasystories
Intended Use
This model is intended for:
Limitations
Midway and Conclusion. It uses the prompt as strong guidance rather than absolute constraints.max_length should be controlled).This model expects a prompt formatted exactly as follows. Ensure each section (Keywords, Characters, Beginning, Midway, Conclusion) starts on a new line.
from transformers import pipeline
# Replace '[your-huggingface-username/your-model-name]' with your actual model ID on the Hub
generator = pipeline('text-generation', model='[your-huggingface-username/your-model-name]')
prompt = """Keywords: castle, dragon, sword
Characters: A dragon named Ignis, a brave knight Sir Kaelan
Beginning: Sir Kaelan heard tales of a fierce dragon, Ignis, guarding an ancient castle and decided to investigate.
Midway: Upon meeting Ignis, Sir Kaelan discovered the dragon was misunderstood and lonely. They formed an unlikely friendship, exploring the castle's secrets together.
Conclusion: When a shadow army threatened the kingdom, Sir Kaelan, riding Ignis, led the charge, saving the realm and proving friendship is stronger than fear."""
# It's recommended to specify max_length and potentially other parameters
# Adjust max_length based on expected story size
generated_stories = generator(
prompt,
max_length=500, # Adjust as needed
num_return_sequences=1,
# Add other parameters like do_sample=True, temperature=0.7, top_k=50 if desired
)
for story in generated_stories:
print(story['generated_text'])
# The output will start with the prompt, followed by the generated story.
# You might need to process the output string to separate the prompt from the generation.