Skip to content

fix(merge_lora): use CPU-safe precision to avoid false AMP warning - #2322

Open
ShamikOfficial wants to merge 1 commit into
Lightning-AI:mainfrom
ShamikOfficial:fix/1242-merge-lora-precision-warning
Open

fix(merge_lora): use CPU-safe precision to avoid false AMP warning#2322
ShamikOfficial wants to merge 1 commit into
Lightning-AI:mainfrom
ShamikOfficial:fix/1242-merge-lora-precision-warning

Conversation

@ShamikOfficial

Copy link
Copy Markdown

Summary

closes #1242

merge_lora always runs Fabric on CPU, but it used to reuse the training precision from hyperparameters (often 16-mixed). Fabric then warns that AMP fp16 is unsupported on CPU and switches to bf16-mixed. That warning is misleading here: merge only loads weights and sets dtype from the LoRA checkpoint.

This change instantiates Fabric with 32-true so the warning is not emitted. Merge output is unchanged.

Test plan

  • pytest tests/test_merge_lora.py::test_merge_lora_avoids_16_mixed_cpu_warning tests/test_merge_lora.py::test_merge_lora

merge_lora only needs weights and already sets dtype from the LoRA checkpoint, so reusing training precision like 16-mixed on CPU only triggers a misleading Fabric warning.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False positive warning about mixed precision in merge_lora.py

1 participant