download. The first run downloads the base model weights, which can be several gigabytes.
Who it is forA developer with a few thousand question and answer pairs from their own domain.
The problemGeneric models answer domain questions vaguely, and writing a training loop takes days.
The outcomeA finetuned checkpoint in out/custom-model/final that you can chat with and serve.
What you need first
- Python with pip
- A GPU for finetuning and pretraining
- Disk space for model weights
Steps
- Install with
pip install 'litgpt[extra]' - Download the example dataset with
curl -L https://huggingface.co/datasets/ksaw008/finance_alpaca/resolve/main/finance_alpaca.json -o my_custom_dataset.jsonor point to your own JSON file - Run
litgpt finetune microsoft/phi-2with--data JSON,--data.json_path my_custom_dataset.json,--data.val_split_fraction 0.1and--out_dir out/custom-model - Test the result with
litgpt chat out/custom-model/final - Deploy it with
litgpt serve out/custom-model/final
Prompt for your agent
Using Lightning-AI/litgpt, install it with `pip install 'litgpt[extra]'`, finetune microsoft/phi-2 on <my JSON dataset> with `litgpt finetune microsoft/phi-2 --data JSON --data.json_path my_custom_dataset.json --data.val_split_fraction 0.1 --out_dir out/custom-model`, then run `litgpt chat out/custom-model/final` and report five sample answers.
Caveat. Finetuning needs a GPU; training time depends on the dataset size and the card.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for Lightning-AI/litgpt and "Finetune a small LLM on your own JSON dataset"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer