Description
This model converts worlds and locations described in the DAGGER JSON format into fictional narrative stories. See more information about the DAGGER dataset.
Example Usage
Make sure you have the latest versions of torch
, transformers
, quanto
, and accelerate
with:
pip install -U torch==2.2.1 transformers==4.39.1 quanto==0.1.0 accelerate==0.28.0
import json
from transformers import pipeline, TextStreamer, QuantoConfig
pipe = pipeline(
"text-generation",
"dagger-realms/dagger_to_narrative",
model_kwargs={
"quantization_config": QuantoConfig(weights="int8"),
"low_cpu_mem_usage": True,
},
device_map="auto",
)
input_dagger_objects = [{ "name": "The Brush Den", "description": "The entryway to the brush den is made of arched bushes and various plants, as is the ceiling and walls. The inside is furnished with seats made of plant roots that have grown together, and a table made of wood adorned with flowers and wooden cups and plates. A small vine dangles with a glowing floor from the middle of the ceiling that lights the room dimly. Three small beds lay in one corner of the room made of interlaced grass and leaves.", "background": "The fae inhibit this small cot hidden in the brush of the forest. These small creatures slowly add new brush and decorations to their den as they scavenge the forest for food and supporting their animal friends. The small den lies just a short distance east of the lake with the door facing the lake. One might easily miss it with a quick glance as many bushes and glowing flowers are outside of it.", "connections": {"north": "Ant Hill", "east": "Pine Tree Graveyard"}, "items": { "Wooden Table": { "name": "Wooden Table", "description": "A small table made from wood and adorned with fresh flowers.", "examine_text": "Carefully carved and beautifully adorned with flowers of various shapes and vibrant colors. The surface is flat and smooth, perfect for setting down items.", "properties": { "is_container": False, "is_drink": False, "is_food": False, "is_gettable": False, "is_surface": True, "is_weapon": False, "is_wearable": False }, "location": "The Brush Den" }, "Root Chair": { "name": "Root Chair", "description": "A seat made of interlaced roots growing together.", "examine_text": "The chair, although made completely of knotted roots, looks surprisingly comfortable.", "properties": { "is_container": False, "is_drink": False, "is_food": False, "is_gettable": False, "is_surface": False, "is_weapon": False, "is_wearable": False }, "location": "The Brush Den" }, "Leaf Bed": { "name": "Leaf Bed", "description": "A small bed made of interwoven grasses and leaves.", "examine_text": "The petite bed seems unexpectedly soft, the leaves are intact and damp giving the sensation of freshness.", "properties": { "is_container": False, "is_drink": False, "is_food": False, "is_gettable": False, "is_surface": False, "is_weapon": False, "is_wearable": False }, "location": "The Brush Den" }, "Glowing Flower": { "name": "Glowing Flower", "description": "A beautiful flower glowing with a soft light.", "examine_text": "The flower glows with a mystic light and upon closer inspection, it appears to have a faint magical aura.", "properties": { "is_container": False, "is_drink": False, "is_food": False, "is_gettable": True, "is_surface": False, "is_weapon": False, "is_wearable": True }, "location": "The Brush Den" } }, "characters": { "Faelin": { "name": "Faelin", "description": "Faelin is petite, with sparkling green eyes and a nimble body. His wings are transparent, shimmering in the faint light and his attire consists of tattered cloth and leaf armor.", "persona": "I love the forest, it\u2019s full of adventure and life. I enjoy adding new brush and decorations to our den and taking care of our animal friends.", "goal": "I aim to preserve and protect the forest and its inhabitants.", "location": "The Brush Den", "inventory": { "Leaf Armor": { "name": "Leaf Armor", "description": "A light and intricate armor piece made of sturdy leaves and vines", "examine_text": "Upon closer look, you can see the careful selection of the sturdiest leaves and strongest vines laced together to create this lightweight armor. It's designed beautifully with tiny flowers and stems to blend in with the forest surroundings.", "properties": { "is_container": False, "is_drink": False, "is_food": False, "is_gettable": True, "is_surface": False, "is_weapon": False, "is_wearable": True } }, "Berries": { "name": "Berries", "description": "Freshly picked sweet and juicy berries", "examine_text": "A handful of bright red and blue berries, freshly picked off a nearby bush. These berries look incredibly sweet and juicy, perfect for a quick snack or making a potion.", "properties": { "is_container": False, "is_drink": False, "is_food": True, "is_gettable": True, "is_surface": False, "is_weapon": False, "is_wearable": False } }, "Small Wooden Knife": { "name": "Small Wooden Knife", "description": "A simple but effective weapon crafted from sturdy wood", "examine_text": "Looking closer, the knife seems to be carved from a solid piece of dense wood, with intricate vine decorations etched into the blade, most likely by Faelin. The handle is worn, showing years of use, yet it's still strong and functional.", "properties": { "is_container": False, "is_drink": False, "is_food": False, "is_gettable": True, "is_surface": False, "is_weapon": True, "is_wearable": False } } } }, "Lila": { "name": "Lila", "description": "Lila is delicate fairy with luminescent wings that reflect off the glowing flora around her. Her dress is made from soft petals of native flowers, and her hair is silver like moonlight.", "persona": "The forest is my True home. I love tending to our garden and collecting magical herbs that can aid in our journey.", "goal": "My ultimate goal is to gather and learn as much about magical herbs and their properties.", "location": "The Brush Den", "inventory": { "Petalled Dress": { "name": "Petalled Dress", "description": "A beautifully crafted dress from the petals of the forest's flowers.", "examine_text": "The dress looks delicate and vibrant, displaying an array of colors and patterns. The petals are carefully arranged to seem like they are naturally blooming. When closely examined, it gets clear that magical essence has been woven into the petals to keep them fresh.", "properties": { "is_container": False, "is_drink": False, "is_food": False, "is_gettable": True, "is_surface": False, "is_weapon": False, "is_wearable": True } }, "Magical Herbs": { "name": "Magical Herbs", "description": "An assortment of herbs, emanating a mystical aura.", "examine_text": "Upon closer inspection, each herb appears to contain its own unique magical property. Some seem to give off a glow, while others vary in colors in a way not found in normal herbs. The scent coming from the herbs is intense and captivating, reminiscent of the heart of the forest itself.", "properties": { "is_container": False, "is_drink": False, "is_food": False, "is_gettable": True, "is_surface": False, "is_weapon": False, "is_wearable": False } }, "Healing Salve": { "name": "Healing Salve", "description": "A small wooden jar containing a magical healing salve.", "examine_text": "The small wooden jar is unassuming from the outside. The healing salve is a radiant green, glittering with magical essence. It gives off a calming scent, and you can feel a sense of relief just by being in close proximity.", "properties": { "is_container": True, "is_drink": False, "is_food": False, "is_gettable": True, "is_surface": False, "is_weapon": False, "is_wearable": False } } } }, "Renn": { "name": "Renn", "description": "Renn, the eldest, is full of wisdom and has a calming presence. He has lost his wings due to an old battle wound. His clothing is more modest, made from woven grass.", "persona": "The forest is full of danger, but it's also full of potential allies. I may not have my wings, but my knowledge and guidance aid our clan.", "goal": "I want to educate my clanmates about the importance of unity and strength in numbers.", "location": "The Brush Den", "inventory": { "Woven Grass Attire": { "name": "Woven Grass Attire", "description": "A suit made from interwoven grass and leaves.", "examine_text": "The attire is light and airy, with individual blades of grass skillfully woven into a naturally camouflaged suit. Tiny flowers are adorn the edges, adding color to it. The detail and craftsmanship suggest the hand of an expert, someone who knows the forest well.", "properties": { "is_container": False, "is_drink": False, "is_food": False, "is_gettable": True, "is_surface": False, "is_weapon": False, "is_wearable": True } }, "Tattered Map": { "name": "Tattered Map", "description": "A worn out map of the forest.", "examine_text": "The map, despite being tattered, is still readable. It appears to consist of all the important locations around the forest, including the safest paths for travel. It's intricate, clearly made by one who traverses the forest regularly.", "properties": { "is_container": False, "is_drink": False, "is_food": False, "is_gettable": True, "is_surface": False, "is_weapon": False, "is_wearable": False } }, "Dented Flask": { "name": "Dented Flask", "description": "A flask with a notable dent on one side.", "examine_text": "The flask, though dented, seems to be able to hold liquids without any leaks. It's made of metal with a leather wrap for insulation. Beads of moisture on the outside suggest something inside is cold.", "properties": { "is_container": True, "is_drink": True, "is_food": False, "is_gettable": True, "is_surface": False, "is_weapon": False, "is_wearable": False } } } } } }]
input_dagger_jsons = [json.dumps(o, indent=4) for o in input_dagger_objects]
streamer = TextStreamer(
pipe.tokenizer, skip_prompt=True
) # Streams the output to your terminal
output_stories = pipe(
input_dagger_jsons,
streamer=streamer,
max_new_tokens=2048,
top_p=0.3,
repetition_penalty=1.1,
exponential_decay_length_penalty=(850, 1.05),
do_sample=True,
return_full_text=False,
batch_size=1,
)
This model was trained with a synthetic dataset with DataDreamer ๐ค๐ค. The synthetic dataset card and model card can be found here. The training arguments can be found here.
- Downloads last month
- 21
Model tree for dagger-realms/dagger_to_narrative
Base model
LouisML/tinyllama_32k