Langtune·Open-source library
Fine-tune open modelson your own GPU.
Langtune is an open-source Python library for fine-tuning text models like Llama, Mistral, Qwen and Phi. It runs on your machine, so your training data stays there, and the weights you train are files you keep.
from langtune import FastLanguageModel
# Load an open model in 4-bit
model, tokenizer = FastLanguageModel.from_pretrained(
"meta-llama/Llama-3.1-8B",
load_in_4bit=True,
)
# Add a LoRA adapter
model = FastLanguageModel.get_peft_model(model, r=16, method="qlora")
# Train on your data; the adapter is saved to ./output
FastLanguageModel.train(
model, tokenizer, dataset,
output_dir="./output",
)What you get
Sensible defaults. Your hardware.
Runs locally
Training happens on your GPU. A run only goes to the cloud when a Langtrain API key is set.
Fits smaller GPUs
Models load in 4-bit with FlashAttention 2 and gradient checkpointing on by default, to keep memory use down.
Cloud when you need it
Need a bigger GPU? Start the run on Langtrain's GPUs from the dashboard, then take the weights back.
Your data as it is
Train from JSONL, CSV or a Hugging Face dataset, in plain text or instruction format.
Adapters or preferences
Pick a method per run: LoRA-style adapters, or preference training like DPO.
MIT licensed
Read the code, change it, and use it commercially.
Training methods
Eight methods. One argument.
Change method= to switch. The rest of your script stays the same.
- LoRASmall adapter on a frozen model
- QLoRALoRA on a 4-bit model; the default
- DoRAWeight-decomposed LoRA
- IA³Even fewer trainable parameters
- Prefix tuningLearned prompt vectors
- DPOLearn from preferred answers
- ORPOPreferences without a reference model
- KTOLearn from thumbs up / down
The Langtrain family
Four ways in. One model you own.
Use whichever fits how you work. They share one account and one API, so a run started in the cloud from any of them shows up in all of them.
- Langtrain StudioDesktop appManage datasets and fine-tuning runs from a native app for Windows and Linux.
- Langtrain SDKPython & TypeScriptUpload data, fine-tune and follow runs from code, with the lt command line.
- You're hereLangtuneOpen-source libraryFine-tune open text models like Llama, Mistral and Qwen on your own GPU.
- LangvisionOpen-source libraryFine-tune vision-language models like LLaVA and Qwen-VL on your own images.
Train your firstmodel tonight.
Install it, point it at your data, and run. The docs give the one-line install with the Hugging Face libraries it trains with.