Instructions to use DanielFDias/Llama4B_fantasyStoriesUpdated with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use DanielFDias/Llama4B_fantasyStoriesUpdated with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("DanielFDias/Llama4B_fantasyStoriesUpdated", device_map="auto") - Notebooks
- Google Colab
- Kaggle
[Llama-Fantasy-Story-Generator]
Model Description
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 Uses & Limitations
Intended Use
This model is intended for:
- Generating creative fantasy story snippets based on user-provided structural elements.
- Experimentation with controlled text generation in the fantasy genre.
- Serving as a creative aid or inspiration for writers.
Limitations
- Prompt Dependency: The quality and coherence of the generated story heavily depend on the clarity and consistency of the input prompt.
- Strict Adherence: The model may not always perfectly adhere to every detail in the prompt structure, especially nuances in the
MidwayandConclusion. It uses the prompt as strong guidance rather than absolute constraints. - Repetition & Coherence: Like many LLMs, it may sometimes generate repetitive text or lose coherence over longer passages (though
max_lengthshould be controlled). - Factuality & Bias: The model generates fictional content. It may inherit biases present in the base Llama model or any fine-tuning data. It should not be used for factual information.
- Context Length: The effective context length might be limited [mention if you know the specific limit].
How to Use
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.
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐ Ask for provider support