Lightning-AI / Lightning-AI/lit-llama

How to train 13B version on 8bit with LoRA

Open
#413 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
6.1k
Forks
517
PR merge metrics
No merged PRs in 30d

Description

I want to train the 13B Lllama but with 8bit quantization LoRA. Rn it takes 70GB of GPU RAM which is quite a lot. I'm using 8xA100-80GB.

lora.py

# Hyperparameters
learning_rate = 3e-4
batch_size = 64
micro_batch_size = 1
gradient_accumulation_iters = batch_size // micro_batch_size
assert gradient_accumulation_iters > 0
max_iters = 50000 * 3 // micro_batch_size
weight_decay = 0.0
max_seq_length = 4096  # see scripts/prepare_alpaca.py
lora_r = 8
lora_alpha = 16
lora_dropout = 0.05
warmup_iters = 100
image
def main(
    data_dir: str = "dataset", 
    pretrained_path: str = "/scratch/checkpoints/lit-llama/13B/lit-llama.pth",
    tokenizer_path: str = "/scratch/checkpoints/lit-llama/tokenizer.model",
    out_dir: str = "out/lora",
):

    fabric = L.Fabric(accelerator="cuda", devices=8, precision="bf16-true")
    fabric.launch()
    fabric.seed_everything(1337 + fabric.global_rank)
    ...

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lora.py and its Fabric configuration, then review scripts/prepare_alpaca.py for the stated sequence-length context. Reproduce the 13B LoRA run with 8-bit quantization on the described 8x A100-80GB setup and document the supported configuration, memory use, and any required changes so the training procedure is reproducible.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.