What do you want to do?
3 use cases
-
Finetune a small LLM on your own JSON dataset
Use the Litgpt finetune command to train microsoft/phi-2 on a JSON file of examples, then chat with and serve the result.
View prompt
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.
-
Serve an open LLM as a local HTTP API
Start Litgpt serve on an off the shelf model and call its /predict endpoint from Python.
View prompt
With Lightning-AI/litgpt, run `litgpt serve microsoft/phi-2`, then write a small Python script that posts {"prompt": "Fix typos in the following sentence: Example input"} to http://127.0.0.1:8000/predict and prints the output field. -
Benchmark a model on MMLU and TruthfulQA
Run Litgpt evaluate with the truthfulqa_mc2 and mmlu tasks to score a base or finetuned model.
View prompt
Using Lightning-AI/litgpt, run `litgpt evaluate microsoft/phi-2 --tasks 'truthfulqa_mc2,mmlu'` and the same command on <my checkpoint folder>, then put both sets of scores in one table.
Quick start with Litgpt
- Check you have what it needs: Python with pip; A GPU for finetuning and pretraining; Disk space for model weights.
- Open Lightning-AI/litgpt on GitHub and read the README and license.
- 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
These steps come from our top use case, Finetune a small LLM on your own JSON dataset, which also has a copy-paste agent prompt.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for Lightning-AI/litgpt
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 freeAbout this repo
- Who it is forDevelopers and ML engineers who want to finetune or serve an open model without writing a training stack.
- Why it is hot14k stars, talked about in 2 AI sources we track
- LanguagePython
- Sourcegithub.com/Lightning-AI/litgpt ยท Back to Hot repos
Requirements
- Python with pip
- A GPU for finetuning and pretraining
- Disk space for model weights
Add this badge to your README
Maintain Litgpt? Show readers where to find these use cases.
Markdown
[](https://dedupedai.com/use-cases/lightning-ai-litgpt/?utm_source=github&utm_medium=badge&utm_campaign=Lightning-AI-litgpt)
HTML
<a href="https://dedupedai.com/use-cases/lightning-ai-litgpt/?utm_source=github&utm_medium=badge&utm_campaign=Lightning-AI-litgpt"><img src="https://dedupedai.com/badge/Lightning-AI/litgpt.svg" alt="Use cases on Deduped" height="20"></a>
A static image, no tracking script. About the badge
Questions about Litgpt
What is Litgpt?
LitGPT is a Python library and command line tool to pretrain, finetune, evaluate, chat with and serve 20+ open LLMs. One `litgpt` command covers each action and downloads model weights on first use. It is an open-source project on GitHub: https://github.com/Lightning-AI/litgpt.
How do I use Litgpt?
Install with pip install 'litgpt[extra]'; then download the example dataset with curl -L https://huggingface.co/datasets/ksaw008/finance_alpaca/resolve/main/finance_alpaca.json -o my_custom_dataset.json or point to your own JSON file; run litgpt finetune microsoft/phi-2 with --data JSON, --data.json_path my_custom_dataset.json, --data.val_split_fraction 0.1 and --out_dir out/custom-model. The use cases on this page give the full steps and a copy-paste agent prompt for each job.
Who is Litgpt for?
Developers and ML engineers who want to finetune or serve an open model without writing a training stack.
What can I do with Litgpt?
3 use cases so far, for example: Finetune a small LLM on your own JSON dataset; Serve an open LLM as a local HTTP API; Benchmark a model on MMLU and TruthfulQA. Each has steps and a copy-paste agent prompt.
What do I need to run Litgpt?
Python with pip; A GPU for finetuning and pretraining; Disk space for model weights.
What are alternatives to Litgpt?
Other hot AI repos in Software and DevOps: Skills, Claude Mem, Freellmapi, Andrej Karpathy Skills, Agent Desktop.
Is Litgpt safe to run?
Deduped does not own, audit or vouch for it. Read the README and license, run it on your own systems first and review every command before you run it.