Lightning-AI / Lightning-AI/litgpt

Determine the default precision and quantization in chat and generate

Open
#1,253 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
13.7k
Forks
1.5k
Avg merge
15h 37m
Merged PRs (30d)
1

Description

If you finetune a model with a certain quantization and precision setting, you still need to specify that in the chat and generate commands today:

```py
litgpt chat \
--checkpoint_dir out/qlora-codellama-13b/final \
--precision bf16-true \
--quantize bnb.nf4-dq
```
Otherwise you may get an OOM or different results that you were getting during training. Since we store the hyperparameters in a yaml file, we could select the two settings automatically if they are not specified:

```py
# uses precision=bf16-true and quantize=bnb.nf4-dq from checkpoint folder
litgpt chat --checkpoint_dir out/qlora-codellama-13b/final
```

We already do this in other parts of LitGPT, so we could just reuse the utility function to read the two settings from the checkpoint.

Contributor guide

Open the contributing guide

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 by locating the chat and generate command entry points and the existing utility that reads hyperparameters from a checkpoint, as referenced in the issue. The work is done when omitted precision and quantization values are selected from the checkpoint while explicitly supplied values continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ai, cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.