CoolFace
Modelpublic

Mostafa8Mehrabi/qwen3-50m-storyteller

sourceHugging Faceapache-2.0updated 1y agoView on Hugging Face
0likes14downloads
Model Card

๐Ÿค– Qwen3-50M Storyteller

Fine-tuned version of Qwen3-50M specialized for storytelling tasks, trained on the TinyStories dataset.

๐Ÿ“Š Training Results

Loss Metrics

  • โ€”Final Training Loss: 4.90833215713501
  • โ€”Final Validation Loss: 4.2213897705078125
  • โ€”Initial Validation Loss: 7.947038650512695
  • โ€”Loss Improvement: 3.725648880004883 (46.880970935815526% reduction)

Training Configuration

  • โ€”Training Epochs: 3
  • โ€”Learning Rate: 2e-05
  • โ€”Batch Size: 4
  • โ€”Max Sequence Length: 512 tokens
  • โ€”Weight Decay: 0.01
  • โ€”Warmup Ratio: 0.1

Model Details

  • โ€”Precision: FP16 (Half Precision)
  • โ€”Base Model: Mostafa8Mehrabi/qwen3-50m
  • โ€”Dataset: TinyStories
  • โ€”Task: Causal Language Modeling (Story Generation)

๐Ÿš€ Usage

python
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("Mostafa8Mehrabi/qwen3-50m-storyteller")
model = AutoModelForCausalLM.from_pretrained(
    "Mostafa8Mehrabi/qwen3-50m-storyteller",
    torch_dtype=torch.float16,  # Use fp16 for efficiency
    device_map="auto"
)

# Generate a story
prompt = "<|story|>Once upon a time, there was a brave little mouse who"
inputs = tokenizer(prompt, return_tensors="pt")

with torch.no_grad():
    outputs = model.generate(
        **inputs,
        max_length=200,
        do_sample=True,
        temperature=0.8,
        top_p=0.9,
        repetition_penalty=1.1,
        pad_token_id=tokenizer.pad_token_id
    )

story = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(story)

๐Ÿ“ Story Format

The model expects stories to be formatted with special tokens:

  • โ€”Start: <|story|>
  • โ€”End: <|endstory|>

Example:

<|story|>Once upon a time, there was a magical forest where animals could talk...<|endstory|>

๐ŸŽฏ Intended Use

This model is specifically designed for:

  • โ€”Children's story generation
  • โ€”Creative writing assistance
  • โ€”Educational content creation
  • โ€”Interactive storytelling applications

โš ๏ธ Limitations

  • โ€”Optimized for short stories (up to 512 tokens)
  • โ€”Trained primarily on simple, child-friendly narratives
  • โ€”May not perform well on other text generation tasks

๐Ÿ“ˆ Performance

The model shows significant improvement in storytelling capability:

  • โ€”Validation loss reduced by 46.880970935815526% during training
  • โ€”Generates coherent, engaging short stories
  • โ€”Maintains appropriate tone and structure for children's content