Langtrain Logo
Langtrain Docs
GuidesAPI referenceSDKs
GitHubOpen the app

Search documentation

Jump to any docs page

  • What is Langtrain
  • Quick start
  • Installation
GitHubDiscord

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. 1. Install the SDK

    Install the Langtrain SDK using pip. We recommend doing this inside a virtual environment.

    bash
    1pip install langtrain-ai
  2. 2. Prepare your data

    Create a .jsonl file. Each line must be a JSON object with a messages array in standard OpenAI format.

    json
    1{"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. 3. Train with LoRA

    Use the LoRATrainer to fine-tune your model. LoRA trains only a fraction of the parameters, so it is fast and memory-efficient.

    python
    1from langtrain import LoRATrainer
    2
    3trainer = LoRATrainer(
    4 model="meta-llama/Llama-3.3-8B",
    5 output_dir="./my-model"
    6)
    7
    8# Start training!
    9trainer.train("training_data.jsonl")
  4. 4. Deploy to Langtrain Cloud

    Push your trained model directly to Langtrain Cloud for instant production inference.

    python
    1# Deploy to Langtrain Cloud
    2trainer.push("my-custom-model")
    3
    4# Your model is now available via REST API!

    Next steps

    • Call your model through the REST API
    • Tune LoRA and QLoRA settings