Quick start
Install the SDK, prepare a dataset, train with LoRA and deploy. A 7B model on 1,000 examples trains in about 20 minutes.
- Python 3.9+
- GPU optional
1. Install the SDK
Install the Langtrain SDK using pip. We recommend doing this inside a virtual environment.
bash1pip install langtrain-ai2. Prepare your data
Create a
.jsonlfile. Each line must be a JSON object with a messages array in standard OpenAI format.json1{"messages": [{"role": "user", "content": "What is Langtrain?"}, {"role": "assistant", "content": "It's a platform for fine-tuning LLMs."}]}2{"messages": [{"role": "user", "content": "How do I start?"}, {"role": "assistant", "content": "Use the LoRATrainer class!"}]}3. Train with LoRA
Use the
LoRATrainerto fine-tune your model. LoRA trains only a fraction of the parameters, so it is fast and memory-efficient.python1from langtrain import LoRATrainer23trainer = LoRATrainer(4 model="meta-llama/Llama-3.3-8B",5 output_dir="./my-model"6)78# Start training!9trainer.train("training_data.jsonl")4. Deploy to Langtrain Cloud
Push your trained model directly to Langtrain Cloud for instant production inference.
python1# Deploy to Langtrain Cloud2trainer.push("my-custom-model")34# Your model is now available via REST API!