Lightning-AI / Lightning-AI/litgpt
False positive warning about mixed precision in `merge_lora.py`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 13.7k
- Forks
- 1.5k
- Avg merge
- 15h 37m
- Merged PRs (30d)
- 1
Description
If the user finetunes LoRA with 16-mixed, we will reinstantiate Fabric with this precision when merging LoRA weights:
https://github.com/Lightning-AI/litgpt/blob/c32eddbfeaee264a6201e050c11213bd442838b5/litgpt/scripts/merge_lora.py#L40-L43
However, 16-mixed is not supported on CPU, and Fabric will automatically emit a warning and switch to bf16-mixed:
```
You passed `Fabric(accelerator='cpu', precision='16-mixed')` but AMP with fp16 is not supported on CPU. Using `precision='bf16-mixed'` instead.
```
We should avoid/suppress this warning because it is a false positive and doesn't matter, since all we care about here is the weights. It could confuse users who configure Fabric in their training script and don't know what we are doing under the hood in `merge_lora.py`.
https://discord.com/channels/1077906959069626439/1105501395207065802/1225101652563066922
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at litgpt/scripts/merge_lora.py lines 40-43 and inspect how Fabric is reinstantiated with the configured precision. Reproduce the CPU/16-mixed merge path and verify that weight merging no longer emits the misleading warning while preserving the merge behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100