Instructions to use madImad/questcrafter-distilgpt2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use madImad/questcrafter-distilgpt2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="madImad/questcrafter-distilgpt2")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("madImad/questcrafter-distilgpt2") model = AutoModelForCausalLM.from_pretrained("madImad/questcrafter-distilgpt2") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use madImad/questcrafter-distilgpt2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "madImad/questcrafter-distilgpt2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "madImad/questcrafter-distilgpt2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/madImad/questcrafter-distilgpt2
- SGLang
How to use madImad/questcrafter-distilgpt2 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "madImad/questcrafter-distilgpt2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "madImad/questcrafter-distilgpt2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "madImad/questcrafter-distilgpt2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "madImad/questcrafter-distilgpt2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use madImad/questcrafter-distilgpt2 with Docker Model Runner:
docker model run hf.co/madImad/questcrafter-distilgpt2
๐ง QuestCrafter โ Instruction-Tuned distilgpt2 (TinyStories) ๐ Overview
QuestCrafter is a fine-tuned version of distilgpt2 trained on a structured fantasy quest dataset derived from TinyStories.
The model generates short RPG-style quests conditioned on structured control tokens:
<LEVEL=X>
<SETTING=...>
<TONE=...>
<LENGTH=...>
This project was developed as part of the MSc AI Machine Learning course.
๐ Dataset
Base dataset: TinyStories (Hugging Face)
We reformatted the dataset into an instruction-style supervised format:
<LEVEL=3> <SETTING=forest> <TONE=dark> <LENGTH=short>
Instruction:
Create a quest involving betrayal.
Response:
...
Train/Validation/Test split: 80/10/10.
๐ Training Setup
Base model: distilgpt2
Framework: PyTorch + Hugging Face Transformers
Epochs: 3
Learning rate: 5e-5
Batch size: 8
Max length: 256
Mixed precision (fp16) enabled on GPU
๐ฎ Controllability
The model supports structured control tokens:
Level (1โ10)
Setting (forest, desert city, medieval town, etc.)
Tone (epic, dark, humorous)
Length (short / medium)
This enables conditional generation and improved prompt-faithfulness compared to baseline distilgpt2.
๐ Evaluation
We compared baseline distilgpt2 vs fine-tuned model on a fixed test set of 50 prompts.
Metrics used:
Validation loss
Perplexity
Distinct-2 (diversity metric)
Human evaluation rubric (1โ5 scale):
Coherence
Prompt-faithfulness
Creativity
The fine-tuned model showed:
Lower perplexity
Higher prompt-faithfulness
Improved structural consistency
๐ก Safety
A lightweight keyword-based safety filter is applied during generation to prevent harmful or inappropriate content. Unsafe generations are automatically regenerated.
โ ๏ธ Limitations
May occasionally ignore control tokens
May produce repetitive text for long outputs
Not trained for real-world advisory use
Fantasy-only domain
๐ Academic Context
This model was developed for the QuestCrafter AI project (MSc AI). It demonstrates:
Instruction-style fine-tuning
Controlled generation
Baseline vs tuned comparison
Structured evaluation pipeline
- Downloads last month
- 5
Model tree for madImad/questcrafter-distilgpt2
Base model
distilbert/distilgpt2